discrete_optimization.pickup_vrp.solver package

Submodules

discrete_optimization.pickup_vrp.solver.lp_solver module

class discrete_optimization.pickup_vrp.solver.lp_solver.ConstraintHandlerOrWarmStart(linear_solver: LinearFlowSolver, problem: GPDP, do_lns: bool = True)[source]

Bases: object

adding_constraint(rebuilt_dict: Dict[int, List[Hashable]]) None[source]
class discrete_optimization.pickup_vrp.solver.lp_solver.LinearFlowSolver(problem: GPDP, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]

Bases: GurobiMilpSolver, SolverPickupVrp

convert_temporaryresults(temporary_results: List[TemporaryResult]) List[Tuple[Solution, float | TupleFitness]][source]
init_model(**kwargs: Any) None[source]

Initialize intern model used to solve.

Can initialize a ortools, milp, gurobi, … model.

init_warm_start(routes: Dict[int, List]) None[source]
one_visit_per_clusters(model: grb.Model, nodes_of_interest: Iterable[Hashable], variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) None[source]
one_visit_per_node(model: grb.Model, nodes_of_interest: Iterable[Hashable], variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) None[source]
problem: GPDP
resources_constraint(model: grb.Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[str, Dict[Hashable, Any]]][source]
retrieve_current_solution(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float]) GPDPSolution[source]

Not used here as GurobiMilpSolver.solve() is overriden

retrieve_current_temporaryresult(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float]) TemporaryResult[source]
retrieve_ith_temporaryresult(i: int) TemporaryResult[source]
retrieve_solutions(parameters_milp: ParametersMilp, **kwargs: Any) ResultStorage[source]

Retrieve solutions found by internal solver.

Parameters:
  • parameters_milp

  • **kwargs – passed to ResultStorage.__init__()

Returns:

simple_capacity_constraint(model: grb.Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[int, Dict[str, Any]]][source]
solve(parameters_milp: ParametersMilp | None = None, do_lns: bool = True, nb_iteration_max: int = 10, json_dump_folder: str | None = None, warm_start: Dict[Any, Any] | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]

Generic solving function.

Parameters:
  • callbacks – list of callbacks used to hook into the various stage of the solve

  • **kwargs – any argument specific to the solver

Solvers deriving from SolverDo should use callbacks methods .on_step_end(), … during solve(). But some solvers are not yet updated and are just ignoring it.

Returns (ResultStorage): a result object containing potentially a pool of solutions to a discrete-optimization problem

solve_iterative(parameters_milp: ParametersMilp | None = None, do_lns: bool = True, nb_iteration_max: int = 10, json_dump_folder: str | None = None, warm_start: Dict[Any, Any] | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]
Parameters:
  • parameters_milp

  • do_lns

  • nb_iteration_max

  • json_dump_folder – if not None, solution will be dumped in this folder at each iteration

  • warm_start

  • **kwargs

Returns:

solve_one_iteration(parameters_milp: ParametersMilp | None = None, **kwargs: Any) List[TemporaryResult][source]
time_evolution(model: grb.Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[Hashable, Any]][source]
class discrete_optimization.pickup_vrp.solver.lp_solver.LinearFlowSolverLazyConstraint(problem: GPDP, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]

Bases: LinearFlowSolver

solve_iterative(parameters_milp: ParametersMilp | None = None, do_lns: bool = True, nb_iteration_max: int = 10, json_dump_folder: str | None = None, warm_start: Dict[Any, Any] | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]
Parameters:
  • parameters_milp

  • do_lns

  • nb_iteration_max

  • json_dump_folder – if not None, solution will be dumped in this folder at each iteration

  • warm_start

  • **kwargs

Returns:

solve_one_iteration(parameters_milp: ParametersMilp | None = None, **kwargs: Any) List[TemporaryResult][source]
class discrete_optimization.pickup_vrp.solver.lp_solver.SubtourAddingConstraint(problem: GPDP, linear_solver: LinearFlowSolver, lazy: bool = False)[source]

Bases: object

