minimum cost flows: introduction and basic algorithms

79
MINIMUM COST FLOWS: INTRODUCTION AND BASIC ALGORITHMS Ben Klein – 11/03/13 Introduction Applications Optimality Conditions Primal Dual in LP Algorithms

Upload: oriel

Post on 22-Feb-2016

50 views

Category:

Documents


0 download

DESCRIPTION

Introduction Applications Optimality Conditions Primal Dual in LP Algorithms. Ben Klein – 11/03/13. Minimum cost flows: Introduction and basic algorithms. Introduction Applications Optimality Conditions Primal Dual in LP Algorithms. Max flow – A reminder. The graph: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Minimum cost flows: Introduction and basic algorithms

MINIMUM COST FLOWS: INTRODUCTION AND BASIC ALGORITHMS

Ben Klein – 11/03/13

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 2: Minimum cost flows: Introduction and basic algorithms

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Max flow – A reminder

The graph: G=(V,E) is a directed graph Capacity u(v,w) > 0 for every Two distinguished vertices s and t.

s

u

v

w

z

t

3

2

4

2

5

12

Page 3: Minimum cost flows: Introduction and basic algorithms

Max flow – A reminder

The flow: Flow is a function on the edges. A feasible flow is a flow that satisfies:

The value of a flow f is

The max flow problem is to find a feasible flow f, with maximum value

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 4: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

The graph: G=(V,E) is a directed graph Capacity u(v,w) for every Balances: For every we will have a number b(v) Cost c(v,w) for every

v1 v2

v3 v4

v5

5

-2

-3

0 04,1

3,4

5,1

1,1

3,3

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 5: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

Assumptions:

All arc costs are nonnegative – No loss of generality – due to a known transformation which converts a min cost flow problem with negative costs to a one with non-negatives costs.

If then

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 6: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

Assumptions:

All arc costs are nonnegative – No loss of generality – due to a known transformation which converts a min cost flow problem with negative costs to a one with non-negatives costs.

If then

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

v1 v24,1

2,3

Page 7: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

Assumptions:

All arc costs are nonnegative – No loss of generality – due to a known transformation which converts a min cost flow problem with negative costs to a one with non-negatives costs.

If then

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

v1 v2

u

w

4,1 4,0

2,32,0

Page 8: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

The flow: Flow is a function on the edges. A feasible flow is a flow that satisfies:

The cost of a feasible flow f: The min cost flow problem: is to find a feasible flow f, with the minimum cost.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 9: Minimum cost flows: Introduction and basic algorithms

Max flow – A reminder

For a feasible flow x, G(x) is the residual network that corresponds to the flow x.We replace each arc by two arcs and .

The arc has cost and residual capacity .The arc has cost and residual capacity .

The residual network consists only of arcs with positive residual capacity.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 10: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows - Definition

As a linear program:

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 11: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

How to find a feasible solution?

A simple observation:

But what is the value of the following expression:

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 12: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

How to find a feasible solution?

A simple observation:

But what is the value of the following expression:

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 13: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

How to find a feasible solution?

is not enough:

v1 v2

v3 v4

v5

5

-2

0 04,1

3,4

5,1

1,1

1,3-3

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 14: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

v1 v2

v3 v4

v5

5

-2

-3

0 04,1

3,4

5,1

1,1

3,3

How to find a feasible solution?

A feasible flow is a flow that satisfies:

A simple observation: A feasible flow does not depend on the cost values.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 15: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

v1 v2

v3 v4

v5

5

-2

-3

0 04

3

5

1

3

How to find a feasible solution?

A feasible flow is a flow that satisfies:

A simple observation: A feasible flow does not depend on the cost values.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 16: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

v1 v2

v3 v4

v5

5

-2

-3

0 04

3

5

1

3

How to find a feasible solution?

Reduction to max flow problem.

Add vertices s and t. For every v such that b(v)>0:

Add an edge (s,v) such that u(s,v)=b(v) For every v such that b(v)<0:

Add an edge (v,t) such that u(v,t)= -b(v)

There exists a feasible solution iff all the edges from s are saturated.

