discrete_optimization.alb.rcalbp.solvers package

Submodules

discrete_optimization.alb.rcalbp.solvers.cpsat module

CP-SAT Solvers for RC-ALBP with Shared Resources

This module shows how each modeling approach handles shared resources: - FOLDED: Works naturally ✓ - CALENDAR: Works naturally ✓

class discrete_optimization.alb.rcalbp.solvers.cpsat.CpSatRcAlbpSolver(problem: RCALBPProblem)[source]

Bases: AllocationCpSatSolver[Hashable, UnaryResource]

CP-SAT Solver for RC-ALBP with shared resources. Implements FOLDED and CALENDAR approaches.

create_allocation()[source]
get_resource_consumption_intervals(resource: Hashable) list[tuple[IntervalVar, int]][source]
get_task_start_or_end_variable(task: Hashable, start_or_end: StartOrEnd) LinearExpr | IntVar | int | int8 | uint8 | int32 | uint32 | int64 | uint64[source]
get_task_unary_resource_is_present_variable(task: Hashable, unary_resource: UnaryResource) LinearExpr | IntVar | int | int8 | uint8 | int32 | uint32 | int64 | uint64[source]

Return a 0-1 variable/expression telling if the unary_resource is used for the task.

NB: sometimes the given resource is never to be used by a task and the variable has not been created. The convention is to return 0 in that case.

hyperparameters: list[Hyperparameter] = [EnumHyperparameter(name='modeling', default=<ModelingShared.FOLDED: 0>, depends_on=None, name_in_kwargs='modeling')]

Hyperparameters available for this solver.

These hyperparameters are to be feed to **kwargs found in
  • __init__()

  • init_model() (when available)

  • solve()

init_model(**kwargs: Any) None[source]

Init cp model and reset stored variables if any.

init_model_calendar(**kwargs)[source]

CALENDAR model - optimized based on shared resource presence.

Two paths: 1. NO shared resources: Simple calendar model with absolute time 2. WITH shared resources: Complex model with cycle-time decomposition

Key insight for shared resources: We need TWO sets of intervals: 1. Absolute time intervals [start, end) for NoOverlap and station assignment 2. Cycle time intervals [cycle_start, cycle_end) for shared resources

Where: cycle_start = start % cycle_time

init_model_folded(**kwargs)[source]

FOLDED model with shared resources.

problem: RCALBPProblem
retrieve_solution(cpsolvercb: CpSolverSolutionCallback) RCALBPSolution[source]

Extract solution from solver.

class discrete_optimization.alb.rcalbp.solvers.cpsat.ModelingShared(*values)[source]

Bases: Enum

CALENDAR = 1
FOLDED = 0

Module contents