Repository navigation
Does Demo solve the TSP? #7752
|
I'm trying to test the trip function from the Python API docs to see if this will work for my planned project. At the moment it seems to travel in the order you add the locations. |
Replies: 2 comments 2 replies
|
Hi @Destroyer1724! If you mean the standard map demo, its frontend uses To test the optimization for your project, call the Trip service directly. You can try this four-stop request. The response's In the Python bindings, the corresponding call is For 10 or more waypoints, Trip uses a heuristic, so it doesn't guarantee an optimal tour. |
|
It does solve it in the backend. You can try out the experimental UI for it under this link. Note that it is not yet full integrated into the demo. |
Hi @Destroyer1724! If you mean the standard map demo, its frontend uses
/route/v1, which visits stops in the order you enter them.To test the optimization for your project, call the Trip service directly. You can try this four-stop request.
The response's
waypointsarray stays in input order. Each point'swaypoint_indexgives its position in the optimized trip. The example returned[0, 2, 3, 1], meaning the visit order was input stops 1, 4, 2, 3, then back to 1.In the Python bindings, the corresponding call is
osrm_py.Trip(trip_params)withosrm.TripParameters.For 10 or more waypoints, Trip uses a heuristic, so it doesn't guarantee an optimal tour.