VehicleRouting¶
- class VehicleRouting(graph, num_vehicles=2, depot=0)[source]¶
Bases:
GraphOptimizationApplication
Optimization application for the "vehicle routing problem" [1] based on a
NetworkX
graph.References
[1]: "Vehicle routing problem", https://en.wikipedia.org/wiki/Vehicle_routing_problem
- প্যারামিটার:
graph (Graph | ndarray | List) -- A graph representing a problem. It can be specified directly as a NetworkX graph, or as an array or list format suitable to build out a NetworkX graph.
num_vehicles (int) -- The number of vehicles
depot (int) -- The index of the depot node where all the vehicle depart
Attributes
Getter of depot
Getter of the graph
Getter of num_vehicles
Methods
create_random_instance
(n[, low, high, seed, ...])Create a random instance of the vehicle routing problem.
draw
([result, pos])Draw a graph with the result.
interpret
(result)Interpret a result as a list of the routes for each vehicle
random_graph
(num_nodes, num_edges[, seed])- param num_nodes:
The number of nodes in a graph
sample_most_likely
(state_vector)Compute the most likely binary string from state vector.
Convert a vehicle routing problem instance into a
QuadraticProgram