labscheduler.scheduler_implementation module

class labscheduler.scheduler_implementation.Scheduler(algorithm: str = 'CP-Solver', labconfig_path: Path | str | None = None)[source]

Bases: SchedulerInterface

_abc_impl = <_abc._abc_data object>
_enforce_min_capacities(operations: list[Operation], schedule: dict[str, ScheduledAssignment])[source]

Searches for movements, that are necessary for certain operations due to minimum capacities. Adds machine precedence constraints between those :param schedule: :return:

_enforce_precedences(schedule: dict[str, ScheduledAssignment])[source]

Adds machine precedences between steps that definitively need to be executed without overlapping. This is already implicitly given by the schedule, but adding it explicitly might help executing the schedule. :param schedule: :return:

_load_solvers_from_module(module: ModuleType)[source]

Loads potential solver classes from a given module and registers them in the available solvers dictionary.

property available_algorithms: list[AlgorithmInfo]

Lists the basic information of each available algorithm :return:

available_solvers_by_name: dict[str, type[JSSPSolver]]
compute_schedule(operations: Iterable[Operation], computation_time: float) tuple[dict[str, ScheduledAssignment] | None, SolutionQuality][source]

Uses the currently selected algorithm to compute a schedule for the given workflow in the currently configured lab. This workflow must be given as a list of Operations. :param operations: List of operations :param computation_time: The maximum computation time. No scheduled start will be earlier than now + this parameter :return: An assignment of machines, precedence constraints and start time to each operation or None if no valid schedule was found. Additionally, an enum whether the schedule is optimal, feasible or infeasible. Sometimes even infeasible, but almost feasible solution is better than nothing.

configure_job_shop(machine_list: list[Machine])[source]

Sets the set of available machines to schedule workflows on. This will be kept until this method is called again :param machine_list: List of machines making up the job-shop :return:

property current_algorithm_info: AlgorithmInfo

Retrieves the basic information of the currently selected algorithm. :return: A typing.NamedTuple containing name, optimality, success guaranty and recommended maximum problem size

inject_solvers()[source]

Searches for classes implementing the JSSPSolver interface in all modules in the solvers/ directory. Any matching Class is added as a solver and made available.

jssp_solver: JSSPSolver
select_algorithm(algorithm_name: str) bool[source]

Changes the current algorithm of the solver. The names of all available algorithms can be requested via the available_algorithms attribute. :param algorithm_name: Name of the chosen algorithm. :return: Returns whether there is an algorithm with the given name

static_load_solvers()[source]