VehicleRouting#
- class VehicleRouting(graph, num_vehicles=2, depot=0)[ソース]#
ベースクラス:
GraphOptimizationApplication
Optimization application for the 「vehicle routing problem」 [1] based on a
NetworkX
graph.参照
[1]: 「Vehicle routing problem」, https://en.wikipedia.org/wiki/Vehicle_routing_problem
- パラメータ:
Attributes
- depot#
Getter of depot
- 戻り値:
The node index of the depot where all the vehicles depart
- graph#
Getter of the graph
- 戻り値:
A graph for a problem
- num_vehicles#
Getter of num_vehicles
- 戻り値:
The number of the vehicles
Methods
- static create_random_instance(n, low=0, high=100, seed=None, num_vehicle=2, depot=0)[ソース]#
Create a random instance of the vehicle routing problem.
- パラメータ:
n (int) – the number of nodes.
low (int) – The minimum value for the coordinate of a node.
high (int) – The maximum value for the coordinate of a node.
seed (int | None) – the seed for the random coordinates.
num_vehicle (int) – The number of the vehicles
depot (int) – The index of the depot node where all the vehicle depart
- 戻り値:
A VehicleRouting instance created from the input information
- 戻り値の型:
- draw(result=None, pos=None)#
Draw a graph with the result. When the result is None, draw an original graph without colors.
- パラメータ:
result (OptimizationResult | ndarray | None) – The calculated result for the problem
- static sample_most_likely(state_vector)#
Compute the most likely binary string from state vector.
- パラメータ:
state_vector (QuasiDistribution | Statevector | ndarray | Dict) – state vector or counts or quasi-probabilities.
- 戻り値:
binary string as numpy.ndarray of ints.
- 例外:
ValueError – if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.
- 戻り値の型: