r/AskComputerScience • u/thekeyofPhysCrowSta • Oct 31 '25
Is trick or treating an instance of the travelling salesman problem?
I want to introduce the concept of combinatorial optimization and this seems like a good way to do so.
8
Upvotes
21
u/high_throughput Oct 31 '25
No, the goal of trick or treating is to maximize candy, not minimize walking.
9
u/MasterGeekMX BSCS Oct 31 '25
If you want to make the shortest walking while going to all houses, then yes.
1
u/Traveling-Techie Nov 01 '25
It depends on how you do it.
1
u/Temporary_Pie2733 Nov 01 '25
It is, but not a terribly interesting one. Houses are usually arranged in a way that makes most paths obviously no optimal.
1
u/BidingAffectionate94 Nov 02 '25
If the goal is to maximise the amount of candy one can attain while walking the least, then sure
1
u/Competitive_Lychee28 Nov 04 '25
More similar to the orienteering problem.
Where given some limited resource e.g. time you must travel between points and gather the most value e.g. candy.
1
u/skylightrrl Oct 31 '25
Watchu mean?
0
u/Leverkaas2516 Nov 01 '25
No. In the travelling salesman problem, one is supposed to visit each location exactly once. There is no stipulation in trick or treating, as long as the kids aren't too old.