lecture 3: totally unimodularity and network flowsocw.nctu.edu.tw/course/ip002/lecture_ip3.pdf ·...

27
Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties of Easy Problems I Totally Unimodular Matrix I Minimum Cost Network Flows I Dijkstra Algorithm for Shortest Path Problem I Ford-Fulkerson Algorithm for Max-flow Problem I Minimum Spanning Tree and Minimum Steiner Tree 1 / 27

Upload: others

Post on 06-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Lecture 3: Totally Unimodularity and Network Flows

(3 units)

Outline

I Properties of Easy Problems

I Totally Unimodular Matrix

I Minimum Cost Network Flows

I Dijkstra Algorithm for Shortest Path Problem

I Ford-Fulkerson Algorithm for Max-flow Problem

I Minimum Spanning Tree and Minimum Steiner Tree

1 / 27

Page 2: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Properties of Easy Problems

I Consider a graph G = (V ,E ) with n nodes and m edges(m ≥ n). An algorithm for the graph is efficient if thealgorithm requires O(mp) elementary calculations in the worstcase.

I Separation Problem. For COP problemmax{cT x | x ∈ X ⊆ Rn}. Given x∗ ∈ Rn, is x∗ ∈ conv(X )? Ifnot, find a cutting plane: πT x ≤ π0, separating X and x∗.

I Four properties for an easy problem:

(P) max{cT x | x ∈ X}.

2 / 27

Page 3: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Efficient optimization property: there exists an efficientalgorithm for (P).

I Strong duality property: there exists a strong dual problem

(D) min{ω(u) | u ∈ U},

with which we can check the optimality condition quickly:x∗ ∈ X is optimal to (P) iff there exists u∗ ∈ U withcT x∗ = ω(u∗).

I Efficient separation property: there exists an efficientalgorithm for the associated separation problem.

I Explicit convex hull property: A compact description ofconv(X ) is known. So (P) is equivalent to linear program:

max{cT x | x ∈ conv(X )}.

3 / 27

Page 4: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Totally Unimodular Matrix

I Consider the linear integer programming:

(IP) min cT x

s.t. Ax ≤ b

x ≥ 0, x integer.

I Let X = {x | Ax ≤ b, x ∈ Zn+}. Consider the following linear

program:

(LP) min cT x

s.t. Ax ≤ b, x ∈ Rn+.

I Question: When are the extreme points of the feasible region(polyhedron) in (LP) all integral?

4 / 27

Page 5: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Sufficient condition: If the optimal basis B of (A, I ) satisfiesdet(B) = ±1, then (LP) is equivalent to (IP).(A, I ) = (B,N), the optimal solution of (LP): x∗ = (B−1b, 0).Cramer’s rule: B−1 = B∗/det(B), where B∗ is the adjointmatrix with entries being products of terms of B.

I Totally unimodular matrix: A matrix A is TU if every squaresubmatrix of A has determinant +1, −1 or 0.

I If A is TU, then aij ∈ {+1,−1, 0}.I A is TU if and only if

I AT is TU; orI (A, I ) is TU.

5 / 27

Page 6: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I A useful sufficient condition for TU: A is TU if(i) aij ∈ {+1,−1, 0};(ii)

∑mi=1 |aij | ≤ 2;

(iii) ∃ partition (M1,M2) of rows {1, 2, . . . ,m} such that eachcolumn j containing two nonzero coefficients satisfies∑

i∈M1aij =

∑i∈M2

aij .Proof: Assume that A is not TU and let B be the smallestsquare submatrix of A for which deta(B) 6= 0, 1,−1. Bcannot contain a column with a single nonzero entry(otherwise B would not be minimal). So B contains twononzero entries in each column. Adding the rows in M1 andsubtracting the rows in M2 gives the zero vector and sodet(B) = 0, a contradiction.

I The linear program max{cT x | Ax ≤ b, x ∈ Rn+} has an

integral optimal solution for all integral b for which it has afinite optimal value iff A is TU.

I Strong duality, explicit convex hull and efficient separationproperties all holds when A is TU.

6 / 27

Page 7: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Minimum cost network flows

I A digraph G = (V ,A) with arc capacity hij (integer), for(i , j) ∈ A, demand bi at node i ∈ V , unit flow cost cij for(i , j) ∈ A.

min∑

(i ,j)∈A

cijxij

s.t.∑

k∈V +i

xik −∑

k∈V−i

xki = bi , i ∈ V

0 ≤ xij ≤ hij , xij integer.

7 / 27

Page 8: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I An example with 6 nodes and 11 arcs.

1

2 3

6

4 5

3

2

4

5

0

0

Figure: A digraph G with 6 nodes and 11 arcs

8 / 27

Page 9: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I The node-arc adjacent matrix of G :

