optymus.routing.solve_vrp¶
- optymus.routing.solve_vrp(distance_matrix=None, coordinates=None, demands=None, vehicle_capacity=None, num_vehicles=None, depot=0, method='savings', max_iter=100, verbose=True)[source]¶
Solve a Capacitated Vehicle Routing Problem.
Convenience function that creates a
VRPSolverand callssolve().- Parameters:
distance_matrix (array-like, shape (n, n), optional) – Pairwise distance/cost matrix. Provide this OR
coordinates.coordinates (array-like, shape (n, 2), optional) – Node coordinates (Euclidean distances computed automatically).
demands (array-like, shape (n,)) – Demand at each node.
demands[depot]should be 0.vehicle_capacity (float) – Maximum load per vehicle.
num_vehicles (int, optional) – Number of vehicles. If None, uses the minimum feasible.
depot (int) – Index of the depot node (default 0).
method (str) – Algorithm:
"savings"(Clarke-Wright + 2-opt).max_iter (int) – Maximum local-search improvement rounds.
verbose (bool) – Print progress information.
- Return type:
OptimizeResult