(and Continuous) Optimization Solutions of Exercises 2 WI4 131

Discrete (and Continuous) Optimization
Solutions of Exercises 2
WI4 131
Kees Roos
Technische Universiteit Delft
Faculteit Electrotechniek, Wiskunde en Informatica
Afdeling Informatie, Systemen en Algoritmiek
e-mail: [email protected]
URL: http://www.isa.ewi.tudelft.nl/˜roos
November – December, A.D. 2003
Course Schedule
1. Formulations (18 pages)
2. Optimality, Relaxation, and Bounds (10 pages)
3. Well-solved Problems (13 pages)
4. Matching and Assigments (10 pages)
5. Dynamic Programming (11 pages)
6. Complexity and Problem Reduction (8 pages)
7. Branch and Bound (17 pages)
8. Cutting Plane Algorithms (21 pages)
9. Strong Valid Inequalities (22 pages)
10. Lagrangian Duality (14 pages)
11. Column Generation Algorithms (16 pages)
12. Heuristic Algorithms (15 pages)
13. From Theory to Solutions (20 pages)
Optimization Group
1
Exercise 2.8.1
We are asked to find a maximum cardinality matching in the graph left below.
Solution: The edges colored red in the right figure form a matching of cardinality 5. The
green nodes form a covering by nodes of cardinality 5. Since the cardinalities are the same,
the matching has maximal cardinality.
Optimization Group
2
Exercise 2.8.2
Let G = (V, E) be a graph. A stable set in G is a set of nodes S ⊆ V such that there
are no edges between any two nodes in S . A clique in G is a set of nodes C ⊆ V such that
there is an edge between any two nodes in C . Show that the problem of finding a maximal
cardinality stable set is dual to the problem of finding a minimum cover by cliques of the
edges. Use this observation to find bounds on the maximum size of a stable set in the graph
shown below.
Solution: Let C = {C1, C2, . . . , Ck } be a set of
5
6
7
10
cliques such that all edges of G belong to one the cliques
Ci. Then, if S is a stable set, none of the cliques contains
1
4
12
8
9
more than 1 point of S . Hence, |S| ≤ k. Thus every
2
3
15
14
13
11 covering of the edges by cliques provides an upper bound
for the size of a stable set in G.
In the above graph, the largest cliques have size 3; there are 4 of such cliques and they contain
together 10 edges. These 10 edges are colored red. 9 other edges are covered by these 4
cliques, these edges are colored magenta. The remaining 4 edges are covered by 2 cliques if
size 2 (with the green edges). So we have found a covering by 6 cliques of the edges.
The set S = {2, 4, 8, 9, 11, 15} is a stable set of size 6. The bound is tight!
Optimization Group
3
Exercise 2.8.3
Find primal and dual bounds for the integer knapsack problem:
z = max 42x1 +26x2 +35x3 +71x4 +53x5
14x1 +10x2 +12x3 +25x4 +20x5 ≤ 69
x ∈ {0, 1}5
Solution: We obtain an dual (i.e., upper) bound by solving the linear relaxation. The solution
of the linear relaxation takes x1 = 69
14 and xi = 0 for i = 2, . . . , , 5, because the quotient
ci
69 = 207.
is
maximal
for
i
=
1
.
This
yields
the
upper
bound
42
a
14
i
A primal (i.e, lower) bound is provided by any feasible solution. One may easily verify that
x = (4, 0, 1, 0, 0) is feasible, which gives the lower bound 42.4 + 35 = 203.
Optimization Group
4
Exercise 2.8.4
Consider the 0-1 IP problem
(P1)


max cT x :
n
X

j=1


n
X


aij xj = bi, i = 1, . . . , m, x ∈ {0, 1}n ,

and the 0-1 equality knapsack problem
(P2)
max cT x :

j=1


n
X
i=1

uiaij  xj =
n
X
i=1
where u ∈ Rm. Show that (P2) is a relaxation of (P1).


uibi, x ∈ {0, 1}n ,

