Question: We can do better by setting up and solving a linear program. We start with a set of holes, and the horizontal and vertical coordinates
We can do better by setting up and solving a linear program. We start with a set
of holes, and the horizontal and vertical coordinates of each:
IMSE Assignment # Page
set HOLES ordered;
param hpos HOLES;
param vpos HOLES;
Given this information, we can define the set of all unique pairs of holes, and the
distance between each pair:
set PAIRS :i in HOLES, j in HOLES: ordi ordj;
param dist ij in PAIRS
: sqrthposjhposivposjvposi;
Let us define variables Use, indexed over the pairs of holes, with the idea that
Useij will be if the move between i to j is used as part of the tour, and that
Useij will be zero otherwise. Then it is easy to see that the total length of the
tour is the sum of distij Useij over all pairs of holes i and j Since we
want the tour to be as short as possible, we have:
var Use PAIRS;
minimize TourLength: sum ij in PAIRS distij Useij;
a: To force the variables Useij to correspond to a tour, we propose to add
the following constraints:
subject to VisitAll i in HOLES:
sum ij in PAIRS Useij sum ji in PAIRS Useji;
Briefly explain why, if the values of the Useij variables do not satisfy these
constraints, then they cannot possibly describe a tour.
b: For the particular holes shown in our diagram, the data values are as follows:
param: HOLES: hpos vpos :
A I
B J
C K
D L
E M
F N
G O
H P
Q ;
The model from a together with this data are posted in files holes.mod
and holes.dat. Solve the resulting linear program. Be sure you get the
optimal solution message! Use the following commands to get a concise
listing of the solution:
option displayeps ;
option omitzerorows ;
display Use;
Draw a diagram of the solution, with a solid line showing each variable that
is and a dashed line showing each variable that is Why is this solution
not useful for the holedrilling problem?
c: To try to make the linear program more useful, you can add subtour elimina
tion constraints, which say that at least two moves must connect the nodes
in any subset to the nodes not in the subset. Constraints of this kind can be
written in AMPL as follows:
IMSE Assignment # Page
param nSubtours integer;
set SUB nSubtours within HOLES;
subject to SubtourElimination k in nSubtours:
sum i in SUBk j in HOLES diff SUBk
if ij in PAIRS then Useij else Useji;
You can see that in your diagram there is only one move connecting the nodes
in subset L M N P Q to the other nodes. Here is data for the subtour
elimination constraint for this set:
param nSubtours : ;
set SUB : L M N P Q ;
Add these lines to the given model and data files, producing files holesmod
and holesdat.
Solve and diagram the result. You should find that the variables are now all
or but that the solution is composed of three separate tours, through three
separate subsets of nodes. What are these subsets?
d: Add three more subtour elimination constraints to holesdat, corresponding
to the three subtours in the solution, and solve again. What subtours do you
find now?
e: Continue adding subtour elimination constraints to holesdat until you find
a solution that has no subtours or fractional variables. Diagram this optimal
tour. Were there any optimal tours among those that you found earlier in
this assignment? model file:set HOLES ordered;
param hpos HOLES;
param vpos HOLES;
set PAIRS :i in HOLES, j in HOLES: ordi ordj;
param dist ij in PAIRS
: sqrthposjhposivposjvposi;
var Use PAIRS;
minimize TourLength: sum ij in PAIRS distij Useij;
subject to VisitAll i in HOLES:
sum ij in PAIRS Useij sum ji in PAIRS Useji;
data file: param: HOLES: hpos vpos :
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