adding_component_constraints(list_solution: List[TemporaryResult]) None[source]
class discrete_optimization.pickup_vrp.solver.lp_solver.SubtourAddingConstraintCluster(problem: GPDP, linear_solver: LinearFlowSolver, lazy: bool = False)[source]

Bases: object

adding_component_constraints(list_solution: List[TemporaryResult]) None[source]
class discrete_optimization.pickup_vrp.solver.lp_solver.TemporaryResult(flow_solution: Dict[int, Dict[Tuple[Hashable, Hashable], int]], graph_merge: DiGraph, graph_vehicle: Dict[int, DiGraph], obj: float, all_variables: Dict[str, Dict[Any, Any]] | None = None)[source]

Bases: object

discrete_optimization.pickup_vrp.solver.lp_solver.build_graph_solution(results: Dict[str, Dict[Hashable, Any]], obj: float, graph: Graph) TemporaryResult[source]
discrete_optimization.pickup_vrp.solver.lp_solver.build_graph_solutions(solutions: List[Tuple[Dict, float]], graph: Graph) List[TemporaryResult][source]
discrete_optimization.pickup_vrp.solver.lp_solver.build_path_from_vehicle_type_flow(result_from_retrieve: Dict[str, Dict[Hashable, Any]], problem: GPDP) Dict[int, List[Hashable]][source]
discrete_optimization.pickup_vrp.solver.lp_solver.build_the_cycles(flow_solution: Dict[Tuple[Hashable, Hashable], int], component: Set[Hashable], start_index: Hashable, end_index: Hashable) Tuple[List[Hashable], Dict[Hashable, int]][source]
discrete_optimization.pickup_vrp.solver.lp_solver.construct_edges_in_out_dict(variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], clusters_dict: Dict[Hashable, Hashable]) Tuple[Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], Dict[int, Dict[Hashable, Set[Tuple[Hashable, Hashable]]]], Dict[int, Dict[Hashable, Set[Tuple[Hashable, Hashable]]]], Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], Dict[int, Dict[Hashable, Set[Tuple[Hashable, Hashable]]]], Dict[int, Dict[Hashable, Set[Tuple[Hashable, Hashable]]]]][source]
discrete_optimization.pickup_vrp.solver.lp_solver.convert_temporaryresult_to_gpdpsolution(temporaryresult: TemporaryResult, problem: GPDP) GPDPSolution[source]
discrete_optimization.pickup_vrp.solver.lp_solver.rebuild_routine(sorted_connected_component: List[Tuple[Set[Hashable], int]], paths_component: Dict[int, List[Hashable]], node_to_component: Dict[Hashable, int], indexes: Dict[int, Dict[Hashable, int]], graph: DiGraph, edges: Set[Tuple[Hashable, Hashable]], evaluate_function_indexes: Callable[[Hashable, Hashable], float], start_index: Hashable, end_index: Hashable) List[Hashable][source]
discrete_optimization.pickup_vrp.solver.lp_solver.rebuild_routine_variant(sorted_connected_component: List[Tuple[Set[Hashable], int]], paths_component: Dict[int, List[Hashable]], node_to_component: Dict[Hashable, int], indexes: Dict[int, Dict[Hashable, int]], graph: DiGraph, edges: Set[Tuple[Hashable, Hashable]], evaluate_function_indexes: Callable[[Hashable, Hashable], float], start_index: Hashable, end_index: Hashable) List[Hashable][source]
discrete_optimization.pickup_vrp.solver.lp_solver.reevaluate_result(temporary_result: TemporaryResult, problem: GPDP, variant_rebuilt: bool = True, possible_subcycle_in_component: bool = True) TemporaryResult[source]
discrete_optimization.pickup_vrp.solver.lp_solver.retrieve_current_solution(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float], variable_decisions: Dict[str, Any]) Tuple[Dict[str, Dict[Hashable, Any]], float][source]
discrete_optimization.pickup_vrp.solver.lp_solver.update_model(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], do_order: bool = True) List[Any][source]
discrete_optimization.pickup_vrp.solver.lp_solver.update_model_cluster_tsp(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], lazy: bool = False) List[Any][source]
discrete_optimization.pickup_vrp.solver.lp_solver.update_model_lazy(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], do_order: bool = False) List[Any][source]

