Discrete Programming
Andongwisye John
Linkoping University
April 14, 2015
Andongwisye John (Linkoping)
Short title
April 14, 2015
1 / 19
6.4 Formulating Asymmetric TSP
Asymmetric TSP is defined on a directed networks in which travels
are allowed only in the directions specified.
The problem is to find a directed tour with a minimal distance.
This section presents the formulation of asymmetric TSP as a 0 − 1
integer program.
All of IP formulations in this chapter are based on the assignment
problem.
We follow the modeling procedure described in chapter 2. Although
any city can be a starting city, for simplicity we assume it is city 1.
Andongwisye John (Linkoping)
Short title
April 14, 2015
2 / 19
6.4 Formulating Asymmetric TSP . . .
Step 1
(i)Input parameters: All directed arcs (i, j) and
associated distances (cij )
(ii) Decision variables: whether or not each directed
arc (i, j) is in the tour (yij = 1 or 0)
(iii) Constraints: each city j must be entered exactly
once, each city i must be exited exactly once. a tour
that starts from a starting city must travel exactly n − 1
cities and return to the city, and no subtours are allowed
total distance traveled on a tour must be minimum.
Andongwisye John (Linkoping)
Short title
April 14, 2015
3 / 19
6.4 Formulating Asymmetric TSP . . .
Step 2. The asymmetric can be formulated as
X
minimize
cij yij
(1)
(i,j)∈A
subject to
X
yij = 1 for all cities j = 1 to n
(2)
yij = 1 for all cities j = 1 to n
(3)
{i:(i,j)∈A}
X
{j:(i,j)∈A}
yij = 0 or 1 for all arcs (i, j) ∈ A
(4)
A set of subtour elimination constraints
Constraints 2 ensure that each city j must be entered exactly once.
Constraints 3 ensure that each city i must be exited exactly once.
Note that equations 1-4 correspond to the classical assignment
problem.
Andongwisye John (Linkoping)
Short title
April 14, 2015
4 / 19
6.4 Formulating Asymmetric TSP . . .
However, any solution satisfying 2-4 is not sufficient to define a tour
because it may also define some disjoint subtours. Example n = 6
The solution y12 = y25 = y51 = y43 = y36 = y64 = 1 (and yij = 0 for
all others) satisfies constraints 2-4, but forms two disjoint subtours:
1 → 2 → 5 → 1 and 3 → 6 →→ 3 as shown in Figure 6.7
Thus, the assignment problem is a relaxation of the TSP, and the
TSP is restriction of the assignment problem.
Many existing IP formulations for the TSP are relaxations of
assignment problem. Their difference is in their formulation of
subtour elimination constraints.
Andongwisye John (Linkoping)
Short title
April 14, 2015
5 / 19
6.4.1 Subtour Elimination By Dantzig-Fulkerson-Johnson
Constraints
This subtour elimination scheme is based on the fact that for every
tour or subtour, the number of nodes must be equal to the number of
arcs.
Therefore, to prevent from forming subtours but allow forming a tour,
the number of arcs must be less than the number of cities for every
subset that consists of 2 to n − 1 cities.
Mathematically
XX
yij ≤ |S| − 1 for all subsets |S| = 2, 3, ..., n − 1
(5)
i∈S j∈S
where S is a nonempty proper subset of all nodes V and |S| is the
number of cities in S. The total number of constraints in (5) is nearly
2n possible subsets for n cities.
Andongwisye John (Linkoping)
Short title
April 14, 2015
6 / 19
6.4.1 Subtour Elimination By Dantzig-Fulkerson-Johnson
Constraints . . .
Consider the following figure
For example,
P the
P subtour 1 → 2 → 5 → 1 colud not be satisfied
because i∈S j∈S yij = y12 = y25 = y51 = 3, |S| − 1 = 2 and thus
the corresponding constraint in (5) would be violated. Likewise, the
subtour 3 → 6 →→ 3 would also violate a constraint in (5)
Andongwisye John (Linkoping)
Short title
April 14, 2015
7 / 19
6.4.2 Subtour Elimination by Miller-tucker-Zemlin(MTZ)
constraints
Consider that a tour is just a sequence of all cities.
If we define uj as the sequence number of city j in a tour, we obtain
the following set of subtour elimination constraints:
ui − uj + nyij ≤ n − 1 for (i, j) ∈ A, i 6= 1, j 6= 1, j 6= i
(6)
Consider the second subtour in figure 6.7, for example. We have
y36 = y64 = y43 = 1
because city 3 is the first city in sequence, we have u3 = 1, u6 = 2
and u4 = 3
Andongwisye John (Linkoping)
Short title
April 14, 2015
8 / 19
6.4.2 Subtour Elimination by Miller-tucker-Zemlin(MTZ)
constraints . . .
From 6.6, we obtain three corresponding constraints:
u3 − u6 + 6y36 = 1 − 2 + 6 = 5 ≤ 5 (satisfied)
u6 − u4 + 6y64 = 2 − 3 + 6 = 5 ≤ 5 (satisfied)
u4 − u1 + 6y43 = 3 − 1 + 6 = 8 > 5 (violated)
Now if there is a set of yij ’ that does not contain a subtour, then we
can define a set of ui ’s, starting from city , that does not violate any
constraint in 6.6
Let ui = k indicate that city i is the kth city visited in the tour, where
k = 2, 3, ..., n
If yij = 1, we then have uj = k + 1 and the left-hand side of 6.6 is
ui − uj + nyij = k − (k + 1) + n = n − 1
(7)
which satisfies the right hand side of (6.6) for every k.
Andongwisye John (Linkoping)
Short title
April 14, 2015
9 / 19
6.4.2 Subtour Elimination by Miller-tucker-Zemlin(MTZ)
constraints . . .
If yij = 0 and uj = k 0 (k∗ = 2, 3, ..., n, k 0 6= k + 1), then the left hand
side of (6.6) is
ui − uj + nyij = ui − uj = k − k 0
Clearly, the largest difference for k-k’ occurs when k = n and k 0 = 2,
which is n − 2 < n − 1.
We have shown that (6.6) can be satisfied for all cases of yij = 1 and
yij = 0 if no subtours are involved.
For example consider a tour of 1 → 2 → 4 → 5 → 3 → 6 → 1 for the
above six city problem
We have y12 = y24 = y45 = y53 = y36 = y61 = 1, and set
u1 = 1, u2 = 2, u4 = 3, u5 = 4, u3 = 5 and u6 = 6
Check the corresponding constraints in (6.6) for i 6= 1 and j 6= 1
Andongwisye John (Linkoping)
Short title
April 14, 2015
10 / 19
6.4.2 Subtour Elimination by Miller-tucker-Zemlin(MTZ)
constraints . . .
y24 = 1, u2 − u4 + 6y24 = 2 − 3 + 6 = 5
y45 = 1, u4 − u5 + 6y45 = 3 − 4 + 6 = 5
y35 = 1, u5 − u3 + 6y53 = 4 − 5 + 6 = 5
y36 = 1, u3 − u6 + 6y36 = 4 − 5 + 6 = 5
which satisfy all the constraints in (6.6). Next, we consider
y23 = y25 = y43 = y64 = 0 Which also satisfy all the constraints
y23 = 0, u2 − u3 + 6y23 = 2 − 5 = −3 < 5
y25 = 1, u2 − u5 + 6y25 = 2 − 4 = −2 < 5
y43 = 1, u4 − u3 + 6y43 = 3 − 5 = −2 < 5
y64 = 1, u6 − u4 + 6y64 = 6 − 3 = 3 < 5
Andongwisye John (Linkoping)
Short title
April 14, 2015
11 / 19
6.4.2 Subtour Elimination by Miller-tucker-Zemlin(MTZ)
constraints . . .
The above two formulations for TSP show that the computability of
IP reverses the rule of the computability of LP-the computational
time increases as the number of constraints increases
Therefore, any attempts to finding compact IP formulations with a
small number of constraints are often counterproductive for efficiently
solving large-scale TSP
Andongwisye John (Linkoping)
Short title
April 14, 2015
12 / 19
6.5 FORMULATING SYMMETRIC TSP
The symmetric traveling salesman problem is defined on an
undirected network in which travel is allowed in either direction of
each undirected arc or edge.
The problem is to find an undirected tour with minimal traveling
distance.
To formulate the symmetric TSP, one must note that cij = cji and
yij = yji
Thus each edge can be identified by single index k, each decision
variable by yk , and each distance by ck
As a result, the symmetric problem can be formulated with only
one-half the number of 0 − 1 variable as required in the asymmetric
problem.
To find a tour in an undirected network G (E , A), one must select a
subset of undirected arcs such that every node j is connected to
exactly two of the undirected arcs selected.
As in the asymmetric problem, the symmetric problem requires
additional constraints to eliminate all subtours, but not any tour
Andongwisye John (Linkoping)
Short title
April 14, 2015
13 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
Step 1
(i)Input parameters: a list of all undirected arcs
indexed by k and their associated distances, ck (i, j)
(ii) Decision variables: whether or not each undirected
arc k is in the tour (yk = 1 or 0)
(iii) Constraints: each city in the tour must have
exactly two undirected arcs incident to it, and all
subtours must be eliminated
(iv) Objective: total distance traveled in a tour must
be minimal.
Andongwisye John (Linkoping)
Short title
April 14, 2015
14 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
Let E be a set of all undirected arcs, Ej be the set of all undirected
arcs connected to city j, and Es be the set of all undirected arcs
connecting the cities in any proper subset S
Also let yk = 1 if undirecetd arc k ∈ E is in the tour, and yk = 0
otherwise.
Then the symmetric TSP can be formulated as a 0 − 1 integer
program:
n
minimize
1XX
ck yk
2
(8)
j=1 k∈Ej
subject to
X
yk = 2 for all cities j = 1.2, ..., n
(9)
k∈Ej
X
yj ≤ |S| − 1 for all |S| = 2, 3, ..., n − 2
(10)
j∈Es
yj = 1 or 0 for all j ∈ E
Andongwisye John (Linkoping)
Short title
(11)
April 14, 2015
15 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
constraint (9) ensure that every node in the tour must have exactly
two undirected arcs connected to it.
As in the asymmetric case, (10) is a set of subtour elimination
constraints equivalently to (5).
Consider the undirected network given in Figure 6.8 that has 7 cities
and 11 undirected arcs labeled by k = 1, 2, ..., 11
the solutions y1 = y2 = y8 = y6 = y4 = y10 = y11 = 1 and
y3 = y5 = y7 = y9 = 0 satisfy constraints in (9) but not in (10)
Andongwisye John (Linkoping)
Short title
April 14, 2015
16 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
As a result, we obtain two disjoint subtours, 1 − 2 − 4 − 5 − 1 and
3 − 6 − 7 − 3 as shown in Figure 6.9
FirsT, we examine the subtour 1 − 2 − 4 − 5 − 1 using constraints (9)
and (10)
S = {1, 2, 4, 5}, |S| = 4
E1 = {1, 2, 7}, E2 = {2, 8, 3, 9}, E4 = {6, 7, 8, 5}, E5 = {1, 6}
Andongwisye John (Linkoping)
Short title
April 14, 2015
17 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
The corresponding constraints in (9) are
X
for j = 1,
yk = y1 + y2 + y7 = 2
k∈E1
for j = 2,
X
yk = y2 + y8 + y3 + y9 = 2
k∈E1
for j = 4,
X
yk = y6 + y7 + y8 + y5 = 2
k∈E1
for j = 5,
X
yk = y1 + y6 = 2
k∈E1
which satisfy all the constraints in (9)
Next we examine the constraints in (10). We have
Es = {1, 2, 6, 7, 8}
y1 = y2 = y6 = y8 = 1
y7 = 0
Andongwisye John (Linkoping)
Short title
April 14, 2015
18 / 19
6.5 FORMULATING SYMMETRIC TSP . . .
Thus, the left-hand side of (10) is
X
yj = y1 + y2 + y6 + y7 + y8 = 4
j∈Es
But the right hand side of (10) is
|S| − 1 = 4 − 1 = 3
Hence, a constraint (10) is violated and the subtour 1 − 2 − 4 − 5 − 1
can not happen.
Likewise, we can show that the subtour 3 − 6 − 7 − 3 and all other
subtour can not occur because each subtour would violate a
constraint (10)
Andongwisye John (Linkoping)
Short title
April 14, 2015
19 / 19
© Copyright 2026 Paperzz