VROOM-Project / pyvroom

Vehicle Routing Open-source Optimization Machine
BSD 2-Clause "Simplified" License
67 stars 14 forks source link

Obtain vehicle routes #92

Open L0G1C06 opened 1 year ago

L0G1C06 commented 1 year ago

I am using the library to build a map with real addresses. I already got the solution of the best route where I use the longitude and latitude of the addresses of both vehicles and Jobs, but when I go to create the map the only addresses I have from the solution, are exactly the same as I passed. Is it possible for pyvroom to somehow return all the addresses where the algorithm passes to the best route, and not just the Job and vehicle addresses?

nilsnolde commented 1 year ago

The use of "addresses" is mildly inflationary here :smiley: Jokes aside, can you come up with a (minimal) example? I don't understand what

return all the addresses where the algorithm passes to the best route, and not just the Job and vehicle addresses?

is supposed to mean.

L0G1C06 commented 1 year ago

The addresses in question are the streets, for example, I pass to the algorithm the latitude and longitude of A and C which are two points of Job, however, knowing the route to be taken I know that it must pass through B, but I did not pass to the algorithm the coordinates of B, but I need these 3 co-coordinates to assemble my map, because I suppose the algorithm finds the best path respecting the physical aspect of the streets in reality, or does it simply draw a straight line ignoring the real physical aspect?

nilsnolde commented 1 year ago

Ahh, you want an actual route out of it. I'm not sure how you'd get that from pyvroom tbh. Upstream vroom has a -g flag for that, which means it'll automatically calculate (and return) a route for each vehicle. In worst case, you'd need to send all the vehicles' locations to the router currently.

L0G1C06 commented 1 year ago

I understand... Do you know any way I could solve this problem without necessarily needing to be using only pyvroom or vroom?

nilsnolde commented 1 year ago

Well, you already have OSRM running, that's a routing engine which computes the matrix for vroom's input and would also be used for the route computation if pyvroom supports that. So you can just use Python's requests or (making life a bit easier) https://github.com/gis-ops/routingpy, to request a route from OSRM's HTTP API.