discrete_optimization.shop package

Subpackages

Submodules

discrete_optimization.shop.base module

class discrete_optimization.shop.base.AnyShopSolution(problem: CommonShopProblem, schedule: list[list[tuple[int | AbsentValue.ABSENT, int | AbsentValue.ABSENT]]], machine_index: list[list[int | AbsentValue.ABSENT]] = None, recipe_index: list[list[int | AbsentValue.ABSENT]] = None)[source]

Bases: GenericSchedulingSolution[tuple[int, int], None, None, int, None], WithoutSkillSolution[tuple[int, int], None, int, None], WithoutNonRenewableResourceSolution[tuple[int, int]], WithoutAllocationSolution[tuple[int, int]]

copy() → AnyShopSolution[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 | AbsentValue[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_machine(task: tuple[int, int]) → int | AbsentValue[source]
get_mode(task: tuple[int, int]) → int | AbsentValue[source]

Get ‘mode’ of given task, aka chosen machine.

get_start_time(task: tuple[int, int]) → int | AbsentValue[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:

machine_index: list[list[int]]
problem: CommonShopProblem
recipe_index: list[list[int]]
schedule: list[list[tuple[int, int]]]
class discrete_optimization.shop.base.CommonShopProblem(list_jobs: list[Job], n_jobs: int = None, n_machines: int = None, horizon: int = None)[source]

Bases: GenericSchedulingProblem[tuple[int, int], None, None, int, None], WithoutSkillProblem[tuple[int, int], None, int, None], WithoutNonRenewableResourceProblem[tuple[int, int]], WithoutAllocationProblem[tuple[int, int]]

get_cumulative_resource_consumption(resource: int, task: tuple[int, int], mode: int) → int[source]

Get cumulative resource consumption of the task in the given mode

Parameters:
  • resource – cumulative resource

  • task

  • mode – not used for single mode problems

Returns:

the consumption for cumulative resources.

get_list_objective_computer() → list[ObjectiveComputer][source]
get_makespan_upper_bound() → int[source]

Get an upper bound on global makespan.

get_no_overlap() → set[frozenset[tuple[int, int]]][source]

An object in this returned set is a (frozen) set of task, where no task should overlap with another one in this set.

Default to no such sets.

get_solution_type() → type[Solution][source]

Returns the class implementation of a Solution.

Returns (class): class object of the given Problem.

get_task_mode_duration(task: tuple[int, int], mode: int) → int[source]

Get task duration according to mode.

Parameters:
  • task

  • mode – not used for single-mode problems

Returns:

get_task_modes(task: tuple[int, int]) → set[int][source]

Retrieve mode found for given task.

Parameters:

task

Returns:

is_optional(task: tuple[int, int]) → bool[source]

Whether a task is optional or not.

It means that the task can be ignored in the solution. If absent of the solution, it can also be removed from the constraints.

Default to no optional task.

list_jobs: list[Job]
machine_to_mode_mapping(task: tuple[int, int])[source]
mode_to_machine_mapping(task: tuple[int, int])[source]
n_jobs: int
n_machines: int
property non_skill_cumulative_resources_list: list[int]

List of cumulative resources that are not skills.

satisfy(variable: AnyShopSolution) → 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.

class discrete_optimization.shop.base.Job(job_index: int, subjobs: list[Subjob])[source]

Bases: object

job_index: int
subjobs: list[Subjob]
class discrete_optimization.shop.base.Subjob(subjob_index: int, job_index: int, recipes: list[SubjobRecipe])[source]

Bases: object

job_index: int
recipes: list[SubjobRecipe]
subjob_index: int
class discrete_optimization.shop.base.SubjobRecipe(machine_index: int, processing_time: int)[source]

Bases: object

machine_index: int
processing_time: int
discrete_optimization.shop.base.Task

(job index, subjob index).

Type:

Task representation

alias of tuple[int, int]

discrete_optimization.shop.utils module

discrete_optimization.shop.utils.plot_shop_solution(solution: AnyShopSolution, title: str = 'Job Shop Schedule')[source]

Creates a Gantt chart visualization for a JobShopSolution.

Parameters:
  • solution – A JobShopSolution object containing the problem and schedule.

  • title – The title for the plot.

discrete_optimization.shop.utils.transform_shop_to_rcpsp(problem: CommonShopProblem) → RcpspProblem[source]

Module contents