osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

solve Traveling Salesman Problem to get the shortest path (according to distance only)

Open Hacene06 opened this issue 3 years ago • 2 comments

To solve the Traveling Salesman Problem, the existing API return the fastest path (distance/time).

but I need to have the shortest path with only distance.

how can I get it ?

api url: /trip/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}

Hacene06 avatar Jan 04 '22 12:01 Hacene06

Just change the profile to use a single speed for everything. Depending on your requirements, also set all turn penalties to 0. (you need to run your own instance with this modified profile)

datendelphin avatar Jan 04 '22 12:01 datendelphin

Alternatively you can adjust the weight_name in the profile to route on distance only:

https://github.com/Project-OSRM/osrm-backend/blob/1e70b645e480946dad313b67f6a7d331baecfe3c/profiles/car.lua#L19-L23

jcoupey avatar Jan 04 '22 14:01 jcoupey