Comment on Traveling Salesman is NP-Hard, yet Uber Eats delivery route optimization algorithms exist
foggy@lemmy.world 2 days ago
Traveling salesman doesn’t apply to Uber eats.
Just because it’s routing doent mean it’s traveling salesman.
Traveling salesman, and P vs NP is about the difficulty rapidly growing out of scope as the problem size increases.
For delivery, there are exactly 2 nodes. Pickup delivery. This problem is beyond solved, it’s childs play.
Uber eats would fail to give you the best route to hit every taco bell in America the fastest. That’s traveling salesman. It’s traveling salesman because it’s be already out of scope to simply say “find me the best route to hit 1 McDonald’s in every Continental us state.”
Azzu@lemm.ee 2 days ago
But isn’t “pick up multiple orders at a restaurant, then figuring out in which order to deliver them to minimize time spent delivering” the traveling salesman problem? I thought that’s what the post referred to.
Nemo@slrpnk.net 2 days ago
Finding the best route is NP-complete. Finding a route is trivial. Finding a pretty good route is good enough for their purposes.
Also keep in mind they’re not to much trying up find the best route between static stops as trying to minimize time between pickup and dropoff for a list of (origin, destination) pairs, constrained by staggered start times for the pickup origins. It’s fundamentally a different problem.
foggy@lemmy.world 1 day ago
That’s not really how Uber eats or similar apps work. Drivers are very rarely on more than 1 delivery at a time.
And again, until our problem size grows to a point where we cannot solve it in polynomial time, it is in P by definition.
Traveling salesman starts to evade computational time at around 20 to 30 nodes.
So because of this, as I said before, it employs a greedy heuristic to make light work on decent guesses for the problem, knowing the problem size will never get out of scope, so doing so is relatively safe.
You’re right that in theory multiple deliveries look like a tiny version of TSP, but in practice it’s nowhere near the scale that makes TSP an NP problem.