pyepo.model.omo.vrp¶
Capacitated vehicle routing problem
Classes¶
Abstract Pyomo-backed model for the capacitated vehicle routing problem. |
|
CVRP formulation on a directed graph with MTZ-style capacity constraints. |
|
LP relaxation of |
Module Contents¶
- class pyepo.model.omo.vrp.vrpABModel(num_nodes: int, demands: list[float] | numpy.ndarray, capacity: float, num_vehicle: int, solver: str = 'glpk')¶
Bases:
pyepo.model.bases.vrpABBase,pyepo.model.omo.omomodel.optOmoModelAbstract Pyomo-backed model for the capacitated vehicle routing problem.
Pyomo lacks easy callback support, so no lazy-cut RCI formulation exists for this backend — only MTZ. A single-customer route is excluded so all edge variables stay strictly binary; if a single-stop route is actually needed, duplicate the depot.
- Variables:
solver – optimization solver in the background
- class pyepo.model.omo.vrp.vrpMTZModel(num_nodes: int, demands: list[float] | numpy.ndarray, capacity: float, num_vehicle: int, solver: str = 'glpk')¶
Bases:
vrpABModelCVRP formulation on a directed graph with MTZ-style capacity constraints. Cost vector is per undirected edge: cost
c[k]is assigned to bothx[i,j]andx[j,i].- solve() tuple[numpy.ndarray, float]¶
A method to solve the model
- Returns:
edge-selection vector (uint8) and objective value (float)
- Return type:
- relax() vrpMTZModelRel¶
A method to get linear relaxation model
- class pyepo.model.omo.vrp.vrpMTZModelRel(num_nodes: int, demands: list[float] | numpy.ndarray, capacity: float, num_vehicle: int, solver: str = 'glpk')¶
Bases:
vrpMTZModelLP relaxation of
vrpMTZModel.- solve() tuple[numpy.ndarray, float]¶
A method to solve the model — returns fractional edge selections
- relax() NoReturn¶
A forbidden method to relax MIP model
- getTour(sol: numpy.ndarray | torch.Tensor | list) list[list[int]]¶
A forbidden method to get a tour from solution