discrete_optimization.top package

Subpackages

Submodules

discrete_optimization.top.parser module

discrete_optimization.top.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.top.parser.parse_file(file_path: str) TeamOrienteeringProblem2D[source]

discrete_optimization.top.problem module

class discrete_optimization.top.problem.CustomerTop(name: str | int, reward: float)[source]

Bases: BasicCustomer

class discrete_optimization.top.problem.CustomerTop2D(name: str | int, reward: float, x: float, y: float)[source]

Bases: CustomerTop

class discrete_optimization.top.problem.TeamOrienteeringProblem(vehicle_count: int, max_length_tours: float, customer_count: int, customers: Sequence[BasicCustomer], start_indexes: list[int], end_indexes: list[int])[source]

Bases: VrpProblem

count_multiple_visits(vrp_sol: VrpSolution) bool[source]
customers: list[CustomerTop]
evaluate(solution: VrpSolution) 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.

evaluate_function(vrp_sol: VrpSolution) tuple[list[list[float]], list[float], float, list[float]][source]
get_objective_register() ObjectiveRegister[source]

Returns the objective definition.

Returns (ObjectiveRegister): object defining the objective criteria.

max_length_tours: float
satisfy(variable: VrpSolution) 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.

class discrete_optimization.top.problem.TeamOrienteeringProblem2D(vehicle_count: int, max_length_tours: float, customer_count: int, customers: Sequence[BasicCustomer], start_indexes: list[int], end_indexes: list[int])[source]

Bases: TeamOrienteeringProblem

customers: list[CustomerTop]
evaluate_function_indexes(index_1: int, index_2: int) float[source]
max_length_tours: float

Module contents