Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.29k stars 3.32k forks source link

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

Closed Hacene06 closed 2 months ago

Hacene06 commented 2 years ago

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}

datendelphin commented 2 years ago

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)

jcoupey commented 2 years ago

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

SiarheiFedartsou commented 2 months ago

Stale.