Help in Modeling travelling salesman problem.

Problems with modeling
Post Reply
thegorila78
User
User
Posts: 2
Joined: 2 months ago

Help in Modeling travelling salesman problem.

Post by thegorila78 » 2 months ago

I am having trouble modeling the last constraint for this TSP model. I have the first 3 constraints modeled properly but the last one I can't figure out how to model in GAMS. I attached my code and a screenshot of the constraints. Specifically the last one requires me to keep track of a subset in GAMS and I am confused about how to do that. Any help would be appreciated.
Attachments
Screen Shot 2019-03-12 at 8.44.22 PM.png
hw6-1.gms
Travelling salesman problem
(1.12 KiB) Downloaded 8 times

User avatar
bussieck
Moderator
Moderator
Posts: 284
Joined: 2 years ago

Re: Help in Modeling travelling salesman problem.

Post by bussieck » 2 months ago

Since there are exponentially many subtours (subsets of {2..n}) you would not do this explicitly. For small n you would use the compact MTZ formulation (see https://www.gams.com/latest/gamslib_ml/ ... _tsp5.html). For larger instances you should generate the subtour constraints that are needed using an iterative approach, see tsp1*tsp4 in the GAMS Model Library (https://www.gams.com/latest/gamslib_ml/ ... _tsp1.html). For very large (and pure) TSP problems you would use a special purpose solver (not part of GAMS) like Concorde (http://www.math.uwaterloo.ca/tsp/concorde.html).

-Michael

thegorila78
User
User
Posts: 2
Joined: 2 months ago

Re: Help in Modeling travelling salesman problem.

Post by thegorila78 » 2 months ago

bussieck wrote:
2 months ago
Since there are exponentially many subtours (subsets of {2..n}) you would not do this explicitly. For small n you would use the compact MTZ formulation (see https://www.gams.com/latest/gamslib_ml/ ... _tsp5.html). For larger instances you should generate the subtour constraints that are needed using an iterative approach, see tsp1*tsp4 in the GAMS Model Library (https://www.gams.com/latest/gamslib_ml/ ... _tsp1.html). For very large (and pure) TSP problems you would use a special purpose solver (not part of GAMS) like Concorde (http://www.math.uwaterloo.ca/tsp/concorde.html).

-Michael
How would I do this the naive way? Like by running the model over and over again until I got a solution.

Thanks for the response!

User avatar
bussieck
Moderator
Moderator
Posts: 284
Joined: 2 years ago

Re: Help in Modeling travelling salesman problem.

Post by bussieck » 2 months ago

Look at this post: viewtopic.php?f=9&t=10428&p=24102. Here all subsets of a set are generated via the powerSetRight operator. That should help you doing it in the naive way.

-Michael

Post Reply