discrete_optimization.singlemachine package

Subpackages

Submodules

discrete_optimization.singlemachine.parser module

discrete_optimization.singlemachine.parser.get_data_available(data_folder: str | None = None, data_home: str | None = None) list[str][source]

Get datasets available for tsp.

Params:
data_folder: folder where datasets for weighted tardiness problem should be found.

If None, we look in “wt” subdirectory of data_home.

data_home: root directory for all datasets. Is None, set by

default to “~/discrete_optimization_data “

discrete_optimization.singlemachine.parser.parse_file(path: str, num_jobs: int | None = None)[source]
discrete_optimization.singlemachine.parser.parse_wt_content(file_content: str, num_jobs: int) list[WeightedTardinessProblem][source]

Parses a weighted tardiness file with a known number of jobs per instance.

Parameters:
  • file_content (str) – The full content of the text file.

  • num_jobs (int) – The number of jobs per instance (e.g., 40 for wt40.txt).

Returns:

A list of parsed problem instances.

Return type:

List[WeightedTardinessProblem]

discrete_optimization.singlemachine.problem module

class discrete_optimization.singlemachine.problem.WTSolution(problem: WeightedTardinessProblem, schedule: list[tuple[int, int]])[source]

Bases: Solution

class discrete_optimization.singlemachine.problem.WeightedTardinessProblem(num_jobs: int, processing_times: List[int], weights: List[int], due_dates: List[int], release_dates: List[int] | None = None)[source]

Bases: Problem

Represents a single instance of the single-machine weighted tardiness problem.

evaluate(variable: WTSolution) 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_attribute_register() EncodingRegister[source]

Returns how the Solution should be encoded.

Returns (EncodingRegister): content of the encoding of the solution

get_dummy_solution() WTSolution[source]
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: WTSolution) 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.

Module contents