discrete_optimization.top.solvers package
Submodules
discrete_optimization.top.solvers.cpsat module
- class discrete_optimization.top.solvers.cpsat.CpsatTopSolver(problem: TeamOrienteeringProblem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs)[source]
Bases:
OrtoolsCpSatSolver,WarmstartMixin- init_model(scaling: float = 1, **kwargs: Any) None[source]
Init cp model and reset stored variables if any.
- problem: TeamOrienteeringProblem
- retrieve_solution(cpsolvercb: CpSolverSolutionCallback) VrpSolution[source]
Construct a do solution from the cpsat solver internal solution.
It will be called each time the cpsat solver find a new solution. At that point, value of internal variables are accessible via cpsolvercb.Value(VARIABLE_NAME).
- Parameters:
cpsolvercb – the ortools callback called when the cpsat solver finds a new solution.
- Returns:
the intermediate solution, at do format.
- set_warm_start(solution: VrpSolution, debug_mode: bool = False) None[source]
Make the solver warm start from the given solution.
discrete_optimization.top.solvers.dp module
- class discrete_optimization.top.solvers.dp.DpTopSolver(problem: TeamOrienteeringProblem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs)[source]
Bases:
DpSolver- init_model(scaling: float = 1, **kwargs: Any) None[source]
Initialize internal model used to solve.
Can initialize a ortools, milp, gurobi, … model.
- problem: TeamOrienteeringProblem
- retrieve_solution(sol: Solution) VrpSolution[source]
discrete_optimization.top.solvers.optal module
- class discrete_optimization.top.solvers.optal.OptalTopSolver(problem: TeamOrienteeringProblem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs)[source]
Bases:
TopSolver,OptalCpSolver- init_model(scaling: float, **args: Any) None[source]
Initialize internal model used to solve.
Can initialize a ortools, milp, gurobi, … model.
- retrieve_solution(result: cp.SolveResult) VrpSolution[source]
Return a d-o solution from the variables computed by minizinc.
- Parameters:
result – output of the cp.solve
Returns:
discrete_optimization.top.solvers.ortools module
- class discrete_optimization.top.solvers.ortools.OrtoolsTopSolver(problem: TeamOrienteeringProblem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs: Any)[source]
Bases:
SolverDO- init_model(scaling: float = 1, **kwargs: Any) None[source]
Initialize internal model used to solve.
Can initialize a ortools, milp, gurobi, … model.
- manager: RoutingIndexManager | None = None
- problem: TeamOrienteeringProblem
- routing: RoutingModel | None = None
- solve(callbacks: list[Callback] | None = None, time_limit: int = 100, **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.top.solvers.ortools.TopRoutingMonitor(do_solver: OrtoolsTopSolver, callback: Callback)[source]
Bases:
SearchMonitorMonitor to retrieve intermediate solutions and handle callbacks (logging, early stopping) for the Team Orienteering Problem.
Module contents
- class discrete_optimization.top.solvers.TopSolver(problem: TeamOrienteeringProblem, params_objective_function: ParamsObjectiveFunction | None = None, **kwargs)[source]
Bases:
SolverDO- problem: TeamOrienteeringProblem