Pn
Solution: Suppose that x is feasible for (P1). Then we have j=1 aij xj = bi for i =
Pn
1, . . . , m. Hence, for each ui ∈ R we have ui j=1 aij xj = uibi for i = 1, . . . , m.
P
Pn
Pn
n
Taking the sum over all i, we obtain j=1
i=1 ui aij xj = i=1 uibi , showing that x
is feasible for (P2). Since (P1) and (P2) have the same objective function, this proves that
(P2) is a relaxation of (P1).
Optimization Group
5
Exercise 2.8.5
Consider the equality knapsack problem
7
2
5
5
19
8
(P1) max cT x : x1 − x2 + x3 −
x4 +
x5 = , x ∈ Z5+ .
4
3
2
12
6
3
Show that
(P2 )
3
1
1
7
1
2
x4 + x5 = + ω, x ∈ Z5 , ω ∈ Z+ .
max cT x : x1 + x2 + x3 +
4
3
2
12
6
3
is a relaxation of (P1) and that
3
1
1
7
1
2
(P3 ) max cT x : x1 + x2 + x3 +
x4 + x5 ≥ , x ∈ R5 .
4
3
2
12
6
3
is a relaxation of (P2).
Solution: Suppose that x is feasible for (P1). Since x is integral we then have
2
5
5
19
8
7
x1 + −
x2 +
x3 + −
x4 +
x5 ≤
.
4
3
2
12
6
3
This gives x1 − x2 + 2x3 − x4 + 3x5 ≤ 2, or, equivalently,
x1 − x2 + 2x3 − x4 + 3x5 = 2 − ω,
ω ∈ Z+ .
Subtracting this from the constraint in (P1) it follows that x satisfies the constraint in (P2). So (P2) is a
relaxation of (P1). On the other hand, if x is feasible for (P2) it is obvious that x satisfies the constraint in
(P3 ). So (P3) is a relaxation of (P2).
Optimization Group
6
Exercise 2.8.6
Consider a digraph G = (V, A) with arc lengths ce ≥ 0 for e ∈ A. Taking two distinct
nodes s, t in V , consider the problem of finding a shortest path from s to t. Show that
n
z = max πt : πj − πi ≤ cij for
e = (i, j) ∈ A, π ∈ R|V |, πs = 0
o
is a strong dual problem.
Solution: If x ∈ R|A| is the incidence vector of a path P = s = v0 → v1 → . . . →
vk = t from s to t, and π is feasible for the above problem, we may write
ℓ(P ) =
X
(i,j)∈A
xij cij =
X
(i,j)∈P
cij ≥
X
(i,j)∈P
πj − πi = πt − πs = πt ,
proving that both problems form a weakly dual pair. As a consequence we have ℓ(P ) ≥ z .
On the other hand, for each v ∈ V , let pv denote the length of a shortest path from s to v .
Obviously, ps = 0, and pj ≤ pi + cij for each arc (i, j) ∈ A. Hence p is feasible for the
above problem, whence pt ≤ z . Thus we have pt ≤ z ≤ ℓ(P ) for any s-t path P . If P is a
shortest s-t path then pt = ℓ(P ) and hence z = ℓ(P ), proving that both problems form a
strongly dual pair.
Optimization Group
7
Exercise 2.8.7
Apply a greedy heuristic to the instance of the UFL problem with m = 6 clients and n = 4
depots, and costs as shown below:





(cij ) = 




6
1
15
9
7
4
2
9
2
11
23
3
3
4
6
4
2
1

4

11 

3 

8 

9 

5
and
(fj ) = (21, 16, 11, 24).
Solution: Let N = {1, 2, 3, 4} denote the set of depots. Let us assign each client to each
cheapest depot. Then we need to open depot 1 to serve client 2 (cost 1 + 21 = 22), depot
2 to serve clients 1 and 3 (cost 2 + 2 + 16 = 20), and depot 3 to serve clients 4, 5 and
6 (cost 4 + 2 + 1 + 11 = 18). Total cost 22 + 20 + 18 = 60.
We proceed by applying simple interchanges. If we close depot 1, client 2 is most cheaply
served by the already open depot 3, which decreases the total cost to 60 − 22 + 4 = 42.
Closing also depot 2, clients 1 and 3 can also be served by depot 3: the serving costs
increase with 1 + 4 = 5, but the facility costs decrease with 16, yielding the total cost
42 − 16 + 5 = 31. This is our greedy solution.
Optimization Group
8
Exercise 2.8.8
Define greedy and local search heuristics for the maximum cardinality stable set problem.
Solution: Starting with S = ∅, we add to S a node v with smallest degree. Then we remove from G node v
and all of its neighbors (and the edges connected to these nodes). In the remaining graph we look for a node
with smallest degree, add this node to S , remove this node and all of it neighbors, and so on until the remaining
graph is empty.
By way of example we apply this heuristic to the graph of Exercise 2.8.2:
5
6
1
4
12
2
3
15 14
S = {1}
5
7
8
5
9
6
12
13
6
12
10
11
3
7
8
10
5
9
15 14
13
S = {1, 14}
6
12
11
3
7
8
10
9
15
S = {1, 11, 14}
11
5
8
9
3
15
S = {1, 9, 11, 14}
12
8
3
15
S = {1, 8, 9, 11, 14}
12
3
15
S = {1, 3, 8, 9, 11, 14}
In this example the greedy heuristic yields a stable set of maximum size!
A local search heuristic is the following: Given a stable set that cannot be extended, remove one of its elements
and find out if the resulting stable set can be extended to a stable set by adding two nonadjacent elements not
yet in this set.
Optimization Group
9
Exercise 2.8.9
Formulate the maximum cardinality matching problem of Exercise 2.8.1 as an integer problem
and solve its linear programming relaxation. Find a maximum weight matching for the weights
shown. Check that the linear progamming relaxation has an integral solution.
1 9
4
6
7
2
3
1’
3
2’
4’
Edge
5’
7
6 6
j=1
3’
5
5 2
i=1
For the maximum cardinality problem we take cij = 1 for all arcs, and for the
maximum weight matching the indicated weights. The model is solved by using the
LO solver MOSEK. The result is as follows:
3
4 1
Solution: We use decision variables xij , 1 ≤ i, j ≤ 6. An IP formulation is


n
n


X
X
T
max c x :
xij ≤ 1,
xij ≤ 1, xij ∈ {0, 1}


6’
1
1
2
2
2
3
3
4
5
6
6
3′
5′
2′
4′
5′
1′
6′
3′
5′
5′
6′
Cardinality matching
1
0
1
0
0
1
0
0
1
0
1
Weighed matching
1
0
1
0
0
1
0
0
1
0
1
i
j′
:
It turns out that the solution of the linear relaxation is the same in both cases, and
also that it is integral.
Optimization Group
10