discrete_optimization.lotsizing.capacitatedsetuptimes package

Subpackages

Submodules

discrete_optimization.lotsizing.capacitatedsetuptimes.parser module

Instance generator for capacitated lot sizing with setup times problems.

discrete_optimization.lotsizing.capacitatedsetuptimes.parser.create_simple_instance(nb_items: int = 3, horizon: int = 6, capacity: float = 10.0, setup_time: float = 2.0, allow_delays: bool = True, seed: int = 0) CapacitatedSetupTimesLSP[source]

Create a simple test instance with setup times.

Parameters:
  • nb_items – Number of items

  • horizon – Number of periods

  • capacity – Production capacity per period

  • setup_time – Fixed setup time for all items/periods

  • allow_delays – Whether backlog/delays are allowed (default: True for feasibility)

Returns:

CapacitatedSetupTimesLSP instance

discrete_optimization.lotsizing.capacitatedsetuptimes.problem module

Capacitated lot sizing problem with setup times.

This problem adds setup times to the CLSP formulation (page 11, slides_313.pdf): - Setup time τ_it is consumed when production setup occurs - Capacity constraint: Σ_i (p_it·X_it + τ_it·Y_it) ≤ h_t

class discrete_optimization.lotsizing.capacitatedsetuptimes.problem.CapacitatedSetupTimesLSP(nb_items: int, horizon: int, demands: ndarray[tuple[Any, ...], dtype[int64]] | list[list[int]], capacity_machine: int | float, setup_times: ndarray[tuple[Any, ...], dtype[float64]] | list[list[float]], stock_cost_per_type: ndarray[tuple[Any, ...], dtype[float64]] | list[float], stock_capacity: int | None = None, allow_delays: bool = False, delay_cost_per_type: ndarray[tuple[Any, ...], dtype[float64]] | list[float] | None = None, **kwargs: Any)[source]

Bases: WithoutSetupCostsProblem[int], WithoutProductionCostsProblem[int], WithoutChangeoverCostsProblem[int], WithoutStockLimitsProblem[int], WithParallelProductionProblem[int], GenericLotSizingProblem[int]

Capacitated lot sizing problem with setup times.

Based on CLSP with setup times formulation (page 11, slides_313.pdf): - New parameter: τ_it = Fixed setup time for item i in period t - Modified capacity constraint: Σ_i (p_it·X_it + τ_it·Y_it) ≤ h_t

Features: - Multiple item types - Production capacity per period - Setup times consuming capacity - Changeover costs when switching items - Inventory holding costs - Optional backlog/delays - No setup costs or production costs

property allow_backlog: bool

Whether backlog/delays are allowed.

allows_lost_demand() bool[source]
allows_parallel_production() bool[source]

Parallel production is allowed.

property capacity_machine: float

Production capacity per period.

get_attribute_register() EncodingRegister[source]

Return encoding register for metaheuristic solvers.

get_available_production_time(period: int) float[source]

Get available production time in period.

get_backlog_cost_per_unit(item: int, period: int) float[source]

Get backlog penalty cost per unit.

get_demand(item: int, period: int) int[source]

Get demand for item in period.

get_inventory_cost_per_unit(item: int, period: int) float[source]

Get inventory holding cost per unit.

get_objective_register() ObjectiveRegister[source]

Return objective register.

get_production_time_per_unit(item: int, period: int) float[source]

Get production time per unit (always 1 for this problem).

get_setup_time(item: int, period: int) float[source]

Get setup time τ_it for item in period.

get_solution_type() type[Solution][source]

Return the solution class for this problem.

get_stock_limit_for_item(item: Item, period: int) int | float[source]

Infinite stock limit - no constraint.

property horizon: int

Number of time periods.

is_backlog_allowed() bool[source]

Check if backlog/delays are allowed as hard constraint.

property items_list: list[int]

List of item indices.

satisfy(solution: CapacitatedSetupTimesSolution) bool[source]

Check if solution satisfies all constraints.

Uses satisfy_partial from GenericLotSizingProblem to check: - Demand satisfaction - Capacity constraints (including setup times) - Stock capacity - Unique production times

Parameters:

solution – Solution to check

Returns:

True if all constraints are satisfied

class discrete_optimization.lotsizing.capacitatedsetuptimes.problem.CapacitatedSetupTimesSolution(problem: LotSizingProblem[Item], productions: list[ProductionDecision], deliveries: list[DeliveryDecision] | None = None)[source]

Bases: WithoutSetupCostsSolution[int], WithoutProductionCostsSolution[int], WithoutChangeoverCostsSolution[int], WithoutStockLimitsSolution[int], WithParallelProductionSolution[int], ProductionBasedSolution[int]

Solution for capacitated lot sizing with setup times.

Inherits from: - ProductionBasedSolution: Auto-computes inventory, deliveries, backlog

  • Via GenericLotSizingSolution: Already includes SetupTimesSolution!

  • WithoutSetupCostsSolution: No setup costs

  • WithoutProductionCostsSolution: No per-unit production costs