discrete_optimization.pickup_vrp.solver.lp_solver_pymip module

class discrete_optimization.pickup_vrp.solver.lp_solver_pymip.ConstraintHandlerOrWarmStart(linear_solver: LinearFlowSolver, problem: GPDP, do_lns: bool = True, remove_constr: bool = True)[source]

Bases: object

adding_constraint(rebuilt_dict: Dict[int, List[Hashable]]) None[source]
class discrete_optimization.pickup_vrp.solver.lp_solver_pymip.LinearFlowSolver(problem: GPDP, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]

Bases: PymipMilpSolver, SolverPickupVrp

convert_temporaryresults(temporary_results: List[TemporaryResult]) List[Tuple[Solution, float | TupleFitness]][source]
init_model(**kwargs: Any) None[source]

Initialize intern model used to solve.

Can initialize a ortools, milp, gurobi, … model.

one_visit_per_clusters(model: Model, nodes_of_interest: Iterable[Hashable], variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) None[source]
one_visit_per_node(model: Model, nodes_of_interest: Iterable[Hashable], variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) None[source]
problem: GPDP
reapply_constraint(list_constraint_tuple: List[Tuple[Set[Tuple[int, int]], int]]) None[source]
resources_constraint(model: Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[str, Dict[Hashable, Any]]][source]
retrieve_current_solution(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float]) Solution[source]

Not used here as GurobiMilpSolver.solve() is overriden

retrieve_current_temporaryresult(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float]) TemporaryResult[source]
retrieve_ith_temporaryresult(i: int) TemporaryResult[source]
retrieve_solutions(parameters_milp: ParametersMilp, **kwargs: Any) ResultStorage[source]

Retrieve solutions found by internal solver.

Parameters:
  • parameters_milp

  • **kwargs – passed to ResultStorage.__init__()

Returns:

simple_capacity_constraint(model: Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[int, Dict[str, Any]]][source]
solve(parameters_milp: ParametersMilp | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]

Generic solving function.

Parameters:
  • callbacks – list of callbacks used to hook into the various stage of the solve

  • **kwargs – any argument specific to the solver

Solvers deriving from SolverDo should use callbacks methods .on_step_end(), … during solve(). But some solvers are not yet updated and are just ignoring it.

Returns (ResultStorage): a result object containing potentially a pool of solutions to a discrete-optimization problem

solve_iterative(parameters_milp: ParametersMilp | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]
solve_one_iteration(parameters_milp: ParametersMilp | None = None, **kwargs: Any) List[TemporaryResult][source]
time_evolution(model: Model, variables_edges: Dict[int, Dict[Tuple[Hashable, Hashable], Any]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Dict[str, Dict[Hashable, Any]][source]
exception discrete_optimization.pickup_vrp.solver.lp_solver_pymip.MipModelException(message: str)[source]

Bases: Exception

class discrete_optimization.pickup_vrp.solver.lp_solver_pymip.SubtourAddingConstraint(problem: GPDP, linear_solver: LinearFlowSolver, lazy: bool = False)[source]

Bases: object

adding_component_constraints(list_solution: List[TemporaryResult]) List[Any][source]
class discrete_optimization.pickup_vrp.solver.lp_solver_pymip.SubtourAddingConstraintCluster(problem: GPDP, linear_solver: LinearFlowSolver)[source]

Bases: object

adding_component_constraints(list_solution: List[TemporaryResult]) List[Any][source]
discrete_optimization.pickup_vrp.solver.lp_solver_pymip.retrieve_current_solution(get_var_value_for_current_solution: Callable[[Any], float], get_obj_value_for_current_solution: Callable[[], float], variable_decisions: Dict[str, Any]) Tuple[Dict[str, Dict[Hashable, Any]], float][source]
discrete_optimization.pickup_vrp.solver.lp_solver_pymip.update_model(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) Tuple[List[Any], List[Tuple[List[Tuple[int, Tuple[Hashable, Hashable]]], int]]][source]
discrete_optimization.pickup_vrp.solver.lp_solver_pymip.update_model_cluster_tsp(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles_cluster: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles_cluster: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]]) List[Any][source]
discrete_optimization.pickup_vrp.solver.lp_solver_pymip.update_model_lazy(problem: GPDP, lp_solver: LinearFlowSolver, components_global: List[Tuple[Set[Hashable], int]], edges_in_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], edges_out_all_vehicles: Dict[Hashable, Set[Tuple[int, Tuple[Hashable, Hashable]]]], do_constraint_on_order: bool = False) List[Any][source]

