discrete_optimization.alb.rcalbp_l package
Subpackages
- discrete_optimization.alb.rcalbp_l.solvers package
- Submodules
- discrete_optimization.alb.rcalbp_l.solvers.cpsat module
CpSatRCALBPLSolverCpSatRCALBPLSolver.add_cycle_time_lower_bound()CpSatRCALBPLSolver.constraint_only_one_station_allocation()CpSatRCALBPLSolver.create_cumulative_resource_constraint()CpSatRCALBPLSolver.create_cycle_time_variables()CpSatRCALBPLSolver.create_heuristic_target_reached_constraints()CpSatRCALBPLSolver.create_main_unfolded_intervals()CpSatRCALBPLSolver.create_precedence_constraints()CpSatRCALBPLSolver.create_resource_dispatch()CpSatRCALBPLSolver.create_zone_blocking()CpSatRCALBPLSolver.fix_allocations()CpSatRCALBPLSolver.fix_allocations_and_resources()CpSatRCALBPLSolver.get_task_start_or_end_variable()CpSatRCALBPLSolver.get_task_unary_resource_is_present_variable()CpSatRCALBPLSolver.init_model()CpSatRCALBPLSolver.objective_value()CpSatRCALBPLSolver.problemCpSatRCALBPLSolver.retrieve_solution()CpSatRCALBPLSolver.set_warm_start()CpSatRCALBPLSolver.subset_tasks_of_interestCpSatRCALBPLSolver.variables
- discrete_optimization.alb.rcalbp_l.solvers.meta_solvers module
- discrete_optimization.alb.rcalbp_l.solvers.optal module
OptalRCALBPLSolverOptalRCALBPLSolver.constraint_only_one_station_allocation()OptalRCALBPLSolver.create_cumulative_resource_constraint()OptalRCALBPLSolver.create_cycle_time_variables()OptalRCALBPLSolver.create_heuristic_target_reached_constraints()OptalRCALBPLSolver.create_main_unfolded_intervals()OptalRCALBPLSolver.create_precedence_constraints()OptalRCALBPLSolver.create_resource_dispatch()OptalRCALBPLSolver.create_zone_blocking()OptalRCALBPLSolver.get_task_interval_variable()OptalRCALBPLSolver.get_task_unary_resource_is_present_variable()OptalRCALBPLSolver.init_model()OptalRCALBPLSolver.objective_value()OptalRCALBPLSolver.problemOptalRCALBPLSolver.retrieve_solution()OptalRCALBPLSolver.variables
OptalRCALBPLSolverV2OptalRCALBPLSolverV2.create_cumulative_resource_constraint()OptalRCALBPLSolverV2.create_cycle_time_variables()OptalRCALBPLSolverV2.create_heuristic_target_reached_constraints()OptalRCALBPLSolverV2.create_main_unfolded_intervals()OptalRCALBPLSolverV2.create_precedence_constraints()OptalRCALBPLSolverV2.create_resource_dispatch()OptalRCALBPLSolverV2.create_zone_blocking()OptalRCALBPLSolverV2.get_task_interval_variable()OptalRCALBPLSolverV2.get_task_unary_resource_is_present_variable()OptalRCALBPLSolverV2.init_model()OptalRCALBPLSolverV2.objective_value()OptalRCALBPLSolverV2.problemOptalRCALBPLSolverV2.retrieve_solution()OptalRCALBPLSolverV2.variables
- discrete_optimization.alb.rcalbp_l.solvers.pareto_postprocess module
DpRCALBPLPostProSolverRampUpParetoSolverPostproRampUpParetoSolverPostpro.add_lexico_constraint()RampUpParetoSolverPostpro.get_lexico_objective_value()RampUpParetoSolverPostpro.get_lexico_objectives_available()RampUpParetoSolverPostpro.implements_lexico_api()RampUpParetoSolverPostpro.init_model()RampUpParetoSolverPostpro.problemRampUpParetoSolverPostpro.retrieve_solution()RampUpParetoSolverPostpro.set_lexico_objective()RampUpParetoSolverPostpro.solution
- Module contents
BackwardSequentialRCALBPLSolverBackwardSequentialRCALBPLSolverSGSBalancedBackwardSequentialRCALBPLSolverCpSatRCALBPLSolverCpSatRCALBPLSolver.add_cycle_time_lower_bound()CpSatRCALBPLSolver.constraint_only_one_station_allocation()CpSatRCALBPLSolver.create_cumulative_resource_constraint()CpSatRCALBPLSolver.create_cycle_time_variables()CpSatRCALBPLSolver.create_heuristic_target_reached_constraints()CpSatRCALBPLSolver.create_main_unfolded_intervals()CpSatRCALBPLSolver.create_precedence_constraints()CpSatRCALBPLSolver.create_resource_dispatch()CpSatRCALBPLSolver.create_zone_blocking()CpSatRCALBPLSolver.fix_allocations()CpSatRCALBPLSolver.fix_allocations_and_resources()CpSatRCALBPLSolver.get_task_start_or_end_variable()CpSatRCALBPLSolver.get_task_unary_resource_is_present_variable()CpSatRCALBPLSolver.init_model()CpSatRCALBPLSolver.objective_value()CpSatRCALBPLSolver.problemCpSatRCALBPLSolver.retrieve_solution()CpSatRCALBPLSolver.set_warm_start()CpSatRCALBPLSolver.subset_tasks_of_interestCpSatRCALBPLSolver.variables
OptalRCALBPLSolverOptalRCALBPLSolver.constraint_only_one_station_allocation()OptalRCALBPLSolver.create_cumulative_resource_constraint()OptalRCALBPLSolver.create_cycle_time_variables()OptalRCALBPLSolver.create_heuristic_target_reached_constraints()OptalRCALBPLSolver.create_main_unfolded_intervals()OptalRCALBPLSolver.create_precedence_constraints()OptalRCALBPLSolver.create_resource_dispatch()OptalRCALBPLSolver.create_zone_blocking()OptalRCALBPLSolver.get_task_interval_variable()OptalRCALBPLSolver.get_task_unary_resource_is_present_variable()OptalRCALBPLSolver.init_model()OptalRCALBPLSolver.objective_value()OptalRCALBPLSolver.problemOptalRCALBPLSolver.retrieve_solution()OptalRCALBPLSolver.variables
OptalRCALBPLSolverV2OptalRCALBPLSolverV2.create_cumulative_resource_constraint()OptalRCALBPLSolverV2.create_cycle_time_variables()OptalRCALBPLSolverV2.create_heuristic_target_reached_constraints()OptalRCALBPLSolverV2.create_main_unfolded_intervals()OptalRCALBPLSolverV2.create_precedence_constraints()OptalRCALBPLSolverV2.create_resource_dispatch()OptalRCALBPLSolverV2.create_zone_blocking()OptalRCALBPLSolverV2.get_task_interval_variable()OptalRCALBPLSolverV2.get_task_unary_resource_is_present_variable()OptalRCALBPLSolverV2.init_model()OptalRCALBPLSolverV2.objective_value()OptalRCALBPLSolverV2.problemOptalRCALBPLSolverV2.retrieve_solution()OptalRCALBPLSolverV2.variables
Submodules
discrete_optimization.alb.rcalbp_l.parser module
- discrete_optimization.alb.rcalbp_l.parser.get_data_available(data_folder: str | None = None, data_home: str | None = None) list[str][source]
Get datasets available for rcpsp.
- Params:
- data_folder: folder where datasets for rcpsp whould be find.
If None, we look in “rcpsp” subdirectory of data_home.
- data_home: root directory for all datasets. Is None, set by
default to “~/discrete_optimization_data “
- discrete_optimization.alb.rcalbp_l.parser.parse_rcalbpl_json(file_path: str) RCALBPLProblem[source]
Parses the RC-ALBP/L JSON data and constructs the Problem instance.
discrete_optimization.alb.rcalbp_l.problem module
- class discrete_optimization.alb.rcalbp_l.problem.RCALBPLProblem(c_target: int, c_max: int, nb_stations: int, nb_periods: int, nb_tasks: int, precedences: List[Tuple[int, int]], durations: List[List[int]], nb_resources: int, capa_resources: List[int], cons_resources: List[List[int]], nb_zones: int, capa_zones: List[int], cons_zones: List[List[int]], neutr_zones: List[List[int]], p_start: int = 0, p_end: int | None = None)[source]
Bases:
SchedulingProblem[Tuple[int,int]],AllocationProblem[Tuple[int,int],int]Problem definition for Resource-Constrained Assembly Line Balancing with Learning Effect (RC-ALBP/L).
- build_full_solution(wks: Dict[int, int], raw: Dict[Tuple[int, int], int], target_starts: Dict[int, int])[source]
- build_sgs_schedule_for_period(wks: Dict[int, int], raw: Dict[Tuple[int, int], int], target_starts: Dict[int, int], period: int) Tuple[Dict[int, int], int][source]
Highly Optimized Serial Generation Scheme (SGS). Uses 1D timeline arrays and slice mathematics to evaluate capacities in a fraction of a millisecond per task.
- build_sgs_schedule_for_period_slow(wks: Dict[int, int], raw: Dict[Tuple[int, int], int], target_starts: Dict[int, int], period: int) Tuple[Dict[int, int], int][source]
Robust Serial Generation Scheme (SGS) to compute a feasible schedule. Uses a dynamic eligible set to strictly guarantee Precedence constraints, and uses ‘target_starts’ (from an optimal future period) to guide the packing.
- compute_actual_cycle_time_per_period(solution: RCALBPLSolution) dict[int, int][source]
- evaluate(variable: RCALBPLSolution) Dict[str, float][source]
Evaluate a given solution object for the given problem.
This method should return a dictionnary of KPI, that can be then used for mono or multiobjective optimization.
- Parameters:
variable (Solution) – the Solution object to evaluate.
Returns: dictionnary of float kpi for the solution.
- get_dummy_solution() RCALBPLSolution[source]
Creates a trivial dummy solution (likely invalid). Assigns all tasks sequentially to the first workstation.
- get_objective_register() ObjectiveRegister[source]
Returns the objective definition.
Returns (ObjectiveRegister): object defining the objective criteria.
- get_solution_type() type[Solution][source]
Returns the class implementation of a Solution.
Returns (class): class object of the given Problem.
- satisfy(variable: RCALBPLSolution) bool[source]
Computes if a solution satisfies or not the constraints of the problem.
- Parameters:
variable – the Solution object to check satisfability
Returns (bool): boolean true if the constraints are fulfilled, false elsewhere.
- property tasks_list: list[Tuple[int, 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.alb.rcalbp_l.problem.RCALBPLSolution(problem: RCALBPLProblem, wks: Dict[int, int], raw: Dict[Tuple[int, int], int], start: Dict[Tuple[int, int], int], cyc: Dict[int, int], ramp_up_duration: float | None = None, nb_adjustments: int | None = None)[source]
Bases:
AllocationSolution[Tuple[int,int],int],SchedulingSolution[Tuple[int,int]]Solution representation for the RC-ALBP/L problem.
- change_problem(new_problem: Problem) None[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() RCALBPLSolution[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.
- get_end_time(task: Tuple[int, int]) int[source]
Get end time of the task
- Hypothesis:
The returned time can have AbsentValue.ABSENT only if self.is_present(task) is False.
- Parameters:
task
Returns:
- get_start_time(task: Tuple[int, int]) int[source]
Get start time of the task
- Hypothesis:
The returned time can have AbsentValue.ABSENT only if self.is_present(task) is False.
- Parameters:
task
Returns:
- is_allocated(task: Tuple[int, int], unary_resource: int) bool[source]
Return the usage of the unary resource for the given task.
- Parameters:
task
unary_resource
Returns:
- is_present(task: Tuple[int, int]) bool[source]
Tell whether the task is present in the solution.
For allocation problem, default to “at least one unary resource has been allocated to the task”. To be overriden in child classes for problem having tasks present without allocation.
- lazy_copy() RCALBPLSolution[source]
This function should return a new object but possibly with mutable attributes from the original objects.
A typical use of lazy copy is in evolutionary algorithms or genetic algorithm where the use of local move don’t need to do a possibly costly deepcopy.
Returns (Solution): copy (possibly shallow) of the Solution
- problem: RCALBPLProblem
- class discrete_optimization.alb.rcalbp_l.problem.RCALBPLVectorSolution(problem: RCALBPLProblem, allocation_task: list[int], permutation_task: list[int], resource: list[int])[source]
Bases:
RCALBPLSolution
- discrete_optimization.alb.rcalbp_l.problem.plot_rcalbpl_dashboard(problem: RCALBPLProblem, solution: RCALBPLSolution)[source]
Creates an interactive matplotlib dashboard to visualize RC-ALBP/L solutions. - Top plot: Gantt chart of the assembly line for a selected period. - Bottom plot: Evolution of the Cycle Times (Target, Chosen, Real) across all periods.
Module contents
- discrete_optimization.alb.rcalbp_l.get_data_available(data_folder: str | None = None, data_home: str | None = None) list[str][source]
Get datasets available for rcpsp.
- Params:
- data_folder: folder where datasets for rcpsp whould be find.
If None, we look in “rcpsp” subdirectory of data_home.
- data_home: root directory for all datasets. Is None, set by
default to “~/discrete_optimization_data “
- discrete_optimization.alb.rcalbp_l.parse_rcalbpl_json(file_path: str) RCALBPLProblem[source]
Parses the RC-ALBP/L JSON data and constructs the Problem instance.