s

t

3

2

5

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 17: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flows – Finding a Feasible Solution

v1 v2

v3 v4

v5

4

3

5

1

3

How to find a feasible solution?

Reduction to max flow problem.

Add vertices s and t. For every v such that b(v)>0:

Add an edge (s,v) such that u(s,v)=b(v) For every v such that b(v)<0:

Add an edge (v,t) such that u(v,t)= -b(v)

There exists a feasible solution iff all the edges from s are saturated.

s

t

3

2

5

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 18: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Maximum Flow

A variation of the Min Cost Flow problem is to find a flow which is maximum, but has the lowest cost among the maximums.

How do we solve it?

s

v

3,1

2,2

4,0

2,1

5,3

1,12,1

u w

z

t

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 19: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Maximum Flow

Forget about the costs. Use your favorite Max Flow algorithm to find the value of the max flow, f*.

s

v

3

2

4

2

5

12

u w

z

t

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 20: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Maximum Flow

Reduction to Min Cost Flow:

Define:

s

v

3,1

2,2

4,0

2,1

5,3

1,12,1

u w

z

tf* -f*

0 0

0 0

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 21: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #1

We have T tasks and M machines ( We shall assume that every machine will execute only one task.

Let be the cost/time of running the task on the machine .

We want to find the assignment A*, of tasks to machines, with the minimum total cost/running time.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 22: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #1

A

t1

t2

m1

m3

m2 B

2 -2

0 0

0 0

0

All the capacities are 1.

0

0

0

0

0

c1,1

c1,2

c1,3

c2,3

c2,2

c2,1

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 23: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

We have a bus that can accommodate P passengers at a given time.

The bus stops at L stations (First at station #1, then at station #2 and finally at station #L).

At every station i, we know in advance how many passengers are willing to take the bus from station i to station j (j > i). We shall denote this number by pij.

The price of a single ticket for taking the bus from station i to station j is c ij.

Our goal is to find a plan which brings the profit to maximum.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 24: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

If one desires to find the maximum, M, of a function g(x), he/she can instead find the minimum, m, of the function and then we have that

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 25: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

As a linear program:

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 26: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

As a linear program:

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 27: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

As a linear program:

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 28: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Application #2

1 2 3 4

1-4

2-4

3-4

1-3

2-3

1-2

P,0 P,0 P,0

∞,-c34∞,-c24

∞,-c23

∞,-c14

∞,-c13

∞,-c12

Red Edges have ∞capacity

0 cost

p1,4 p2,4 p3,4

p1,3 p2,3

p1,2

-p1,2 -p1,3 –p2,3 -p1,4 –p2,4 –p3,4

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 29: Minimum cost flows: Introduction and basic algorithms

Minimum Cost Flow – Optimality Conditions

We’ll consider three different optimality conditions:

Negative cycle Reduced cost Complementary slackness

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 30: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Negative Cycle

Theorem: A feasible solution x* is an optimal solution of the MCF problem if and only if it satisfies the negative cycle optimality conditions: namely, the residual network G(x*) contains no negative cost (directed) cycle.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 31: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Negative Cycle

Proof:

If x is feasible and there is a negative cycle in G(x), then x is not an optimal solution

Suppose that x is a feasible flow and that G(x) contains a negative cycle, C. Then by simply augmenting flow through C, we got a new solution x’ which is feasible and has a lower cost.Therefore x is not an optimal solution to the MCF.

a

b

c

d

4-5

1 -2

Residual network

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 32: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Negative Cycle

Proof:

If x is feasible and there is no negative cycle in G(x), then x is an optimal solution

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 33: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Negative Cycle

Help is needed:

Theorem (Augmenting Cycle Theorem): Let x and y be any two feasible solutions of a network flow problem. Then the cost of x equals the cost of y plus the cost of the flow on at most m directed cycles in G(y).

Now we are ready:

Let x be a feasible flow and there is no negative cycle in G(x). Let x* be the optimal flow. Then . But x and x* are both feasible solutions of the network. Therefore:.

Therefore and x is an optimal solution.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 34: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Node potentials:

Let be a labeling of the nodes in V.

We shall call , the potential of the node v.For a given labeling , we define the reduced cost of an arc (u,v) as:

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 35: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Node potentials:

Property 1:For any directed path P from node u to node v:

v0 v1 … vk-1 vk

=

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 36: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Node potentials:

Property 2:For any directed cycle C:

v0 v1 … vk-1 v0

Using property 1:

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 37: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Theorem: A feasible solution x* is an optimal solution of the minimum cost flow problem if and only if some set of node potentials satisfy the following reduced cost optimality conditions:

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 38: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Proof:

if for a feasible solution x*, some set of node potentials satisfy the following reduced cost optimality conditions: then x* is an optimal solution

Let C be a cycle in G(x*).

Therefore there is no negative cycle in G(x*) x* is optimal according to the negative cycle optimality conditions.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 39: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Reduced cost

Proof:

if x* is an optimal solution, then some set of node potentials satisfy the following reduced cost optimality conditions:

x* is an optimal solution and therefore there is no negative cycle in G(x*).No negative cycle shortest paths are well defined in G(x*)

We shall choose an arbitrary node s.Let denote the shortest path from s to v.Therefore:

We shall denote Then:

s

u

v

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 40: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Complementary Slackness

Theorem: A feasible solution x* is an optimal solution of the MCF problem if and only if for some set of node potentials , the reduced costs and flow values satisfy the following complementary slackness conditions for every edge (u,v) in the network:

If then If then If then

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 41: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Complementary Slackness

A feasible solution x* is optimal, if some set of reduced costs and the flow values satisfy the following complementary slackness conditions for every edge (u,v) in the network:

If then If then If then

Proof: We shall prove that every edge (v,w) in G(x*) has a non-negative value. By contradiction, let (v,w) be an edge in G(x*) with .Then according to the third condition (v,w) is not in G(x*). Contradiction.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 42: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Complementary Slackness

If a feasible solution x* is optimal, then some set of node potentials satisfy the following the reduced costs and flow values satisfy the following complementary slackness conditions for every edge (u,v) in the network:

If then If then If then

Proof:Let x* be an optimal solution. Therefore there exist s.t. every edge (v,w) in G(x*) has .

Case 1: Assume that and Then (j,i) is in G(x*) and contradiction.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 43: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Complementary Slackness

If a feasible solution x* is optimal, then some set of node potentials satisfy the following the reduced costs and flow values satisfy the following complementary slackness conditions for every edge (u,v) in the network:

If then If then If then

Proof:Let x* be an optimal solution. Therefore there exist s.t. every edge (v,w) in G(x*) has .

Case 2: If . Therefore the residual network contains both (i,j) and (j,i).If then (i,j) or (j,i) has a negative reduced cost and that is a contradiction.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 44: Minimum cost flows: Introduction and basic algorithms

MCF - Optimality Conditions – Complementary Slackness

If a feasible solution x* is optimal, then some set of node potentials satisfy the following the reduced costs and flow values satisfy the following complementary slackness conditions for every edge (u,v) in the original network:

If then If then If then

Proof:Let x* be an optimal solution. Therefore there exist s.t. every edge (v,w) in G(x*) has .

Case 3: If and , then (i,j) is in the residual graph. A contradiction.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 45: Minimum cost flows: Introduction and basic algorithms

PRIMAL DUAL IN LP

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 46: Minimum cost flows: Introduction and basic algorithms

Finding an Upper Bound on OPT

min 9x1 + 2x2 + 6x3

s.t.4x1-x2+2x3 ≥ 22x1+x2+x3≥ 10x1,x2,x3 ≥0

How can one find an upper bound on OPT?Any feasible solution to this problem is an upper bound!Look at (5,2,3) As an example.

4*5 – 2 + 2*3 = 24 ≥ 225+2+3 = 10 ≥ 10

Therefore, 9*5+2*2+6*3 = 67, is an upper bound to OPT

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 47: Minimum cost flows: Introduction and basic algorithms

Finding a Lower Bound on OPT

min 9x1 + 2x2 + 6x3

s.t.4x1-x2+2x3 ≥ 22x1+x2+x3≥ 10x1,x2,x3 ≥0

How can one find a lower bound on OPT?We can “play” with the constraints.

1) 9x1+2x2+6x3 ≥ 4x1 – x2 + 2x3 ≥ 222) 9x1+2x2+6x3 ≥ 1*(4x1-x2+2x3) + 3*( x1+x2+x3) = 7x1+2x2+5x3 ≥ 22 + 30 = 52

