discrete_optimization.gpdp package

Subpackages

Submodules

discrete_optimization.gpdp.plot module

discrete_optimization.gpdp.plot.plot_gpdp_solution(sol: GpdpSolution, problem: GpdpProblem) tuple[Figure, Axes][source]

discrete_optimization.gpdp.problem module

class discrete_optimization.gpdp.problem.GpdpProblem(number_vehicle: int, nodes_transportation: set[Hashable], nodes_origin: set[Hashable], nodes_target: set[Hashable], list_pickup_deliverable: list[tuple[list[Hashable], list[Hashable]]], origin_vehicle: dict[int, Hashable], target_vehicle: dict[int, Hashable], resources_set: set[str], capacities: dict[int, dict[str, tuple[float, float]]], resources_flow_node: dict[Hashable, dict[str, float]], resources_flow_edges: dict[tuple[Hashable, Hashable], dict[str, float]], distance_delta: dict[Hashable, dict[Hashable, float]], time_delta: dict[Hashable, dict[Hashable, float]], time_delta_node: dict[Hashable, float] | None = None, coordinates_2d: dict[Hashable, tuple[float, float]] | None = None, clusters_dict: dict[Hashable, Hashable] | None = None, list_pickup_deliverable_per_cluster: list[tuple[list[Hashable], list[Hashable]]] | None = None, mandatory_node_info: dict[Hashable, bool] | None = None, cumulative_constraints: list[tuple[set[Hashable], int]] | None = None, time_windows_nodes: dict[Hashable, tuple[int | None, int | None]] | None = None, time_windows_cluster: dict[Hashable, tuple[int | None, int | None]] | None = None, group_identical_vehicles: dict[int, list[int]] | None = None, slack_time_bound_per_node: dict[Hashable, tuple[int, float]] | None = None, node_vehicle: dict[Hashable, list[int]] | None = None, compute_graph: bool = False)[source]

Bases: Problem

MAX_VALUE = 10000000000.0
compute_distance(path: list[Hashable]) float[source]
compute_graph() None[source]
evaluate(variable: GpdpSolution) 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_node(node_1: Hashable, node_2: Hashable) float[source]
get_attribute_register() EncodingRegister[source]

Returns how the Solution should be encoded.

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

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: GpdpSolution) 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.

update_edges() None[source]
update_graph() None[source]
class discrete_optimization.gpdp.problem.GpdpSolution(problem: GpdpProblem, trajectories: dict[int, list[Hashable]], times: dict[Hashable, float], resource_evolution: dict[Hashable, dict[Hashable, list[int]]])[source]

Bases: Solution

change_problem(new_problem: Problem) None[source]

If relevant to the optimisation problem, change the underlying problem instance for the solution.

This method can be used to evaluate a solution for different instance of problems.

Parameters:

new_problem (Problem) – another problem instance from which the solution can be evaluated

Returns: None

check_pickup_deliverable() bool[source]
copy() GpdpSolution[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.

class discrete_optimization.gpdp.problem.ProxyClass[source]

Bases: object

static from_tsp_to_gpdp(tsp_model: Point2DTspProblem, compute_graph: bool = False) GpdpProblem[source]
static from_vrp_to_gpdp(vrp_problem: Customer2DVrpProblem, compute_graph: bool = False) GpdpProblem[source]
discrete_optimization.gpdp.problem.build_matrix_distance(problem: GpdpProblem) ndarray[Any, dtype[float64]][source]
discrete_optimization.gpdp.problem.build_matrix_time(problem: GpdpProblem) ndarray[Any, dtype[float64]][source]
discrete_optimization.gpdp.problem.build_pruned_problem(problem: GpdpProblem, undirected: bool = True, compute_graph: bool = False) GpdpProblem[source]
discrete_optimization.gpdp.problem.max_distance(problem: GpdpProblem) float[source]
discrete_optimization.gpdp.problem.max_time(problem: GpdpProblem) float[source]

Module contents