Features: - Setup times consuming capacity (automatic via SetupTimesSolution mixin!) - Changeover costs - Inventory costs - Backlog/delays (configurable)

Note: SetupTimesSolution.get_total_production_time_used() is inherited automatically through ProductionBasedSolution -> GenericLotSizingSolution -> SetupTimesSolution. No need to override - the mixin does it for us!

problem: CapacitatedSetupTimesLSP

Module contents

Capacitated lot sizing problem with setup times.

CLSP with setup times (from page 11 of slides_313.pdf): - Setup times τ_it consume capacity when production occurs - Capacity constraint: Σ_i (p_it·X_it + τ_it·Y_it) ≤ h_t

class discrete_optimization.lotsizing.capacitatedsetuptimes.CapacitatedSetupTimesLSP(nb_items: int, horizon: int, demands: ndarray[tuple[Any, ...], dtype[int64]] | list[list[int]], capacity_machine: int | float, setup_times: ndarray[tuple[Any, ...], dtype[float64]] | list[list[float]], stock_cost_per_type: ndarray[tuple[Any, ...], dtype[float64]] | list[float], stock_capacity: int | None = None, allow_delays: bool = False, delay_cost_per_type: ndarray[tuple[Any, ...], dtype[float64]] | list[float] | None = None, **kwargs: Any)[source]

Bases: WithoutSetupCostsProblem[int], WithoutProductionCostsProblem[int], WithoutChangeoverCostsProblem[int], WithoutStockLimitsProblem[int], WithParallelProductionProblem[int], GenericLotSizingProblem[int]

Capacitated lot sizing problem with setup times.

Based on CLSP with setup times formulation (page 11, slides_313.pdf): - New parameter: τ_it = Fixed setup time for item i in period t - Modified capacity constraint: Σ_i (p_it·X_it + τ_it·Y_it) ≤ h_t

Features: - Multiple item types - Production capacity per period - Setup times consuming capacity - Changeover costs when switching items - Inventory holding costs - Optional backlog/delays - No setup costs or production costs

property allow_backlog: bool

Whether backlog/delays are allowed.

allows_lost_demand() bool[source]
allows_parallel_production() bool[source]

Parallel production is allowed.

property capacity_machine: float

Production capacity per period.

get_attribute_register() EncodingRegister[source]

Return encoding register for metaheuristic solvers.

get_available_production_time(period: int) float[source]

Get available production time in period.

get_backlog_cost_per_unit(item: int, period: int) float[source]

Get backlog penalty cost per unit.

get_demand(item: int, period: int) int[source]

Get demand for item in period.

get_inventory_cost_per_unit(item: int, period: int) float[source]

Get inventory holding cost per unit.

get_objective_register() ObjectiveRegister[source]

Return objective register.

get_production_time_per_unit(item: int, period: int) float[source]

Get production time per unit (always 1 for this problem).

get_setup_time(item: int, period: int) float[source]

Get setup time τ_it for item in period.

get_solution_type() type[Solution][source]

Return the solution class for this problem.

get_stock_limit_for_item(item: Item, period: int) int | float[source]

Infinite stock limit - no constraint.

property horizon: int

Number of time periods.

is_backlog_allowed() bool[source]

Check if backlog/delays are allowed as hard constraint.

property items_list: list[int]

List of item indices.

satisfy(solution: CapacitatedSetupTimesSolution) bool[source]

Check if solution satisfies all constraints.

Uses satisfy_partial from GenericLotSizingProblem to check: - Demand satisfaction - Capacity constraints (including setup times) - Stock capacity - Unique production times

Parameters:

solution – Solution to check

Returns:

True if all constraints are satisfied

class discrete_optimization.lotsizing.capacitatedsetuptimes.CapacitatedSetupTimesSolution(problem: LotSizingProblem[Item], productions: list[ProductionDecision], deliveries: list[DeliveryDecision] | None = None)[source]

Bases: WithoutSetupCostsSolution[int], WithoutProductionCostsSolution[int], WithoutChangeoverCostsSolution[int], WithoutStockLimitsSolution[int], WithParallelProductionSolution[int], ProductionBasedSolution[int]

Solution for capacitated lot sizing with setup times.

Inherits from: - ProductionBasedSolution: Auto-computes inventory, deliveries, backlog

  • Via GenericLotSizingSolution: Already includes SetupTimesSolution!

  • WithoutSetupCostsSolution: No setup costs

  • WithoutProductionCostsSolution: No per-unit production costs

Features: - Setup times consuming capacity (automatic via SetupTimesSolution mixin!) - Changeover costs - Inventory costs - Backlog/delays (configurable)

Note: SetupTimesSolution.get_total_production_time_used() is inherited automatically through ProductionBasedSolution -> GenericLotSizingSolution -> SetupTimesSolution. No need to override - the mixin does it for us!

problem: CapacitatedSetupTimesLSP