Kuifje02 / vrpy

A python framework for solving the VRP and its variants with column generation.
MIT License
173 stars 42 forks source link

Not able to understand the CVRP data and cost !! #question #105

Closed jignesh1010 closed 3 years ago

jignesh1010 commented 3 years ago

HI There

i was trying to understand the dataset prep steps. https://developers.google.com/optimization/routing/vrp

i couldnt understand the cost and distance matrix as compared to OR tool, if someone can help me understand overall matrix it would be helpful for me to solve my CVRP problem.

Thanks

Kuifje02 commented 3 years ago

In the link you provided, data['distance_matrix'][i][j] returns the distance from i to j.

In the vrpy example, the matrix has the same structure, but there are two additional nodes, the Source and the Sink. All nodes can be reached from the Source, but no node points to the Source, and vice versa for the Sink.

jignesh1010 commented 3 years ago

how to form a data matrix which is showened as input , as the cost matrix is getting shifted compared to or tools e.g and addition of source and sync cost is confusing me slightly hence couldnt progress , if you can help understanding the input data fromat or how to prepare the matrix it would be to great help @Kuifje02 i am able to understand the OR tools data formation or can create that for my e.g but not able to understand same dataset here.

Kuifje02 commented 3 years ago

Here is an example with two nodes A and B. S denotes the source and T the sink. * denotes a random number.

  S A B T
S 0 * * *
A 0 0 * *
B 0 * 0 *
T 0 0 0 0

The first column of zeros is because the Source has no predecessors. And the last line of zeros is because the Sink has no successors.

jignesh1010 commented 3 years ago

this query is resolved thanks for the update