x12 x14 x23 x31 x32 x35 x36 x45 x51 x53 x65 b

1 1 1 0 −1 0 0 0 0 −1 0 0 =32 −1 0 1 0 −1 0 0 0 0 0 0 =03 0 0 −1 1 1 1 1 0 0 −1 0 =04 0 −1 0 0 0 0 0 1 0 0 0 =−25 0 0 0 0 0 −1 0 −1 1 1 −1 =46 0 0 0 0 0 0 −1 0 0 0 1 =−5

I The constraint in Minimum Cost Flow Problem is TU.

I If the demands bi and the capacities hij are integral, theneach extreme point is integral. The constraints describe theconvex hull of the integer feasible flow.

9 / 27

Page 10: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Shortest path. Given two nodes s, t ∈ V and nonnegative arccosts cij for (i , j) ∈ A, find a minimum cost flow from s to t.

min∑

(i ,j)∈A

cijxij

s.t.∑

k∈V +i

xik −∑

k∈V−i

xki = 1, i = s

k∈V +i

xik −∑

k∈V−i

xki = 0, i ∈ V \ {s, t}

k∈V +i

xik −∑

k∈V−i

xki = −1, i = t

xij ∈ Z+, (i , j) ∈ A.

I Theorem: z is the length of a shortest s − t path iff thereexist πi for i ∈ V such that πs = 0, πt = z and πj − πi ≤ cij

for (i , j) ∈ A.

10 / 27

Page 11: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Proof. The dual of the shortest path problem is:

max πt − πs

s.t. πj − πi ≤ cij , (i , j) ∈ A.

Replacing πj by πj + α for all j ∈ V does not change the dualvalue, we can fix πs = 0. The theorem is true by the strongduality (because of TU).

I Maximum flow problem. Given two nodes s, t ∈ V andnonnegative arc capacities hij for (i , j) ∈ A, find a maximumflow from s to t.

I Adding a backward arc from t to s.

max xts

s.t.∑

k∈V +i

xik −∑

k∈V−i

xki = 0, i ∈ V ,

0 ≤ xij ≤ hij , (i , j) ∈ A,

where hts = +∞.

11 / 27

Page 12: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I The dual is:

min∑

(i ,j)∈A

hijwij

s.t. ui − uj + wij ≥ 0, (i , j) ∈ A,

ut − us ≥ 1, wij ≥ 0, (i , j) ∈ A.

I The dual optimal solution is also integral because theconstraint matrix is TU. Since replacing uj by uj + α does notchange the dual, we can assume us = 0. Given such a solution(u,w), let

X = {j ∈ V | uj ≤ 0}, X̃ = V \ X = {j ∈ V | uj ≥ 1}.I Obviously, s ∈ X and t ∈ X̃ . When i ∈ X , j ∈ X̄ , we have

wij ≥ uj − ui ≥ 1. So∑

(i ,j)∈A

hijwij ≥∑

(i ,j)∈A,i∈X ,j∈X̄

hijwij ≥∑

(i ,j)∈A,i∈X ,j∈X̄

hij .

I The lower bound is attained at the solution uj = 0 for j ∈ Xand uj = 1 for j ∈ X̃ , wij = 1 for (i , j) ∈ A and i ∈ X , j ∈ X̃ .

12 / 27

Page 13: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Theorem: The dual to the maximum s − t flow problem is theminimum s − t cut problem:

minX

(i ,j)∈A,i∈X ,j∈X̃

{hij | s ∈ X ⊂ V \ {t}}.

13 / 27

Page 14: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Dijkstra Algorithm for shortest path problem

I Given digraph G = (V ,A). For edge e = (i , j), we ≥ 0 is thecost of the direct route between nodes i and j .

I Problem: find shortest paths from a starting point to all othernodes.

I Suppose k is an intermediate node on a shortest 1− i path pi .Then the 1− k subpath pk of pi is a shortest 1− k path.

I Dijkstra’s shortest path algorithmI Step 1(Initialization): g(1) = 0, U = {1}, h(j) = w1j if

(1, j) ∈ A, h(j) = ∞ otherwise.I Step 2: Let i = arg minj∈V\U h(j). Set U ← U ∪ {i} and

g(i) = h(i). If U = V . stop.I Step 3: For all j ∈ U with (i , j) ∈ A,

h(j) ← min(g(i) + wij , h(j)). Return to Step 2.

I Complexity: O(|V |2).

14 / 27

Page 15: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I An example with 8 nodes:

I The iteration process of Dijkstra algorithm is illustrated asfollows.

15 / 27

Page 16: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Ford-Fulkerson Algorithm for Max-flow Problem

I Ford-Fulkerson algorithm is also called Augmentation Pathalgorithm. This is an iterative method. At each iteration, thealgorithm is searching for a path from the source node to thesink node along which it can send a positive flow. Such apath is referred to as augmenting path.

