diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py index ed92f673..b5e97f90 100644 --- a/arknights_mower/solvers/base_schedule.py +++ b/arknights_mower/solvers/base_schedule.py @@ -1713,7 +1713,7 @@ def get_resting_plan_new(self, agents, exist_replacement, plan, current_resting) if ( (op.current_mood() - op.lower_limit) / (op.upper_limit - op.lower_limit) ) > self.op_data.config.resting_threshold: - continue + return required += 1 logger.debug(f"需求:{current_resting} 当前休息") logger.debug(f"需求:{required}宿舍空位") diff --git a/arknights_mower/utils/operators.py b/arknights_mower/utils/operators.py index 05109f72..e69e8520 100644 --- a/arknights_mower/utils/operators.py +++ b/arknights_mower/utils/operators.py @@ -4,6 +4,7 @@ from evalidate import Expr, base_eval_model from arknights_mower.utils.plan import PlanConfig +from . import config from ..data import agent_arrange_order, agent_list, base_room_list from ..solvers.record import save_action_to_sqlite_decorator @@ -280,8 +281,12 @@ def init_and_validate(self, update=False): ): self.run_order_rooms[x] = {} # 判定分组排班可能性 + current_high = self.config.max_resting_count + current_low = len(self.dorm) - self.config.max_resting_count for key in self.groups: total_count = 0 + high_count = 0 + low_count = 0 _replacement = [] for name in self.groups[key]: _candidate = next( @@ -298,8 +303,16 @@ def init_and_validate(self, update=False): _replacement.append(_candidate) if self.operators[name].workaholic: continue + if self.operators[name].resting_priority == "high": + high_count += 1 + else: + low_count += 1 + if ( + high_count > current_high or low_count > current_low + ) and not config.conf.flexible_shift_mode: + return f"{key} 分组无法排班,宿舍可用高优先{current_high},低优先{current_low}->分组需要高优先{high_count},低优先{low_count}" total_count += 1 - if total_count > len(self.dorm): + if total_count > len(self.dorm) and config.conf.flexible_shift_mode: return f"{key} 分组无法排班,分组总数(不包含0心情工作){total_count}大于总宿舍数{len(self.dorm)}" # 设定令夕模式的心情阈值 self.init_mood_limit() @@ -826,7 +839,7 @@ def predict_exhaust(self): remaining_mood = self.mood - self.lower_limit # 剩余心情 depletion_rate = self.depletion_rate # 心情掉率,小时单位 # 计算到心情归零所需时间(小时),再加上当前时间戳 - if depletion_rate > 0: + if self.time_stamp and depletion_rate > 0: return self.time_stamp + timedelta( hours=((remaining_mood / depletion_rate) - 0.5) ) diff --git a/arknights_mower/utils/scheduler_task.py b/arknights_mower/utils/scheduler_task.py index 600842e0..2aba5cdd 100644 --- a/arknights_mower/utils/scheduler_task.py +++ b/arknights_mower/utils/scheduler_task.py @@ -177,6 +177,7 @@ def generate_plan_by_drom(tasks, op_data): result = [] planned = set() for time, (dorms, rest_in_full) in ordered: + logger.debug(f"{time},{dorms},{rest_in_full}") plan = {} for room in dorms: if room.name in planned: @@ -239,6 +240,7 @@ def generate_plan_by_drom(tasks, op_data): else TaskTypes.SHIFT_ON, ) ) + logger.debug("生成任务: " + ("||".join([str(t) for t in result]))) return result