discrete_optimization.salbp package
Subpackages
- discrete_optimization.salbp.solvers package
- Submodules
- discrete_optimization.salbp.solvers.asp module
- discrete_optimization.salbp.solvers.cpsat module
CpSatSalbp12SolverCpSatSalbp12Solver.get_task_start_or_end_variable()CpSatSalbp12Solver.get_task_unary_resource_is_present_variable()CpSatSalbp12Solver.hyperparametersCpSatSalbp12Solver.init_model()CpSatSalbp12Solver.init_model_binary()CpSatSalbp12Solver.init_model_scheduling()CpSatSalbp12Solver.problemCpSatSalbp12Solver.retrieve_solution()CpSatSalbp12Solver.set_warm_start()
CpSatSalbpSolverCpSatSalbpSolver.get_task_start_or_end_variable()CpSatSalbpSolver.get_task_unary_resource_is_present_variable()CpSatSalbpSolver.hyperparametersCpSatSalbpSolver.init_model()CpSatSalbpSolver.init_model_binary()CpSatSalbpSolver.init_model_scheduling()CpSatSalbpSolver.modelingCpSatSalbpSolver.problemCpSatSalbpSolver.retrieve_solution()CpSatSalbpSolver.set_warm_start()
ModelingCpsatSalbp
- discrete_optimization.salbp.solvers.dp module
- discrete_optimization.salbp.solvers.greedy module
- discrete_optimization.salbp.solvers.optal module
OptalSalbp12SolverOptalSalbp12Solver.add_lexico_constraint()OptalSalbp12Solver.get_lexico_objective_value()OptalSalbp12Solver.get_lexico_objectives_available()OptalSalbp12Solver.get_task_interval_variable()OptalSalbp12Solver.implements_lexico_api()OptalSalbp12Solver.init_model()OptalSalbp12Solver.init_model_scheduling()OptalSalbp12Solver.problemOptalSalbp12Solver.retrieve_solution()OptalSalbp12Solver.set_lexico_objective()OptalSalbp12Solver.set_warm_start()
OptalSalbpSolver
- Module contents
Submodules
discrete_optimization.salbp.parser module
- discrete_optimization.salbp.parser.get_data_available(data_folder: str | None = None, data_home: str | None = None) list[str][source]
Get datasets available for tsp.
- Params:
- data_folder: folder where datasets for weighted tardiness problem should be found.
If None, we look in “wt” subdirectory of data_home.
- data_home: root directory for all datasets. Is None, set by
default to “~/discrete_optimization_data “
- discrete_optimization.salbp.parser.parse_alb_file(file_path: str) SalbpProblem[source]
Parses a .alb file using string splitting and tokenization. No Regular Expressions used.
discrete_optimization.salbp.problem module
- class discrete_optimization.salbp.problem.SalbpProblem(number_of_tasks: int, cycle_time: int, task_times: Dict[int, int], precedence: List[Tuple[int, int]])[source]
Bases:
SchedulingProblem[int],AllocationProblem[int,int]- evaluate(variable: SalbpSolution) Dict[str, float][source]
Evaluate the solution. Objective: Minimize the number of stations. Constraint Penalties: Over-cycle time, Precedence violations.
- get_attribute_register() EncodingRegister[source]
Register for standard encoding (optional, but good for GA/CP solvers). We define the solution as a list of integers (station assignments).
- get_last_tasks() list[int][source]
Get a sublist of tasks that are candidate to be the last one scheduled.
Default to all tasks.
- get_objective_register() ObjectiveRegister[source]
Defines the default objective to minimize.
- get_solution_type() type[Solution][source]
Returns the class implementation of a Solution.
Returns (class): class object of the given Problem.
- get_solution_type_member() SalbpSolution[source]
- satisfy(variable: SalbpSolution) bool[source]
Strict check for validity.
- property tasks_list: list[int]
List of all tasks to schedule or allocate to.
- property unary_resources_list: list[UnaryResource]
Available unary resources.
It can correspond to employees (rcpsp-multiskill), teams (workforce-scheduling), or a mix of several types.
- class discrete_optimization.salbp.problem.SalbpProblem_1_2(number_of_tasks: int, task_times: Dict[int, int], precedence: List[Tuple[int, int]])[source]
Bases:
SalbpProblem- evaluate(variable: SalbpSolution) Dict[str, float][source]
Evaluate the solution. Objective: Minimize the number of stations and cycle time
- static from_salbp1(problem: SalbpProblem)[source]
- get_objective_register() ObjectiveRegister[source]
Defines the default objective to minimize.
- satisfy(variable: SalbpSolution) bool[source]
Strict check for validity.
- class discrete_optimization.salbp.problem.SalbpSolution(problem: SalbpProblem, allocation_to_station: list[int])[source]
Bases:
SchedulingSolution[int],AllocationSolution[int,int]- change_problem(new_problem: Problem) Solution[source]
If relevant to the optimisation problem, change the underlying problem instance for the solution.
This method can be used to evaluate a solution for different instance of problems. It should be implemented in child classes when caching subresults depending on the problem.
- Parameters:
new_problem (Problem) – another problem instance from which the solution can be evaluated
Returns: None
- copy() SalbpSolution[source]
Deep copy of the solution.
The copy() function should return a new object containing the same input as the current object, that respects the following expected behaviour: -y = x.copy() -if do some inplace change of y, the changes are not done in x.
Returns: a new object from which you can manipulate attributes without changing the original object.
- is_allocated(task: int, unary_resource: UnaryResource) bool[source]
Return the usage of the unary resource for the given task.
- Parameters:
task
unary_resource
Returns:
- problem: SalbpProblem
- discrete_optimization.salbp.problem.calculate_salbp_lower_bounds(problem: SalbpProblem) int[source]
Calculates lower bounds for the SALBP-1 problem. Inspired by: https://github.com/domain-independent-dp/didp-rs