Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OR-Tools solve traveling salesman (TSP) without returning to the home node

I'm using Google Or-Tools to solve a Traveling Salesman Problem by using this example (basically I just replaced the distances matrix with mine). As in the example, I set data['depot'] = 0.

For my application it is not important to return to the first node at the end of the path. I can remove the last edge from the solution but I wonder that if I could remove this constraint altogether it might find a better path overall.

like image 421
gilad Avatar asked Sep 03 '25 06:09

gilad


1 Answers

Make sure the distance from all nodes to 0 (the depot) is null. This is equivalent to what you are asking for.

like image 59
Laurent Perron Avatar answered Sep 04 '25 18:09

Laurent Perron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!