An optimal solution to our problem is (1,0,9) with the value = 63

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 48: Minimum cost flows: Introduction and basic algorithms

Finding a Lower Bound on OPT - Generalizationmin 9x1 + 2x2 + 6x3

s.t.4x1-x2+2x3 ≥ 22 (y1)x1+x2+x3≥ 10 (y2)x1,x2,x3 ≥0

For which y=(y1,y2) we can say that 9x1+2x2+6x3 ≥ y1(4x1-x2+2x3)+y2(x1+x2+x3)≥10y1+22y2?9x1 + 2x2 + 6x3 ≥ y1(4x1-x2+2x3) + y2(x1+x2+x3) = (4y1+y2)x1 + (-y1+y2)x2 + (2y1+y2)x3

Any y s.t.4y1+y2 ≤ 9-y1+y2 ≤ 22y1+y2 ≤ 6y1,y2≥0

And of course that we want the greatest lower bound, so we want max 10y1 + 22y2

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 49: Minimum cost flows: Introduction and basic algorithms

The Dual ProblemSo while searching for a good lower bound, we created a new LP problem. We will call to the original problem – The Primal, and to the new one – The Dual.

The Primal:

min 9x1 + 2x2 + 6x3

s.t.4x1-x2+2x3 ≥ 22 x1+x2+x3≥ 10 x1,x2,x3 ≥0

