discrete_optimization.gpdp package
Subpackages
- discrete_optimization.gpdp.builders package
- discrete_optimization.gpdp.solvers package
- Submodules
- discrete_optimization.gpdp.solvers.gpdp_solver module
- discrete_optimization.gpdp.solvers.lp_iterative module
BaseLinearFlowGpdpSolverBaseLinearFlowGpdpSolver.add_order_constraints()BaseLinearFlowGpdpSolver.convert_temporaryresults()BaseLinearFlowGpdpSolver.convert_to_variable_values()BaseLinearFlowGpdpSolver.init_model()BaseLinearFlowGpdpSolver.init_order_variables()BaseLinearFlowGpdpSolver.lazyBaseLinearFlowGpdpSolver.one_visit_per_clusters()BaseLinearFlowGpdpSolver.one_visit_per_node()BaseLinearFlowGpdpSolver.problemBaseLinearFlowGpdpSolver.resources_constraint()BaseLinearFlowGpdpSolver.retrieve_current_solution()BaseLinearFlowGpdpSolver.retrieve_current_temporaryresult()BaseLinearFlowGpdpSolver.set_warm_start()BaseLinearFlowGpdpSolver.simple_capacity_constraint()BaseLinearFlowGpdpSolver.solve()BaseLinearFlowGpdpSolver.solve_iterative()BaseLinearFlowGpdpSolver.solve_one_iteration()BaseLinearFlowGpdpSolver.time_evolution()BaseLinearFlowGpdpSolver.warm_start
ConstraintHandlerOrWarmStartGurobiLazyConstraintLinearFlowGpdpSolverGurobiLinearFlowGpdpSolverMathOptLinearFlowGpdpSolverSubtourAddingConstraintTemporaryResultTemporaryResultGurobiCallbackTemporaryResultMathOptCallbackbuild_graph_solution()build_graph_solutions()build_path_from_vehicle_type_flow()build_the_cycles()construct_edges_in_out_dict()convert_temporaryresult_to_gpdpsolution()rebuild_routine()rebuild_routine_variant()reevaluate_result()retrieve_current_solution()update_model_generic()
- discrete_optimization.gpdp.solvers.ortools_routing module
FirstSolutionStrategyFirstSolutionStrategy.ALL_UNPERFORMEDFirstSolutionStrategy.AUTOMATICFirstSolutionStrategy.BEST_INSERTIONFirstSolutionStrategy.CHRISTOFIDESFirstSolutionStrategy.EVALUATOR_STRATEGYFirstSolutionStrategy.FIRST_UNBOUND_MIN_VALUEFirstSolutionStrategy.GLOBAL_CHEAPEST_ARCFirstSolutionStrategy.LOCAL_CHEAPEST_ARCFirstSolutionStrategy.LOCAL_CHEAPEST_COST_INSERTIONFirstSolutionStrategy.LOCAL_CHEAPEST_INSERTIONFirstSolutionStrategy.PARALLEL_CHEAPEST_INSERTIONFirstSolutionStrategy.PARALLEL_SAVINGSFirstSolutionStrategy.PATH_CHEAPEST_ARCFirstSolutionStrategy.PATH_MOST_CONSTRAINED_ARCFirstSolutionStrategy.SAVINGSFirstSolutionStrategy.SEQUENTIAL_CHEAPEST_INSERTIONFirstSolutionStrategy.SWEEPFirstSolutionStrategy.UNSET
LocalSearchMetaheuristicNodePositionOrtoolsGpdpSolverParametersCostRoutingMonitorRoutingSearchStatusRoutingSearchStatus.ROUTING_FAILRoutingSearchStatus.ROUTING_FAIL_TIMEOUTRoutingSearchStatus.ROUTING_INFEASIBLERoutingSearchStatus.ROUTING_INVALIDRoutingSearchStatus.ROUTING_NOT_SOLVEDRoutingSearchStatus.ROUTING_OPTIMALRoutingSearchStatus.ROUTING_PARTIAL_SUCCESS_LOCAL_OPTIMUM_NOT_REACHEDRoutingSearchStatus.ROUTING_SUCCESS
apply_cost()convert_to_gpdpsolution()status_description
- Module contents
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
- 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.
- 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.
- 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
- 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_tsptw_to_gpdp(tsptw_problem: TSPTWProblem, compute_graph: bool = False) GpdpProblem[source]
Converts a TSPTWProblem to a GpdpProblem instance.
This method maps the single-vehicle TSP-TW to the more general multi-vehicle pickup and delivery framework by: 1. Creating distinct virtual origin and target nodes for the single vehicle,
both corresponding to the original depot.
Mapping customers and time windows to the new node structure.
Setting up the distance and time matrices based on the original problem.
- static from_vrp_to_gpdp(vrp_problem: Customer2DVrpProblem, compute_graph: bool = False) GpdpProblem[source]
- static from_vrptw_to_gpdp(vrptw_problem: VRPTWProblem, compute_graph: bool = False) GpdpProblem[source]
- discrete_optimization.gpdp.problem.build_matrix_distance(problem: GpdpProblem) ndarray[tuple[Any, ...], dtype[float64]][source]
- discrete_optimization.gpdp.problem.build_matrix_time(problem: GpdpProblem) ndarray[tuple[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]