discrete_optimization.pickup_vrp.solver.ortools_solver module

class discrete_optimization.pickup_vrp.solver.ortools_solver.FirstSolutionStrategy(value)

Bases: Enum

Enumeration of first solution strategies.

Extracted from ortools Enum-like class. https://developers.google.com/optimization/routing/routing_options#first_solution_strategy

ALL_UNPERFORMED = 6
AUTOMATIC = 15
BEST_INSERTION = 7
CHRISTOFIDES = 13
EVALUATOR_STRATEGY = 5
FIRST_UNBOUND_MIN_VALUE = 12
GLOBAL_CHEAPEST_ARC = 1
LOCAL_CHEAPEST_ARC = 2
LOCAL_CHEAPEST_COST_INSERTION = 16
LOCAL_CHEAPEST_INSERTION = 9
PARALLEL_CHEAPEST_INSERTION = 8
PATH_CHEAPEST_ARC = 3
PATH_MOST_CONSTRAINED_ARC = 4
SAVINGS = 10
SEQUENTIAL_CHEAPEST_INSERTION = 14
SWEEP = 11
UNSET = 0
class discrete_optimization.pickup_vrp.solver.ortools_solver.LocalSearchMetaheuristic(value)

Bases: Enum

Enumeration of local search meta-heuristic.

Extracted from ortools Enum-like class. https://developers.google.com/optimization/routing/routing_options#local_search_options

AUTOMATIC = 6
GREEDY_DESCENT = 1
SIMULATED_ANNEALING = 3
UNSET = 0
class discrete_optimization.pickup_vrp.solver.ortools_solver.NodePosition(value)[source]

Bases: Enum

Node position inside a trajectory.

Useful e.g. to distinguish between the starting node and ending node when the trajectory is a loop.

END = 'end'
INTERMEDIATE = 'intermediate'
START = 'start'
class discrete_optimization.pickup_vrp.solver.ortools_solver.ORToolsGPDP(problem: GPDP, factor_multiplier_distance: float = 1, factor_multiplier_time: float = 1, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]

Bases: SolverPickupVrp

build_search_parameters(**kwargs: Any) RoutingSearchParameters[source]
hyperparameters: List[Hyperparameter] = [EnumHyperparameter(name='first_solution_strategy', default=<FirstSolutionStrategy.SAVINGS: 10>, choices=[<FirstSolutionStrategy.UNSET: 0>, <FirstSolutionStrategy.AUTOMATIC: 15>, <FirstSolutionStrategy.PATH_CHEAPEST_ARC: 3>, <FirstSolutionStrategy.PATH_MOST_CONSTRAINED_ARC: 4>, <FirstSolutionStrategy.EVALUATOR_STRATEGY: 5>, <FirstSolutionStrategy.SAVINGS: 10>, <FirstSolutionStrategy.SWEEP: 11>, <FirstSolutionStrategy.CHRISTOFIDES: 13>, <FirstSolutionStrategy.ALL_UNPERFORMED: 6>, <FirstSolutionStrategy.BEST_INSERTION: 7>, <FirstSolutionStrategy.PARALLEL_CHEAPEST_INSERTION: 8>, <FirstSolutionStrategy.SEQUENTIAL_CHEAPEST_INSERTION: 14>, <FirstSolutionStrategy.LOCAL_CHEAPEST_INSERTION: 9>, <FirstSolutionStrategy.LOCAL_CHEAPEST_COST_INSERTION: 16>, <FirstSolutionStrategy.GLOBAL_CHEAPEST_ARC: 1>, <FirstSolutionStrategy.LOCAL_CHEAPEST_ARC: 2>, <FirstSolutionStrategy.FIRST_UNBOUND_MIN_VALUE: 12>]), EnumHyperparameter(name='local_search_metaheuristic', default=<LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH: 2>, choices=[<LocalSearchMetaheuristic.UNSET: 0>, <LocalSearchMetaheuristic.AUTOMATIC: 6>, <LocalSearchMetaheuristic.GREEDY_DESCENT: 1>, <LocalSearchMetaheuristic.GUIDED_LOCAL_SEARCH: 2>, <LocalSearchMetaheuristic.SIMULATED_ANNEALING: 3>, <LocalSearchMetaheuristic.TABU_SEARCH: 4>, <LocalSearchMetaheuristic.GENERIC_TABU_SEARCH: 5>]), CategoricalHyperparameter(name='use_lns', default=True, choices=[True, False]), CategoricalHyperparameter(name='use_cp', default=True, choices=[True, False]), CategoricalHyperparameter(name='use_cp_sat', default=False, choices=[True, False])]

