osrm-backend
osrm-backend copied to clipboard
solve Traveling Salesman Problem to get the shortest path (according to distance only)
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}
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)
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