I After a flow is sent along an augmenting path the capacities ofthe links on that path are adjusted. These adjusted capacitiesare referred to as residual capacities. Correspondingly, theresulting network is referred to as residual network.

I The algorithm terminates when an augmenting path cannotbe found

16 / 27

Page 17: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

A max-flow example

I Consider the following network:

I Note that clearly |f ∗| ≤ 24 (the smaller of the capacitiesleaving the source or entering the sink).

17 / 27

Page 18: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Iteration 1: Choose the augmenting path p1 =< s, 1, 3, t >which has cf (p1) = 12 (due to c(1, 3)) giving the residualnetwork:

18 / 27

Page 19: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Iteration 2: Choose the augmenting path p2 =< s, 2, 4, t >which has cf (p2) = 4 (due to c(4, t)) giving the residualnetwork:

19 / 27

Page 20: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Iteration 3: Choose the augmenting path p3 =< s, 2, 4, 3, t >which has cf (p3) = 7 (due to c(4, 3)) giving the residualnetwork:

20 / 27

Page 21: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I At this point there are no other augmenting paths (sincevertex 3 is the only vertex with additional capacity to the sinkbut has no flow in from other vertices). Hence the max-flownetwork (=min-cut) is

The maximal flow is |f ∗| = 19 + 4 = 23.

21 / 27

Page 22: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Minimum spanning treeI A tree is a connected graph without cycles.I Properties of trees:

I A graph is a tree if and only if there is one and only one pathjoining any two of its vertices.

I A connected graph is a tree if and only if every one of its edgesis a bridge.

I A connected graph is a tree if and only if it has N vertices andN-1 edges.

I A subgraph that spans (reaches out to ) all vertices of a graphis called a spanning subgraph.

I A subgraph that is a tree and that spans (reaches out to ) allvertices of the original graph is called a spanning tree.

I Among all the spanning trees of a weighted and connectedgraph, the one (possibly more) with the least total weight iscalled a minimum spanning tree (MST).

I The minimum spanning tree of a graph defines the cheapestsubset of edges that keeps the graph in one connectedcomponent.

22 / 27

Page 23: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Kruskal’s Algorithm

Step 1 Find the cheapest edge in the graph (if there is more than one,pick one at random). Mark it with any given colour, say red.

Step 2 Find the cheapest unmarked (uncoloured) edge in the graphthat doesn’t close a red circuit. Mark this edge red.

Step 3 Repeat Step 2 until you reach out to every vertex of the graph(or you have N − 1 coloured edges, where N is the number ofvertices.) The red edges form the desired minimum spanningtree.

23 / 27

Page 24: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Figure: Minimum spanning tree

24 / 27

Page 25: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Minimum Steiner tree

I minimum Steiner Tree: Given a graph G = (V ,E ), and asubset of vertices T ⊆ V as terminals. Find the smallest treeconnecting all the vertices of T .

I Suppose we are given a set of sites that must be connected bywires as cheaply as possible. The minimum Steiner tree is toconnect them using the smallest amount of wire. Otherexamples: networks of water pipes, heating ducts in buildings,VLSI circuit layout.

I The difference between the Steiner tree problem and theminimum spanning tree problem is that, in the Steiner treeproblem, extra intermediate vertices and edges may be addedto the graph in order to reduce the length of the spanningtree. These new vertices introduced to decrease the totallength of connection are known as Steiner points or Steinervertices.

25 / 27

Page 26: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

Figure: Solution to Steiner tree tree with 3 points

Figure: Solution to Steiner tree tree with 4 points

26 / 27

Page 27: Lecture 3: Totally Unimodularity and Network Flowsocw.nctu.edu.tw/course/ip002/lecture_IP3.pdf · Lecture 3: Totally Unimodularity and Network Flows (3 units) Outline I Properties

I Steiner tree often arises in network design and wiring layoutproblems.

I |T | = 2 ⇔ shortest path, |T | = |E | ⇔ optimal tree.

I In general minimum weight steiner tree problem is NP-hard.

I Steiner ratio conjecture: Let P be a set of n points on theEuclidean plane. Let Ls(P) and Lm(P) denote the lengths ofthe Steiner minimum tree and the minimum spanning tree onP, respectively. In 1968, Gilbert and Pollak conjectured that:

Lm(p)

Ls(P)≤ 2√

3.

I Du and Hwang’s proof (Proc. Nat. Acad. Sci., 1990;Algorithmica, 1992).

I N. Innami, B. H. Kim, Y. Mashiko and K. Shiohama, TheSteiner Ratio Conjecture of Gilbert-Pollak May Still Be Open.Algorithmica, 2008.

27 / 27