labscheduler.solvers.cp_solver module¶
A solver implementation using google OR-tools to model and solve the JSSP as a constraint program(CP)
- class labscheduler.solvers.cp_solver.CPSolver[source]¶
Bases:
JSSPSolver- _abc_impl = <_abc._abc_data object>¶
- static add_group_constraints(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
Not strictly necessary in the sense of the JSSP definition. We define a group of operations as an operation together with all its directly preceding options which must be more than one. The constraints added in this function enforce all operations of a group to be started before another one can be started.
- static add_load_while_processing_constraints(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
- static add_precedence_constraints(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
- static add_processing_capacity_constraints(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
- static add_soft_waiting_constraints(cp: CpModel, vars_: CPVariables)[source]¶
- static add_spacial_capacity_constraints(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
- static apply_heuristics(cp: CpModel, solver: CpSolver, vars_: CPVariables) dict[str, ScheduledAssignment] | None[source]¶
- backup_sol: dict[str, ScheduledAssignment] | None¶
- compute_schedule(inst: JSSP, time_limit: float, offset: float, **kwargs) tuple[dict[str, ScheduledAssignment] | None, SolutionQuality][source]¶
Tries to compute a schedule for the given JSSP instance. Depending on the algorithm there might be no guaranty a solution is found. :param inst: The Problem instance :param time_limit: Maximum computation time(in seconds) the solver is allowed :param offset: Minimum time(in seconds) between call of the function and start time scheduled for any operation :param kwargs: Optional arguments custom to a solver :return: A valid schedule or None
- static create_interval_var(lb: int, ub: int, o: Operation, cp: CpModel, ref_time: datetime, optionality: IntVar | None = None) IntervalVar[source]¶
Utility method to create and add a new interval variable to the model. Returns the created variable.
- static create_model(inst: JSSP, offset: float) tuple[CpModel, CPVariables][source]¶
- static create_variables(cp: CpModel, inst: JSSP, offset: int) CPVariables[source]¶
- static extract_schedule(solver: CpSolver, vars_: CPVariables, inst: JSSP) dict[str, ScheduledAssignment][source]¶
- static get_algorithm_info() AlgorithmInfo[source]¶
Every algorithm should provide this basic information about itself :return: A typing.NamedTuple containing name, optimality, success guaranty and recommended maximum problem size
- static handle_pooling(cp: CpModel, vars_: CPVariables, operations: list[Operation], inst: JSSP)[source]¶
Creates the part of the model which assigns executing machines to operations which can be executed by different machines.
- static set_objective(cp: CpModel, vars_: CPVariables, inst: JSSP)[source]¶
- static solve_cp(cp: CpModel, vars_: CPVariables, time_limit: float) tuple[~ortools.sat.python.cp_model.CpSolver, <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7bd8bf759e80>][source]¶