RoutingInstance¶
- class RoutingInstance(name='', comment='', problem_type='CVRP', dimension=0, capacity=0, n_vehicles=1, coords=<factory>, demands=<factory>, depot=0, cost_matrix=<factory>, optimal_cost=None)[source]¶
Bases:
objectParsed VRP/TSP instance data.
- Variables:
name – Instance name from the file header.
comment – Instance comment (may contain optimal cost).
problem_type –
"CVRP"or"TSP".dimension – Total number of nodes (including depot).
capacity – Vehicle capacity (CVRP only, 0 for TSP).
n_vehicles – Number of vehicles (extracted from name
-kNpattern or from comment, 1 for TSP).coords – Node coordinates, shape
(dimension, 2).demands – Node demands, shape
(dimension,). Depot demand is 0.depot – Depot node index (0-based).
cost_matrix – Euclidean distance matrix, shape
(dimension, dimension).optimal_cost – Optimal cost from comment, if available.
Attributes Summary
Number of customers (excluding depot).
Attributes Documentation
- n_customers¶
Number of customers (excluding depot).