Hyperparameters available for this solver.

These hyperparameters are to be feed to **kwargs found in
  • __init__()

  • init_model() (when available)

  • solve()

init_model(**kwargs: Any) None[source]

Initialize intern model used to solve.

Can initialize a ortools, milp, gurobi, … model.

problem: GPDP
solve(search_parameters: RoutingSearchParameters | None = None, callbacks: List[Callback] | None = None, **kwargs: Any) ResultStorage[source]

Generic solving function.

Parameters:
  • callbacks – list of callbacks used to hook into the various stage of the solve

  • **kwargs – any argument specific to the solver

Solvers deriving from SolverDo should use callbacks methods .on_step_end(), … during solve(). But some solvers are not yet updated and are just ignoring it.

Returns (ResultStorage): a result object containing potentially a pool of solutions to a discrete-optimization problem

class discrete_optimization.pickup_vrp.solver.ortools_solver.ParametersCost(dimension_name: str, global_span: bool = True, sum_over_vehicles: bool = False, coefficient_vehicles: float | List[float] = 100)[source]

Bases: object

static default() ParametersCost[source]
class discrete_optimization.pickup_vrp.solver.ortools_solver.RoutingMonitor(do_solver: ORToolsGPDP, callback: Callback)[source]

Bases: SearchMonitor

AtSolution() bool[source]

This method is called when a valid solution is found. If the return value is true, then search will resume after. If the result is false, then search will stop there.

EnterSearch()[source]

Beginning of the search.

ExitSearch()[source]

End of the search.

retrieve_current_solution() None[source]
discrete_optimization.pickup_vrp.solver.ortools_solver.apply_cost(list_parameters_cost: List[ParametersCost], routing: RoutingModel) None[source]
discrete_optimization.pickup_vrp.solver.ortools_solver.convert_to_gpdpsolution(problem: GPDP, sol: Tuple[Dict[int, List[int]], Dict[Tuple[int, int, NodePosition], Dict[str, Tuple[float, float, float]]], float, float, float]) GPDPSolution[source]
discrete_optimization.pickup_vrp.solver.ortools_solver.status_description = {0: 'ROUTING_NOT_SOLVED', 1: 'ROUTING_SUCCESS', 2: 'ROUTING_PARTIAL_SUCCESS_LOCAL_OPTIMUM_NOT_REACHED', 3: 'ROUTING_FAIL', 4: 'ROUTING_FAIL_TIMEOUT', 5: 'ROUTING_INVALID', 6: 'ROUTING_INFEASIBLE', 7: 'ROUTING_OPTIMAL'}

Mapping from status integer to description string.

This maps the integer returned by routing_model.status to the corresponding string.

We use the attributes of RoutingModel to construct the dictionary. https://developers.google.com/optimization/routing/routing_options#search_status

discrete_optimization.pickup_vrp.solver.pickup_vrp_solver module

class discrete_optimization.pickup_vrp.solver.pickup_vrp_solver.SolverPickupVrp(problem: Problem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]

Bases: SolverDO

problem: GPDP

Module contents