Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you write a GAMS CODE according to these question and answer ? Thank you so much. I ONLY NEED GAMS CODES !!!! Given a

Can you write a GAMS CODE according to these question and answer ? Thank you so much.

I ONLY NEED GAMS CODES !!!!

Given a number of cities and the costs of traveling from any city to any other city, what is the cheapest round-trip route (tour) that visits each city once and then returns to the starting city? This problem is called the traveling salesperson problem (TSP). An itinerary that begins and ends at the same city and visits each city once is called a tour. Suppose there are N cities. Let cij = Distance from city i to city j (for ij) and Let cii = M (a very large number relative to actual distances) Also define xij as a 0-1 variable as follows: xij = 1 if s/he goes from city i to city j;

image text in transcribed

Xij = 0 otherwise The formulation of the TSP is: min i; Cijkij s.t. Litij = 1 for all j 2; Xij = 1 for all i Ui ; + Nxij N-1 for i #j; i, j> 1 All Xij = 0 or 1 All u; 20 The first set of constraints ensures that s/he arrives once at each city. The second set of constraints ensures that s/he leaves each city once. The third set of constraints ensure the following: Any set of xi's containing a subtour will be infeasible Any set of Xi's that forms a tour will be feasible Ui - u; + Nxij N-1 for i #j; i,j > 1 Assume N=5 Subtours: 1-5-2-1, 3-4-3 ??? Choose the subtour that does not contain city 1: u3 - U4+ 5 34 34 U4 - U3 + 5 X43 5 4 5 (X34 + X43) = 8 This rules out the possibility that X34 = X43 = 1 The formulation of an IP whose solution will solve a TSP becomes unwieldy and inefficient for large TSPs. When using branch and bound methods to solve TSPs with many cities, large amounts of computer time may be required. For this reason, heuristics, which quickly lead to a good (but not necessarily optimal) solution to a TSP, are often used. Xij = 0 otherwise The formulation of the TSP is: min i; Cijkij s.t. Litij = 1 for all j 2; Xij = 1 for all i Ui ; + Nxij N-1 for i #j; i, j> 1 All Xij = 0 or 1 All u; 20 The first set of constraints ensures that s/he arrives once at each city. The second set of constraints ensures that s/he leaves each city once. The third set of constraints ensure the following: Any set of xi's containing a subtour will be infeasible Any set of Xi's that forms a tour will be feasible Ui - u; + Nxij N-1 for i #j; i,j > 1 Assume N=5 Subtours: 1-5-2-1, 3-4-3 ??? Choose the subtour that does not contain city 1: u3 - U4+ 5 34 34 U4 - U3 + 5 X43 5 4 5 (X34 + X43) = 8 This rules out the possibility that X34 = X43 = 1 The formulation of an IP whose solution will solve a TSP becomes unwieldy and inefficient for large TSPs. When using branch and bound methods to solve TSPs with many cities, large amounts of computer time may be required. For this reason, heuristics, which quickly lead to a good (but not necessarily optimal) solution to a TSP, are often used

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

Students also viewed these Databases questions

Question

3. What would you do now if you were Mel Fisher?

Answered: 1 week ago