reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
331 stars 68 forks source link

routing matrix order #84

Closed jotel96 closed 1 year ago

jotel96 commented 1 year ago

Hi, I've got a question to a possible bug regarding the order for the routing matrix: I got a problem that has locations in the following order: Job A Job B Shift End C Shift Start D

In the documentation it says "Both durations and distances are mapped to the list of unique locations generated from the problem definition. In this list, locations are specified in the order they defined", so in my undersstanding the routing matrix should be build like this: [0, AB, AC, AD, BA, , BC, BD, CA, CB, 0, CD, DA, DB, DC, 0]

But it seems like the routing matrix expects the shift start location before the end, so it has to look like this: [0, AB, AD, AC, BA, , BD, BC, DA, DB, 0, DC, CA, CB, CD, 0]

Can you confirm, that this is how it works and wheather this is how it is intended to work or if it is a bug?

reinterpretcat commented 1 year ago

Hi,

I guess you're referring to order in your json definition. The solver parses vehicle start/end locations in specific order which is independent from original json definition:

https://github.com/reinterpretcat/vrp/blob/master/vrp-pragmatic/src/format/coord_index.rs#L21-L62

Here, start is parsed before end location.

I would recommend to use get_locations method/command to get list of locations which will correspond to expected matrix order:

vrp-cli solve pragmatic problem.json --get-locations -o locations.json

jotel96 commented 1 year ago

Alright, thank you for your quick reply. Maybe you could add that to the documentation, just so nobody else gets confused about this.