The Dual:

max 22y1 + 10y2

s.t. 4y1 +y2 ≤ 9 -y1 + y2 ≤ 22y1 + y2 ≤ 6y1,y2 ≥ 0

min cTxs.t.Ax ≥ bx ≥ 0

max bTys.t.ATy ≤ cy ≥ 0

The dual of the dual is the primal

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 50: Minimum cost flows: Introduction and basic algorithms

Weak Duality - TheoremNote: In this lecture, Primal is a min problem Dual is a max problem. We will refer to the Primal as (P) and to the Dual as (D).

Theorem (Weak Duality): For any x feasible in (P) and y feasible in (D) we have.

Proof:

x is feasible for the

primal.y is feasible for the dual.

min cTxs.t.Ax ≥ bx ≥ 0

max bTys.t.ATy ≤ cy ≥ 0

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 51: Minimum cost flows: Introduction and basic algorithms

Weak Duality - Corollaries Let x* denote an optimal solution to (P) and let y* denote an optimal solution to (D).

Corollary 1: for any feasible y; that is, yb, for any feasible y is a lower bound on the optimal solution of (P).

Corollary 2: for any feasible x.

Corollary 3: If for any x and y, feasible for (P) and (D), respectively, then x and y are both optimal.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 52: Minimum cost flows: Introduction and basic algorithms

Strong Duality - Theorem Theorem (Strong Duality): Let x and y be feasible for (P) and (D) respectively, thenx is optimal to primal and y is optimal to dual if and only if .

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 53: Minimum cost flows: Introduction and basic algorithms

Complementary Slackness - TheoremTheorem (Complementary Slackness): Let x and y be feasible for (P) and (D) respectively, thenx is optimal to primal and y is optimal to dual if and only if the conditions of complementary slackness hold:

Primal complementary slackness conditions

For each j, j = 1,...,n we have xj = 0 or

Dual complementary slackness conditions

For each i, i= 1,...,m we have yi = 0 or

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 54: Minimum cost flows: Introduction and basic algorithms

Complementary Slackness - ProofLet x and y be feasible for (P) and (D) respectively, then x is optimal to primal and y is optimal to dual if and only if .

We know that:

Therefore, cx=yb if and only if:

and

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

min cTxs.t.Ax ≥ bx ≥ 0

