discrete_optimization.rcalbp_l package

Subpackages

Submodules

discrete_optimization.rcalbp_l.parser module

discrete_optimization.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.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.rcalbp_l.problem module

class discrete_optimization.rcalbp_l.problem.RCALBPLProblem(c_target: int, c_max: int, nb_stations: int, nb_periods: int, nb_tasks: int, precedences: List[Tuple[Tuple[int, int], 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_duration(task: int, p: int, w: int) int[source]
get_makespan_upper_bound() int[source]

Get a upper bound on global makespan.

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.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_start_time(task: Tuple[int, int]) int[source]
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:

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.rcalbp_l.problem.RCALBPLVectorSolution(problem: RCALBPLProblem, allocation_task: list[int], permutation_task: list[int], resource: list[int])[source]

Bases: RCALBPLSolution

discrete_optimization.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