max bTys.t.ATy ≤ cy ≥ 0

Page 55: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 56: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

𝜋 (𝑖)

𝛼 𝑖𝑗

primalmin cTxs.t.Ax ≥ bx ≥ 0

dualmax bTys.t.ATy ≤ cy ≥ 0

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 57: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t. s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 58: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 59: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

Define :

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 60: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 61: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 62: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

s.t.

We know that . Therefore we want to be small.We can only control. Therefore

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 63: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 64: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Theorem: Let z(x) denote the objective function value of some feasible solution x of the MCF problem and let denote the objective function value of some feasible solution of its dual. Then .

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 65: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Proof: Weak Duality Theorem.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 66: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Theorem: Let x* denote a feasible solution of the primal, and denote a feasible solution of the dual. Then x* is optimal for the primal and is optimal for the dual iff

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 67: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Proof: Strong Duality Theorem.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 68: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Theorem: Let x* denote an optimal solution of the primal, and denote a optimal solution of the dual. Then the pair satisfies the complementary slackness optimality conditions:

If then If then If then

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 69: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Proof: Complementary Slackness Theorem.

s.t. s.t.

Case 1: If then and therefore .

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 70: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Proof: Complementary Slackness Theorem.

s.t. s.t.

Case 2: If then can’t be greater than 0, because then (Case 1). We know that for the optimal solution . Therefore it must be zero.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 71: Minimum cost flows: Introduction and basic algorithms

MCF – Linear Programming

Proof: Complementary Slackness Theorem.

s.t. s.t.

Case 3: If then . Therefore

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 72: Minimum cost flows: Introduction and basic algorithms

Computing Optimal Node Potentials from Optimal Solution

Let be an optimal solution to the MCF problem. How one can find the optimal node potentials?

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 73: Minimum cost flows: Introduction and basic algorithms

Computing Optimal Node Potentials from Optimal Solution

Solution: If is an optimal solution then there are no negative cycles in G(). Therefore shortest paths are well defined in G(). Choose an arbitrary node s. Compute d(i) – shortest distance from s to i in G(). And denote .

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 74: Minimum cost flows: Introduction and basic algorithms

Computing Optimal Flow from Optimal Node Potentials

Given the optimal node potentials, how can one find the optimal flow?

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 75: Minimum cost flows: Introduction and basic algorithms

Computing Optimal Node Potentials from Optimal Solution

Solution: If are the optimal node potentials, then we shall first compute for every edge (i,j) in the network.

Examine every If then (Case 1) and delete (i,j) from the network. If then (Case 3) and delete (i,j) from the network and decrease b(i) and increase b(j) by . If then we’ll demand: .

Let G’=(V,E’) the resulting network and b’ denote the modified supplies/demands.

Now the problem reduces to finding a feasible flow in the network G’ (And we already know how to do this).

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 76: Minimum cost flows: Introduction and basic algorithms

Cycle Canceling Algorithm

The negative cycle optimality conditions suggest one simple algorithmic approach:

algorithm cycle-canceling:1. Establish a feasible flow x in the network2. While G(x) contains a negative cycle do:

1. Use some algorithm to identify a negative cycle W

2. augment units of flow in the cycle W and update G(X)

Finding negative cycle in a graph: Bellmand-Ford O(nm).

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 77: Minimum cost flows: Introduction and basic algorithms

Cycle Canceling Algorithm

Theorem: If all arc capacities and supplies/demands of nodes are integer, then the minimum flow problem always has an integer minimum cost flow.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 78: Minimum cost flows: Introduction and basic algorithms

Cycle Canceling Algorithm

Running Time:

Let U be an upper bound to the capacities and C an upper bound to the costs.

mCU is an upper bound on the initial cost.-mCU is a lower bound on the initial cost.

Each iteration the algorithm changes the objective function value by an amount of . Therefore we have at most O(mCU) iterations.

With Bellman-Ford we get running time.

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms

Page 79: Minimum cost flows: Introduction and basic algorithms

THANK YOU

IntroductionApplicationsOptimality ConditionsPrimal Dual in LPAlgorithms