287
Finding Minimum-Cost Circulation By Successive Approximation Goldberg and Tarjan 1990 Advanced Algorithms Seminar Instructor: Prof. Haim Kaplan Presented by: Michal Segalov & Lior Litwak

Finding Minimum-Cost Circulation By Successive Approximation

  • Upload
    taryn

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Finding Minimum-Cost Circulation By Successive Approximation. Goldberg and Tarjan 1990. Advanced Algorithms Seminar Instructor: Prof. Haim Kaplan Presented by: Michal Segalov & Lior Litwak. Motivation. What is the minimum cost circulation problem? - PowerPoint PPT Presentation

Citation preview

Page 1: Finding Minimum-Cost Circulation By Successive Approximation

Finding Minimum-Cost Circulation By Successive

Approximation

Goldberg and Tarjan 1990

Advanced Algorithms Seminar

Instructor: Prof. Haim Kaplan

Presented by: Michal Segalov & Lior Litwak

Page 2: Finding Minimum-Cost Circulation By Successive Approximation

Motivation

What is the minimum cost circulation problem?

What is this problem equivalent to in the real world?

Page 3: Finding Minimum-Cost Circulation By Successive Approximation

The Min-Cost Circulation Problem

In the flow problems we have the “source” and “sink” special vertices, such that flow passes between them.

Page 4: Finding Minimum-Cost Circulation By Successive Approximation

The Min-Cost Circulation Problem

In the flow problems we have the “source” and “sink” special vertices, such that flow passes between them.

The circulation problems take these vertices out of the game.

Page 5: Finding Minimum-Cost Circulation By Successive Approximation

The Min-Cost Circulation Problem

In the flow problems we have the “source” and “sink” special vertices, such that flow passes between them.

The circulation problems take these vertices out of the game.

We push flow through edges in cycles along the graph, seeking minimal cost.

Page 6: Finding Minimum-Cost Circulation By Successive Approximation

The Min-Cost Circulation Problem

In the flow problems we have the “source” and “sink” special vertices, such that flow passes between them.

The circulation problems take these vertices out of the game.

We push flow through edges in cycles along the graph, seeking minimal cost.

Notice – we are not interested in pushing maximal flow anymore.

Page 7: Finding Minimum-Cost Circulation By Successive Approximation

Max-Flow, Min-Cost & What’s Between

Consider the familiar Max-Flow problem. In that problem we want to achieve maximal flow on the edges.

Page 8: Finding Minimum-Cost Circulation By Successive Approximation

Max-Flow, Min-Cost & What’s Between

Consider the familiar Max-Flow problem. In that problem we want to achieve maximal flow on the edges.

Now think of giving a cost to flow units going through each edge (positive or negative).

Page 9: Finding Minimum-Cost Circulation By Successive Approximation

Max-Flow, Min-Cost & What’s Between

Consider the familiar Max-Flow problem. In that problem we want to achieve maximal flow on the edges.

Now think of giving a cost to flow units going through each edge (positive or negative).

We now wish to find, amongst all possible maximal flows, the one with minimal cost.

Page 10: Finding Minimum-Cost Circulation By Successive Approximation

Min-Cost Max-Flow Equivalenceto Min-Cost Circulation

Given a graph G, construct G’ by adding two vertices s and t, not connected to any of the other vertices. Any min cost flow in G’ is a min-cost circulation in G.

s t

G G’

Page 11: Finding Minimum-Cost Circulation By Successive Approximation

Min-Cost Max-Flow Equivalenceto Min-Cost Circulation

Given a graph G, construct G’ by connecting t and s with a new edge s.t.

, , 1u t s mU c t s C n

ts

ts

G G’

Page 12: Finding Minimum-Cost Circulation By Successive Approximation

Previous Work

Some other Algorithms out there:

This paper introduced an efficient general scheme, rather than a specific one, for solving the problem

Page 13: Finding Minimum-Cost Circulation By Successive Approximation

The BIG Picture

In this lecture we will see a general approach for solving this problem.

Page 14: Finding Minimum-Cost Circulation By Successive Approximation

The BIG Picture

In this lecture we will see a general approach for solving this problem.

It works by finding an initial approximate solution and then iteratively refining it until reaching an optimal one.

Page 15: Finding Minimum-Cost Circulation By Successive Approximation

The BIG Picture

In this lecture we will see a general approach for solving this problem.

It works by finding an initial approximate solution and then iteratively refining it until reaching an optimal one.

The error parameter, ε, is halved in each iteration until the integrality of the arc costs guarantees an optimal solution.

Page 16: Finding Minimum-Cost Circulation By Successive Approximation

The BIG Picture

We will see two methods for refinement: The Generic method – Uses a sequence of

transformation on the current circulation to produce a finer one. Achieves a runtime of

Blocking Flow method – a generalization of Dinic used for refinement. Complexity is the same for a simple implementation.

Complexity even better with dynamic trees…

3 min log , logO n nC m n

Page 17: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation network is a symmetric graph G=(V,E) with a real value capacity u(v,w) function and a cost c(v,w) function for each arc s.t.

c(v,w) = -c(w,v) (cost antisymmetry constraint)

Page 18: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A pseudoflow is a function s.t. for each : 1. f(w,v) ≤ u(w,v) (capacity constraint)2. f(w,v) = –f(v,w) (flow antisymmetry constraint)

The cost of a pseudoflow is

,

1cost( ) , ,2 v w E

f c v w f v w

:f E R ,v w E

Page 19: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

For a pseudoflow f and a vertex v, the excess flow into v , is defined by

A vertex v is called active if Observe that

(because G is symmetric)

fe v

,

,fu v E

e v f u v

0fe v 0fv V

e v

Page 20: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

Pseudoflow example:

4,1,3

6,3,-2

u=5,f=2,c=-1

4,3,1

Total cost = -2

0,-1,-3

0,-3,2

2,-3,-1

0,-2,1

ef = -1

ef = -4

ef = -1

ef = 6

Page 21: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation is a pseudoflow s.t. for each vertex v, 0fe v

Page 22: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation is a pseudoflow s.t. for each vertex v,

This means that there is no excess flow in v, and that flow is not “created” in v(i.e. no “sources” and “sinks” in G)

0fe v

Page 23: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation is a pseudoflow s.t. for each vertex v,

This means that there is no excess flow in v, and that flow is not “created” in v(i.e. no “sources” and “sinks” in G)

A pseudoflow is a circulation iff there are no active vertices (by definition)

0fe v

Page 24: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Residual System

The residual capacity of and edge (v,w) is

An arc is saturated if The residual graph is defined as

Note that all the residual arcs are non-saturated…

, , ,fu v w u v w f v w , 0fu v w

, , | 0f f f fG V E E e u e

Page 25: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – Prices & Costs

A price function is a function We use the price function to define the

reduced cost of an arc:

:p V R

, ,pc v w c v w p v p w

Page 26: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – Prices & Costs

A price function is a function We use the price function to define the

reduced cost of an arc:

Note that the cost of a circulation is the same whether the original costs or the reduced costs with respect to some price function are used!

:p V R

, ,pc v w c v w p v p w

Page 27: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

We say the a circulation is optimal if its cost is minimal

Page 28: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

We say the a circulation is optimal if its cost is minimal

Theorem 2.1 A circulation f is minimum cost iff the

residual graph contains no cycles of negative cost

Page 29: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Proof ( ): If there are negative cycles in Gf we can obtain

a “cheaper” circulation by increasing flow on them.

4,0,3

6,3,-2

u=5,f=3,c=-1

4,3,1

4,3

3,-2

uf=2,c=-1

1,1

cost = -6We have a negative cycle

GfG

Page 30: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Proof ( ): If the circulation f is not optimal, we show there

exists a negative cycle in Gf

Let f* be an optimal circulation.We will look at the decomposition of the circulation f*-f into cycles.

Since it is of negative cost and feasible in Gf, it contains a negative cycle!

Page 31: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Theorem 2.2 A circulation f is minimum cost iff there is a

price function p s.t. for each arc (v,w)

, 0 , ,pc v w f v w u v w

Page 32: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Proof ( ): Given such p, there are no negative reduced

cost cycles in Gf. Hence, no negative cost cycles in Gf. Use the previous theorem.

Page 33: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Proof ( ): Given an optimal circulation, such a function

can be calculated using the shortest paths from an external vertex s in Gf.

can you think how?

Page 34: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

4,3

2,-2

uf=1,c=-1

Gf

4,1

4,2

4,-1

Page 35: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

3

-2

c=-1

Gaux

1

2

-1

S

0

00

0

Page 36: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

3

-2

c=-1

Gaux

1

2

-1

S

0

00

0

Page 37: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

3

-2

c=-1

Gaux

1

2

-1

S

0

00

Page 38: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

3

-2

c=-1

Gaux

1

2

-1

S

0

0

Page 39: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

-2

c=-1

Gaux

1

2

-1

S

0

0

Page 40: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

-2

c=-1

Gaux

2

-1

S

0

0

Page 41: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

-2

c=-1

Gaux

2

S

0

0

Page 42: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

-2

c=-1

T

S

0

0

Page 43: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

-2

c=-1

T

S

0

0

d = 0

d = 0

d = -1

d = -3

,c v w d v d w

Page 44: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

4,3

2,-2

uf=1,c=-1

Gf

4,1

4,2

4,-1

p = 0

p = 0

p = -1

p = -3

Define p = d:

Page 45: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

c=-1, cp=0

Gf

p = 0

p = 0

p = -1

p = -3

c=1, cp=0

c=-2, cp=0

c=2, cp=0

c=-1, cp=2

c=3, cp=3

, 0 ,p fc v w v w G

Page 46: Finding Minimum-Cost Circulation By Successive Approximation

So What Have We Seen So Far?

Page 47: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation network is a symmetric graph G=(V,E) with a real value capacity u(v,w) function and a cost c(v,w) function for each arc s.t.

c(v,w) = -c(w,v) (cost antisymmetry constraint)

Page 48: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A pseudoflow is a function s.t. for each : 1. f(w,v) ≤ u(w,v) (capacity constraint)2. f(w,v) = –f(v,w) (flow antisymmetry constraint)

The cost of a pseudoflow is

,

1cost( ) , ,2 v w E

f c v w f v w

:f E R ,v w E

Page 49: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

For a pseudoflow f and a vertex v, the excess flow into v , is defined by

A vertex v is called active if Observe that

(because G is symmetric)

fe v

,

,fu v E

e v f u v

0fe v 0fv V

e v

Page 50: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – The Basics

A circulation is a pseudoflow s.t. for each vertex v, 0fe v

Page 51: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – Prices & Costs

A price function is a function We use the price function to define the

reduced cost of an arc:

:p V R

, ,pc v w c v w p v p w

Page 52: Finding Minimum-Cost Circulation By Successive Approximation

Definitions – Prices & Costs

A price function is a function We use the price function to define the

reduced cost of an arc:

Note that the cost of a circulation is the same whether the original costs or the reduced costs with respect to some price function are used!

:p V R

, ,pc v w c v w p v p w

Page 53: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

We say the a circulation is optimal if its cost is minimal

Page 54: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

We say the a circulation is optimal if its cost is minimal

Theorem 2.1 A circulation f is minimum cost iff the

residual graph contains no cycles of negative cost

Page 55: Finding Minimum-Cost Circulation By Successive Approximation

Optimality of Circulations

Theorem 2.2 A circulation f is minimum cost iff there is a

price function p s.t. for each arc (v,w)

, 0 , ,pc v w f v w u v w

Page 56: Finding Minimum-Cost Circulation By Successive Approximation

Now let’s relax the definition of circulation optimality

Page 57: Finding Minimum-Cost Circulation By Successive Approximation

Optimality and Approximate Optimality

A circulation f is ε-optimal with respect to a price function p if

(we relax the optimality constraint) A pseudoflow is ε-optimal if it is ε-optimal with

respect to some price function p. Observe that a pseudoflow is ε-optimal w.r.t. p

iff for every residual arc.

, , ,pc v w f v w u v w

,pc v w

Page 58: Finding Minimum-Cost Circulation By Successive Approximation

Approximate Optimality Properties

Theorem 2.3 If all costs are integers and

then an ε-optimal solution is optimal1/ n

Page 59: Finding Minimum-Cost Circulation By Successive Approximation

Approximate Optimality Properties

Proof: Consider a simple cycle in Gf. The ε-optimality of f implies that the reduced

cost of the cycle is at least . The reduced cost of the cycle equals the

original cost which is non-negative (all costs are integral).

Since there are no negative cost cycles, f is minimum cost circulation.

1n

Page 60: Finding Minimum-Cost Circulation By Successive Approximation

Fitting Price Functions and Tight Error Parameters

The definition of ε-optimality raises two interesting questions:

1. Given a pseudoflow f and a constant ε, find a price function p s.t. f is ε-optimal w.r.t p(or show that f is not ε-optimal).

2. Given a pseudoflow f, find an ε s.t. f is ε-tight (the smallest ε s.t. f is ε-optimal).

Page 61: Finding Minimum-Cost Circulation By Successive Approximation

Finding a Fitting Price Function

Objective:

Given a pseudoflow f and a constant ε, find a price function p s.t. f is ε-optimal w.r.t p, or show that f is not ε-optimal.

Page 62: Finding Minimum-Cost Circulation By Successive Approximation

Finding a Fitting Price Function

Let’s define Extend the residual graph by adding a

vertex s with arcs to all other vertices –

(Also define )

, ,c u v c u v

,aux fG V s E s V

, 0c s u

fG

Page 63: Finding Minimum-Cost Circulation By Successive Approximation

Finding a Fitting Price Function

Theorem 3.3A pseudoflow is ε-optimal if and only if

contains no cycle of negative cost. If T is a shortest path tree of rooted at s w.r.t , and d is the distance function in the tree then f is ε-optimal w.r.t p = d.

auxG

auxG

c

c

Page 64: Finding Minimum-Cost Circulation By Successive Approximation

Finding a Fitting Price Function

Using the previous theorem the first problem can be solved by constructing a short distance tree in (or finding a negative cost cycle in it).

O(n+m) for constructing O(nm) – Building shortest path

tree/looking for negative cost cycle (Bellman Ford)

auxG

auxG

Page 65: Finding Minimum-Cost Circulation By Successive Approximation

The Last Introduction Slide!

Page 66: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

Now we get to business…We want to construct a general algorithm

framework to solve the Minimum-Cost Circulation problem.

Page 67: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

Now we get to business…We want to construct a general algorithm

framework to solve the Minimum-Cost Circulation problem.

The successive approximation framework assumes all costs are integral.

Page 68: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

The basic idea: Find an initial C-optimal circulation f w.r.t. p s.t.

p(v) = 0 (for all v) Refine ε by half and adjust f and p to be

ε/2-optimal Repeat until ε is small enough to guarantee

optimality.

Page 69: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

Procedure min-cost(V,E,u,c):[Initialization] ε ← C; ; If there exists a circulation then load it into f,

else return NULL;[Main loop] While ε ≥ 1/n do

(ε,f,p) ← refine(ε,f,p) Return f

End

, 0v V p v

Page 70: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

Correctness: Under the assumption that refine is correct, the

correctness of the algorithm is immediate from Theorem 2.3.

Page 71: Finding Minimum-Cost Circulation By Successive Approximation

The Minimum-Cost Framework

Correctness: Under the assumption that refine is correct, the

correctness of the algorithm is immediate from Theorem 2.3.

Complexity: iterations of refine Each refine takes and can be reduced

using dynamic trees to .

logO nC 3O n

2log /O nm n m

Page 72: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

This method uses ideas similar to those presented in Goldberg & Tarjan’s Max-Flow algorithm.

We will use push and relabel operations here as well, modified to fit the ε-optimal environment.

Page 73: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

Procedure refine(ε,f,p):[Initialization] ε ← ε/2; For every (v,w) in E do:

If cp(v,w) < 0 then f(v,w) ← u(v,w);[Loop] While there exists a flow/price update operation

that applies do:Select such an operation and apply it;

Return (ε,f,p)End

Page 74: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

Refine starts by halving ε and saturating all edges with negative reduced cost.

This achieves an ε-optimal pseudoflow.Next we apply the flow & price update

operations (push & relabel respectively), to transform the pseudoflow into an ε-optimal circulation.

Page 75: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement MethodProcedure push(v,w):

Applicability: v is active, uf(v,w) > 0 and cp(v,w) < 0 Action: send δ = min {ef(v),uf(v,w)} units of flow

from v to w

Procedure relabel(v):Applicability: v is active and :

uf(v,w) > 0 cp(v,w) ≥ 0 Action: replace p(v) with

w V

,max ,fv w E p w c v w

Page 76: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

The push operation (non-saturating):

The vertex is no longer active.

uf=5,cp=-1Gf

uf=2,cp=1

ef=2uf=3,cp=-1

Gf

uf=2,cp=1

ef=0

Page 77: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

The push operation (saturating):

The vertex remains active!

uf=1,cp=-1Gf

uf=2,cp=1

ef=2

uf=0,cp=-1Gf

uf=2,cp=1

ef=1

Page 78: Finding Minimum-Cost Circulation By Successive Approximation

The Generic Refinement Method

The relabel operation:

No flow is changed, only the price of the vertex.

c=-1,cp=3Gf

c=2,cp=4

p=0

p=-4

p=-2

c=-1,cp=-εGf

c=2,cp=1-ε

p=-3-ε

p=-4

p=-2

Page 79: Finding Minimum-Cost Circulation By Successive Approximation

Let’s Analyze aComprehensive Example

Page 80: Finding Minimum-Cost Circulation By Successive Approximation

x1

x2x3

y1

y2

y3

9,0

10,-2 10,-2

10,1 10,1

10,1

10,-2

Example – The Initial G(Assume G = Gf)

Gf

Page 81: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

ε ← ε/2 = 1

x1

x2x3

y1

y2

y3

9,0

10,-2 10,-2

10,1 10,1

10,1

10,-2

Gf

Page 82: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

At first all negative cost arcs are saturated

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,1

10,1

10,2

Gf

Page 83: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineLet’s see how the excess flow moves from

x3 to x1, applying relabels and pushes:

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,1

10,1

10,2

Gf

Page 84: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe start by applying relabel on x3:

p(x3) = 0

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,1

10,1

10,2

Gf

Page 85: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe start by applying relabel on x3:

Relabel:

p’(x3) = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,-1

10,-1

10,0

Gf

Page 86: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can push – we choose (arbitrarily)

to push towards x2:

p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,-1

10,-1

10,0

Gf

Page 87: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can push – we choose (arbitrarily)

to push towards x2:

p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10, 1

10,-1

10,0

Gf

Page 88: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we relabel x2:

p(x2) = 0p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10, 1

10,-1

10,0

Gf

Page 89: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we relabel x2:

Relabel:

p’(x2) = -2p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,-1 10, -1

10,-1

10,0

Gf

Page 90: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineAgain, we choose (arbitrarily) to push

towards x1:

p = -2p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,-1 10, -1

10,-1

10,0

Gf

Page 91: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineAgain, we choose (arbitrarily) to push

towards x1:

p = -2p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10, -1

10,-1

10,0

Gf

Page 92: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can relabel x1:

p = -2p = -2

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10, -1

10,-1

10,0

Gf

p(x1) = 0

Page 93: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can relabel x1:

Relabel:

p’(x1) = -1

p = -2p = -2

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,2 10,2

10,0 10, -1

10,0

10,0

Gf

Page 94: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe push 9 flow units towards y1:

p = -2

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,2 10,2

10,0 10, -1

10,0

10,0

Gf

p = -1

p = -2

Page 95: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe push 9 flow units towards y1:

p = -2

1

-1

x1

x2x3

y1

y2

y3

9, 1

10,2 10,2

10,0 10, -1

10,0

10,0

Gf

p = -1

p = -2

Page 96: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe can relabel x1 again:

p = -2

1

-1

x1

x2x3

y1

y2

y3

9, 1

10,2 10,2

10,0 10, -1

10,0

10,0

Gf

p = -1

p = -2

Page 97: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe can relabel x1 again:

Relabel:

p’(x1) = -2

p = -2

1

-1

x1

x2x3

y1

y2

y3

9, 2

10,2 10,2

10,-1 10, -1

10,1

10,0

Gfp = -2

Page 98: Finding Minimum-Cost Circulation By Successive Approximation

p = -2

1

-1

x1

x2x3

y1

y2

y3

9, 2

10,2 10,2

10,-1 10, -1

10,1

10,0

Gfp = -2

p = -2

Anybody wants to continue?!

Page 99: Finding Minimum-Cost Circulation By Successive Approximation

p = -2

1

-1

x1

x2x3

y1

y2

y3

9, 2

10,2 10,2

10,-1 10, -1

10,1

10,0

Gfp = -2

p = -2

Anybody wants to continue?!We will, later on – This example is

important to prove certain bounds…

Page 100: Finding Minimum-Cost Circulation By Successive Approximation

The Correctness of Refine

We need to show a few things: ε-optimality is preserved throughout the

execution of refine. Refine returns an ε-optimal circulation (rather

than just a pseudoflow). Refine terminates (and efficiently…)

Page 101: Finding Minimum-Cost Circulation By Successive Approximation

The Correctness of Refine

Note that push preserves ε-optimality of any pseudoflow – no arcs with negative reduced cost are added to Gf.

Lemma 5.3:Suppose f is an ε-optimal pseudoflow w.r.t

p and relabel is applied to v, then the price of v decreases by at least ε, and f is ε-optimal w.r.t p’ (the new price function).

Page 102: Finding Minimum-Cost Circulation By Successive Approximation

ε-Optimality Preservation

Proof:Let f be a ε-optimal pseudoflow w.r.t p.

Before the relabeling of v

After the relabel: , , 0 ,f pv w E c v w p v p w c v w

,' max ,fv w Ep v p w c v w p v

Page 103: Finding Minimum-Cost Circulation By Successive Approximation

ε-Optimality Preservation

Proof:Let f be a ε-optimal pseudoflow w.r.t p.

Before the relabeling of v

After the relabel:

Now we will show that the new pseudoflow is ε-optimal w.r.t. p’. Show that

, , 0 ,f pv w E c v w p v p w c v w

,' max ,fv w Ep v p w c v w p v

', ,f pv w E c v w

Page 104: Finding Minimum-Cost Circulation By Successive Approximation

ε-Optimality Preservation

Proof – continuedThe only residual arcs effected by the

change are (v,w) or (w,v).An arc of the form (w,v) has its reduced

cost increased by ε, preserving ε-optimal

Page 105: Finding Minimum-Cost Circulation By Successive Approximation

ε-Optimality Preservation

Proof – continuedThe only residual arcs effected by the

change are (v,w) or (w,v).An arc of the form (w,v) has its reduced

cost increased by ε, preserving ε-optimalFor an arc (v,w) in Gf

since by definition.

' , , 'pc v w c v w p v p w

' ,p v p w c v w

Page 106: Finding Minimum-Cost Circulation By Successive Approximation

The Correctness of Refine

Theorem 5.4If refine terminates, the pseudoflow f it

returns is an ε-optimal circulation.

We saw the ε-optimality preservation. Refine terminates only when there are no

active vertices, which means we have a circulation (by definition).

Page 107: Finding Minimum-Cost Circulation By Successive Approximation

The Complexity of Refine

Suppose we implement refine naively, choosing update operations arbitrarily.

How many update operations are performed in every invocation of refine?

Page 108: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

To limit the number of relabel operations performed, we need to bound the reduction in price for each vertex.

Page 109: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Lemma 5.7Let f be a pseudoflow and f’ a circulation.

For any v with ef(v) > 0 there exists a w with ef(w) < 0 and a path from v to w, such that and for

0 1, ... lv v v v w 1,i i fv v E 1 ',i i fv v E

0 i l

Page 110: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:Suppose ef(v) > 0.

Page 111: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:Suppose ef(v) > 0.Define G+=(V,E+),

G-=(V,E-), , | ' , ,E x y f x y f x y

, | ' , ,E x y f x y f x y

Page 112: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:Suppose ef(v) > 0.Define G+=(V,E+),

G-=(V,E-), Notice that:

and that iff

, | ' , ,E x y f x y f x y , | ' , ,E x y f x y f x y

',f fE E E E ,x y E ,y x E

Page 113: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:Suppose ef(v) > 0.Define G+=(V,E+),

G-=(V,E-), Notice that:

and that iffConclusion – it suffices to show the

existence of such path in G+

, | ' , ,E x y f x y f x y , | ' , ,E x y f x y f x y

',f fE E E E ,x y E ,y x E

Page 114: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof – Continued:Let S be the set of all vertices reachable

from v in G+

Page 115: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof – Continued:Let S be the set of all vertices reachable

from v in G+ Notice that for every edge ,

otherwiseNow we show a crucial inequality

,x y S S , ' ,f x y f x y

y S

Page 116: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price ReductionProof – Continued:

,

,

,,

0

,

0 ' , ' is a circulation

, by previous argument

, , by antisimetry

, by definition of

by antisimetry

x y S S E

x y S S E

x y S S Ex y S S E

x y S V E

fx S

f x y f

f x y

f x y f x y

f x y S

e x

Page 117: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof – Continued:Eventually,

But we know thatso there must exist such thatw S

0fx S

e x

0fe v

0fe w

Page 118: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Now we can bound the reduction in price –

Lemma 5.8The price of any vertex v decreases by at

most 3nε during an execution of refine

Page 119: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:We start with , the refine input. 2 2, , 2f p

Page 120: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:We start with , the refine input.

Let f and p be the pseudoflow and the price function after any relabel of v.

2 2, , 2f p

Page 121: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:We start with , the refine input.

Let f and p be the pseudoflow and the price function after any relabel of v.

v must be active before the relabel, and it remains active afterwards.

2 2, , 2f p

Page 122: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price Reduction

Proof:We start with , the refine input.

Let f and p be the pseudoflow and the price function after any relabel of v.

v must be active before the relabel, and it remains active afterwards.

Use previous lemma with f, f’=f2ε, to show that there is a path from v to w such that

2 2, , 2f p

0fe w

Page 123: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price ReductionProof – Continued:From the ε-optimality of f:

1 1

1 10 0

, ,l l

p i i i ii i

l c v v p v p w c v v

Page 124: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price ReductionProof – Continued:From the ε-optimality of f:

From the 2ε-optimality of f’:

1 1

1 10 0

, ,l l

p i i i ii i

l c v v p v p w c v v

2

1 1

1 2 2 10 0

2 , ,l l

p i i i ii i

l c v v p w p v c v v

Page 125: Finding Minimum-Cost Circulation By Successive Approximation

Bounding the Price ReductionProof – Continued:From the ε-optimality of f:

From the 2ε-optimality of f’:

Sum the above inequalities to get:

1 1

1 10 0

, ,l l

p i i i ii i

l c v v p v p w c v v

2

1 1

1 2 2 10 0

2 , ,l l

p i i i ii i

l c v v p w p v c v v

2 23 3p v p v l p v n

Page 126: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: RelabelLemma 5.9The number of relabel operations during

an execution of refine is at most 3n(n-1)

Proof:Recall that after each relabel, the price of

a vertex decreases by at least εOverall it decreases by at most 3nε We get at most 3n(n-1) relabel operations!

Page 127: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Saturating PushLemma 5.10The number of saturating pushes during

an execution of refine is at most 3nm

Proof:After a saturating push on an arc (v,w),

there must be a relabel operation on v, before (any) other push can occur.

We get at most 3nm saturating pushes!

Page 128: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Lemma 5.11The number of non-saturating pushes

during an execution of refine is at most 3n2(n+m)

Page 129: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Some definitions:An arc (v,w) is admissible if

A push operation is applicable only to active admissible arcs.

, 0 , 0f pu v w and c v w

Page 130: Finding Minimum-Cost Circulation By Successive Approximation

The admissible graph is

Its most important feature – it is acyclic(as we shall prove).

Lemma 5.5Immediately after a relabel is applied to v,

no admissible arcs enter v.

The Bounds: Non-saturating Push

, |A A AG V E E e e is admissible

Page 131: Finding Minimum-Cost Circulation By Successive Approximation

Proof:Let . Before the relabeling,

by ε-optimality. , fw v G

,pc w v

The Bounds: Non-saturating Push

Page 132: Finding Minimum-Cost Circulation By Successive Approximation

Proof:Let . Before the relabeling,

by ε-optimality. After the relabeling p(v) decreases by at

least ε, hence it increases by at least ε.

, fw v G

,pc w v

,pc w v

The Bounds: Non-saturating Push

Page 133: Finding Minimum-Cost Circulation By Successive Approximation

Proof:Let . Before the relabeling,

by ε-optimality. After the relabeling p(v) decreases by at

least ε, hence it increases by at least ε.

Thus, after the relabeling, i.e. (w,v) is not admissible.

, fw v G

,pc w v

,pc w v

, 0pc w v

The Bounds: Non-saturating Push

Page 134: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Corollary 5.6Throughout the running of refine,

the admissible graph remains acyclic.Proof:Initially GA contains no arcs,

hence it is acyclic.Pushes preserve acyclicity. From Lemma 5.5, so do relabels.

Page 135: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Now to prove Lemma 5.11:The number of non-saturating pushes

during an execution of refine is at most 3n2(n+m)

Page 136: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Let’s define a potential function for each vertex, , the number of vertices reachable from v in GA.

v

Page 137: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Let’s define a potential function for each vertex, , the number of vertices reachable from v in GA.

The total potential will be:

v

| is activev v

Page 138: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Let’s define a potential function for each vertex, , the number of vertices reachable from v in GA.

The total potential will be:

Let’s amortize the number of non-saturating pushes using this potential.

v

| is activev v

Page 139: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

In the beginning of refine, there are no admissible arcs, i.e. is at most n.

Page 140: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

A non-saturating push decreases by at least 1. In such a push operation over the arc (v,w), v

becomes inactive, so its potential is subtracted from the total.

If w becomes active as a result of the push, its potential is added to the total.

But since GA is acyclic. Hence the total potential decreases!

w v

Page 141: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

A saturating push increases by at most n: Such a push may activate at most one other

vertex. At most n vertices are reachable from the newly

activated vertex.

Page 142: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

A relabel increases by at most n: From Lemma 5.5, no admissible vertices enter

v after a relabel on v. Recall that no other arc are affected by relabel. Thus, for any w≠v, can only decrease! For v itself, can increase up to n.

v w

Page 143: Finding Minimum-Cost Circulation By Successive Approximation

The Bounds: Non-saturating Push

Overall, the number of non-saturating pushes equals: The initial potential value Plus the number of relabels, times n Plus the number of saturating pushes, times n

That is:

23 1 3 3n n n n nm n n n m

Page 144: Finding Minimum-Cost Circulation By Successive Approximation

In conclusion, we have shown that a naïve implementation of refine performs update operations.

Let’s show that such an implementation exists, and works in the above complexity.

The Complexity of Refine

2O n m

Page 145: Finding Minimum-Cost Circulation By Successive Approximation

A Straight-Forward Implementation

Procedure push/relabel(v):Applicability: v is activeAction: Let {v,w} be the current edge of v If uf(v,w) > 0 && cp(v,w) < 0 then push(v,w) Else If {v,w} is not last of edge list of v then:

Make current edge of v the next edge on the list Else:

Make the first edge of v the current edgeRelabel(v)

End

Page 146: Finding Minimum-Cost Circulation By Successive Approximation

This implementation of refine uses the push/relabel procedure repeatedly, until all vertices are non-active.

If a relabel is applied on v, all arcs (v,w) are saturated (v is still active).

In order for flow to be pushed back to v, there must be a relabel on w first, after which

But this means

A Straight-Forward Implementation

, 0pc w v , 0pc v w

Page 147: Finding Minimum-Cost Circulation By Successive Approximation

We get a complexity of for refine.

A Straight-Forward Implementation

2O n m

Page 148: Finding Minimum-Cost Circulation By Successive Approximation

By restricting the application of relabel and push we can obtain better complexity, .

We will apply the operations on a vertex until it is either relabeled or rendered inactive.

Now we should decided in which order to process the vertices.

A Faster Implementation of Refine

3O n

Page 149: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine

Procedure discharge(v):Applicability: v is activeAction: apply push/relabel on v until it is

relabeled or becomes inactive

Page 150: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:First Attempt - FIFO

In the Max-Flow algorithm of Goldbreg & Tarjan, we saw that FIFO processing of the vertices improves performance.

Does it work here as well?

Page 151: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:First Attempt - FIFO

Unfortunately, we need passes over the queue in the worst case…

Lemma 6.3During an execution of the FIFO

implementation of refine, there arepasses over the queue.

3O n

3O n

Page 152: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

We use a different order of processing than in the FIFO implementation.

Here, we process the vertices in a topological order, with respect to the current admissible graph GA.

Such an order always exists because recall that GA is acyclic!

Page 153: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Just a reminder:An arc (v,w) is admissible if

A push operation is applicable only to active admissible arcs.

The admissible graph is

, 0 , 0f pu v w and c v w

, |A A AG V E E e e is admissible

Page 154: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

We maintain a current vertex list in topological order, L.

L is initialized in any order, since GA has no edges to begin with.

In each pass over L, we scan for the first active vertex, and apply discharge on it.

If a vertex is relabeled, it is moved to the beginning of L, and we begin the scan again.

Page 155: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Procedure first-active:Let L be any vertex listLet v be the first vertex in LWhile there exists an active vertex in L

do:If v is active then:

• discharge(v)• If the discharge relabeled v, move v to the front

of LElse replace v by the next vertex in L

End

Page 156: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Note that push operations do not affect the topological order of L.

Recall that after a relabel operation on v: No admissible arcs enter v Only arcs connected to v are affected

Thus, moving v to the front of L retains the topological order with respect to the current GA.

Page 157: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Why is the topological order important?

Page 158: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Why is the topological order important?After relabel we start from the beginning,

so we never miss an active vertex.

Page 159: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Why is the topological order important?After relabel we start from the beginning,

so we never miss an active vertex.The topological order guaranties that we

always push flow towards subsequent vertices in L.

Page 160: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Why is the topological order important?After relabel we start from the beginning,

so we never miss an active vertex.The topological order guaranties that we

always push flow towards subsequent vertices in L.

If discharge ends with a push, the vertex becomes inactive.

Page 161: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Why is the topological order important?After relabel we start from the beginning,

so we never miss an active vertex.The topological order guaranties that we

always push flow towards subsequent vertices in L.

If discharge ends with a push, the vertex becomes inactive.

It will not be active again until the next relabel operation!

Page 162: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

We define that a pass over L begins from the first vertex and ends on the first relabel operation.

Lemma 6.4The first-active method terminates after

passes over L.Proof:We have only relabel operations.

2O n

2O n

Page 163: Finding Minimum-Cost Circulation By Successive Approximation

Theorem 6.5The first-active implementation of refine

runs in time, giving a total time complexity of the Min-Cost Circulation algorithm of

A Faster Implementation of Refine:Second attempt: Topological Order

3O n

3 logO n nC

Page 164: Finding Minimum-Cost Circulation By Successive Approximation

A Faster Implementation of Refine:Second attempt: Topological Order

Proof:We can reduce the bound on the number

of nonsaturating push operations to . In a pass over L, each vertex which is not

relabeled becomes inactive. That is, a nonsaturating push is applied to it. We get nonsaturating pushes per pass.

Other bounds remain the same.Total bound for refine is now !

3O n

3O n

O n

Page 165: Finding Minimum-Cost Circulation By Successive Approximation

Let’s Test the above Method on the Example Shown Earlier

Page 166: Finding Minimum-Cost Circulation By Successive Approximation

x1 x2 x3 xn

y1

y2 y3yn

h-1,0

h,-2 h,-2 h,-2

h,1 h,1 h,1

h,1

h,-2

The Example Revisited(Assume G = Gf)

Gf

Page 167: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

ε ← ε/2 = 1

x1 x2 x3 xn

y1

y2 y3yn

h-1,0

h,-2 h,-2 h,-2

h,1 h,1 h,1

h,1

h,-2

Gf

Page 168: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

At first all negative cost arcs are saturated

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,1

h,1

Gf

h,2

Page 169: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineLet’s see how the excess flow moves from

xn to x1, applying n relabels and pushes:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,1

h,1

Gf

h,2

Page 170: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe start by applying relabel on xn:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,1

h,1

Gf

p(xn) = 0

h,2

Page 171: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe start by applying relabel on xn:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,-1

h,-1

GfRelabel:

p’(xn) = -2

h,0

Page 172: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,-1

h,-1

Gf

h,0

p = -2

Now we can push – we choose (unfavorably) to push towards xn-1:

Page 173: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,1

h,-1

Gf

h,0

p = -2hh,1

xn-1

Now we can push – we choose (unfavorably) to push towards xn-1:

Page 174: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we relabel xn-1:

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,1

h,-1

Gf

h,0

p = -2hh,1

xn-1

p(xn-1) = 0

Page 175: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we relabel xn-1:

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,-1

h,-1

Gf

h,0

p = -2hh,-1

xn-1

Relabel:

p’(xn-1) = -2

Page 176: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineAgain, we choose (unfavorably) to push

towards xn-2:

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,1 h,-1

h,-1

Gf

h,0

p = -2hh,-1

xn-1

p = -2

Page 177: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe end up in the following state (after the

last push to x1):

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,-1 h,-1

h,-1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

Page 178: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can relabel x1:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,0

h, 2 h, 2 h,2

h,1 h,-1 h,-1

h,-1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

p = 0

Page 179: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNow we can relabel x1:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,-1h, 2 h, 2 h,2

h,0 h,-1 h,-1

h,0

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

Relabel:

p’(x1) = -1

Page 180: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe push h-1 flow units towards y1:

h

-h

x1

x2 x3 xn

y1

y2 y3yn

h-1,-1

h, 2 h, 2 h,2

h,0 h,-1 h,-1

h,0

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

p = -1

Page 181: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe push h-1 flow units towards y1:

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 1h, 2 h, 2 h,2

h,0 h,-1 h,-1

h,0

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

p = -1

Page 182: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe can relabel x1 again:

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 1

h, 2 h, 2 h,2

h,0 h,-1 h,-1

h,0

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

p = -1

Page 183: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineWe can relabel x1 again:

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2h, 2 h, 2 h,2

h,-1 h,-1 h,-1

h,1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

Relabel:

p’(x1) = -2

Page 184: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h,-1 h,-1 h,-1

h,1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

The single flow unit will flow back to xn :

p = -2

Page 185: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h,-1 h,-1 h,-1

h,1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

Push the flow unit to x2 :

p = -2

Page 186: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h-1,-1

h,-1 h,-1

h,1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

Push the flow unit to x2 :

1,1p = -2

Page 187: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h-1,-1

h,-1

h,1

Gf

h,0

p = -2h,-1

xn-1

p = -2p = -2p = -2

And then push the flow unit to x3 :

1,1

h-1,-1

1,1p = -2

Page 188: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h-1,-1

h,1

Gf

h,0

p = -2

xn-1

p = -2p = -2p = -2

And so on, until finally it reaches xn :

1,1

h-1,-1

1,1

h-1,-1

1,1

h-1,-1

1,1p = -2

Page 189: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h-1,-1

h,0

Gf

h,-1

p = -3

xn-1

p = -2p = -2p = -2

Relabel xn :

1,1

h-1,-1

1,1

h-1,0

1,0

h-1,-1

1,1p = -2

Page 190: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,2

h-1,-1

h,0

Gf

h-1,-1

p = -3

xn-1

p = -2p = -2p = -2

Push towards yn :

1,1

h-1,-1

1,1

h-1,0

1,0

h-1,-1

1,1

1,1

p = 0

p = -2

Page 191: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-1,-1

h,0

Gf

h-1,1

p = -3

xn-1

p = -2p = -2p = -2

Relabel yn :

1,1

h-1,-1

1,1

h-1,0

1,0

h-1,-1

1,1

1,-1

p = -2

p = -2

Page 192: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-1,-1

h,0

Gf

h,1

p = -3

xn-1

p = -2p = -2p = -2

Push back towards xn :

1,1

h-1,-1

1,1

h-1,0

1,0

h-1,-1

1,1

p = -2

p = -2

Page 193: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-1,-1

h,-1

Gf

h,0

p = -4

xn-1

p = -2p = -2p = -2

Relabel xn again:

1,1

h-1,-1

1,1

h-1,1

1,-1

h-1,-1

1,1

p = -2

p = -2

Page 194: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-1,-1

h-1,-1

Gf

h,0

p = -4

xn-1

p = -2p = -2p = -2

Choose (very unfavorably) to push back the flow immediately to x1 :

1,1

h-1,-1

1,1

h-1,1

1,-1

h-1,-1

1,1

p = -2

1,1

p = -2

Page 195: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-2,-1

h-1,-1

Gf

h,0

p = -41

xn-1

p = -2p = -2p = -2

Now the flow is pushed towards xn-1 :

2,1

h-2,-1

2,1

h-1,1

1,-1

h-2,-1

2,1

p = -2

1,1

p = -2

Page 196: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

-1

x1

x2 x3 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-2,-1

h-1,-1

Gf

h,0

p = -41

xn-1

p = -4p = -2p = -2

And xn-1 is relabeled:

2,1

h-2,-1

2,1

h-1,-1

1,1

h-2,1

2,-1

p = -2

1,1

p = -2

Page 197: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-3,-1

h-2,-1

Gf

h,0

p = -4

xn-1

p = -4p = -2p = -2

Now we can push back to xn-2 , but we choose (unfavorably) to do it through xn :

3,1

h-3,-1

3,1

h-2,-1

2,1

h-2,1

2,-1

p = -2

2,1

p = -2

Page 198: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 2

h, 2 h, 2 h,0

h-n+1,1

h-n+1,-1

Gf

h,0

p = -4

xn-1

p = -4p = -4p = -4

The process continue until, after n iterations, we return the flow to x1 :

n-1,-1

p = -2

n-1,1

p = -2h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

Page 199: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4h, 2 h, 2 h,0

h-n+1,-1

h-n+1,1

Gf

h,0

p = -4

xn-1

p = -4p = -4p = -4

We finish by relabeling x1 :

n-1,1

p = -2

n-1,-1

p = -4h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

Page 200: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,0

h-n+1,-1

h-n+1,1

Gf

h,0

p = -4

xn-1

p = -4p = -4p = -4

Notice that all the x nodes had their price reduced by two in this process:

n-1,1

p = -2

n-1,-1

p = -4h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

Page 201: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,0

h-n+1,-1

h-n+1,1

Gf

h,0

p = -4

xn-1

p = -4p = -4p = -4

Also, n-1 flow units have been returned from x1 to xn and passed through this arc:

n-1,1

p = -2

n-1,-1

p = -4h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

h-n+1,-1

n-1,1

Page 202: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,1

Gf

h,0

p = -4

xn-1

p = -4p = -4p = -4

Again, we can push the unit of flow all the way to xn :

n,1

p = -2

n-1,-1

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,-1

n,1

Page 203: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,0

Gf

h,-1

p = -5

xn-1

p = -4p = -4p = -4

Now relabel xn :

n,1

p = -2

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

Page 204: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

And push down to yn :

n,1

p = -2

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,-11,1

Page 205: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 xn-2 xn

y1

y2 y3yn

h-1, 4

h, 2 h, 2 h,-1

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

Relabel yn :

n,1

p = -3

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,01,0

Page 206: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h-1,-1

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

Now we can, for the first time, push the flow unit towards yn-1 :

n,1

p = -3

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,01,0

1

yn-1

h, 2

1,1

p = 0

Page 207: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h-1,1

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

We then relabel yn-1 :

n,1

p = -3

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,01,0

1

yn-1

h, 0

1,-1

p = -2

Page 208: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h,1

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

The flow is pushed back to yn :

n,1

p = -3

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,01,0

yn-1

h, 0

p = -2

Page 209: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

Relabel yn again:

n,1

p = -4

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h-1,11,-1

yn-1

h, 0

p = -2

Page 210: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,0

Gf

p = -5

xn-1

p = -4p = -4p = -4

The flow returns to xn with push:

n,1

p = -4

n-1,0

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,0

n,0

h,1

yn-1

h, 0

p = -2

Page 211: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,-1

Gf

p = -6

xn-1

p = -4p = -4p = -4

And xn is relabeled again:

n,1

p = -4

n-1,1

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,1

n,-1

h,0

yn-1

h, 0

p = -2

Page 212: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2 xn-2 xn

y1

y2yn

h-1, 4

h, 2 h, 2 h,0

h-n,-1

h-n-1,-1

Gf

p = -6

xn-1

p = -4p = -4p = -4

We will stop here, the behavior is clear…

n,1

p = -4

n-1,1

p = -4h-n,-1

n,1

h-n,-1

n,1

h-n,1

n,-1

h,0

yn-1

h, 0

p = -2

Page 213: Finding Minimum-Cost Circulation By Successive Approximation

Can We Get a Better Complexity?

Yes – using dynamic tree, we geta complexity for refine of 2lognm n m

Page 214: Finding Minimum-Cost Circulation By Successive Approximation

Can We Get a Better Complexity?

Yes – using dynamic tree, we geta complexity for refine of

Use finger search trees to find the first active vertex

Use dynamic trees for performing non-saturating pushes more efficiently (keep the edge list in a dynamic tree)

2lognm n m

Page 215: Finding Minimum-Cost Circulation By Successive Approximation

So Much for the Generic Method…

Page 216: Finding Minimum-Cost Circulation By Successive Approximation

Refine Using Dinic’s Ideas

In the Generic Method, we used ideas given by Goldberg & Tarjan in their Max-Flow Algorithm.

Our Min-Cost Circulation problem can also be solved using Dinic’s ideas for solving the Max-Flow problem, namely Blocking Flows.

We call this the Blocking-Flow Method.

Page 217: Finding Minimum-Cost Circulation By Successive Approximation

Recall that Dinic solved the Max-Flow problem solving O(n) Blocking-Flow problems.

It appears that refine can also be implemented in a similar manner!

Note – this does not imply that refine can be fully implemented by a Max-Flow algorithm (this is an open problem…)

Refine Using Dinic’s Ideas

Page 218: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow Method

Some definitions: Let G=(V,E), with 2 distinct vertices s and t. A pseudoflow is a flow if every vertex except s,t

has zero excess. A flow is blocking if every path from s to t

contains at least one saturates arc. Note that a maximum flow is blocking, but not

conversely!

Page 219: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow Method

Some definitions (cont.): Define S to be all the vertices reachable in the

current GA from vertices with positive excess.

| s.t. 0

and is reachable from inf

A

v V u V e uS

v u G

Page 220: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow MethodGA

Page 221: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow MethodGA

Page 222: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow Method

Some definitions (cont.): Let N be the auxiliary network formed from GA

by adding:A source and a sink (s & t)An arc (s,v) of capacity ef(v), for every v with ef(v)>0An arc (v,t) of capacity -ef(v), for every v with ef(v)<0

Page 223: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow MethodGA

Page 224: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow MethodGA

S t

Page 225: Finding Minimum-Cost Circulation By Successive Approximation

The Blocking-Flow MethodProcedure refine(ε,f,p):

[Initialization] ε ← ε/2; For every (v,w) in E do:

If cp(v,w) < 0 then f(v,w) ← u(v,w);[Loop] While f is not a circulation do:

Compute S, (price update)Build N, and find a blocking-flow fb on N (flow update)

Return (ε,f,p)End

,v S p v p v

, , , , ,A bv w E f v w f v w f v w

Page 226: Finding Minimum-Cost Circulation By Successive Approximation

x1

x2x3

y1

y2

y3

9,0

10,-2 10,-2

10,1 10,1

10,1

10,-2

Example – The Initial G(Assume G = Gf)

Gf

Page 227: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

ε ← ε/2 = 1

x1

x2x3

y1

y2

y3

9,0

10,-2 10,-2

10,1 10,1

10,1

10,-2

Gf

Page 228: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

At first all negative cost arcs are saturated

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,1

10,1

10,2

Gf

Page 229: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

The admissible graph

10

-10

x1

x2x3

y1

y2

y3

GA

Page 230: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S = {x3}

10

-10

x1

x2x3

y1

y2

y3

GA

Page 231: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

Decrease price of vertices in S

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,0

10,0

10,1

Gfp=-1

Page 232: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

Constructing N

10

-10

x1

x2x3

y1

y2

y3

GA

ts

10

10

Page 233: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

A blocking flow of 0 is found

10

-10

x1

x2x3

y1

y2

y3

GA

1010t

s

10

10

Page 234: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is still {x3}

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,0

10,0

10,1

Gfp=-1

Page 235: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

Decrease price of vertices in S={x3}

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,-1

10,-1

10,0

Gfp=-2

Page 236: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

The admissible graph now:

10

-10

x1

x2x3

y1

y2

y3

10,-1

10,-1

GAp=-2

Page 237: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

Constructing NA blocking flow of 0 is found

10

-10

x1

x2x3

y1

y2

y3

10,-1

10,-1GAp=-2

1010t

s

10

10

Page 238: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is now {x1,x2,x3}

10

-10

x1

x2x3

y1

y2

y3

9,0

10,2 10,2

10,1 10,-1

10,-1

10,0

Gfp=-2

Page 239: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

Decrease price of vertices in S={x1,x2,x3}

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,2 10,2

10,1 10,-1

10,-1

10,-1

Gfp=-3p=-1

p=-1

Page 240: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

The admissible graph now:

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,-1

10,-1

10,-1

GAp=-3

p=-1p=-1

Page 241: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineConstructing NA BF is found

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,-1

10,-1

10,-1

Gfp=-3

p=-1p=-1

ts

10

10

Page 242: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

10

-10

x1

x2x3

y1

y2

y3

9,-1

10,-1

10,-1

10,-1

Gfp=-3

p=-1p=-1

Constructing NA BF is found (9 flow units)

ts

10

10

Page 243: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineAdd the BF found to the pseudo flow:

1

-1

x1

x2x3

y1

y2

y3

9, 1

10,2 10,2

10,1 10,-1

1,-1

10,-1

Gfp=-3

p=-1p=-1

9, 1

Page 244: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineThe admissible graph:

1

-1

x1

x2x3

y1

y2

y3

10,-1

1,-1

10,-1

GAp=-3

p=-1p=-1

Page 245: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S={x1,x2,x3,y3}

1

-1

x1

x2x3

y1

y2

y3

10,-1

1,-1

10,-1

GAp=-3

p=-1p=-1

Page 246: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineDecrease prices of vertices in S

1

-1

x1

x2x3

y1

y2

y3

9, 2

10,2 10,1

10,1 10,-1

10,-1

Gfp=-4p=-2

p=-2

9, 1

p=-1

1,-1

Page 247: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineConstruct NA 0 BF is found

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

Gfp=-4

p=-2p=-2

p=-1

1,-1

ts

1

1

Page 248: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is still {x1,x2,x3,y3}

1

-1

x1

x2x3

y1

y2

y3

9, 2

10,2 10,1

10,1 10,-1

10,-1

Gfp=-4

p=-2p=-2

9, 1

p=-1

1,-1

Page 249: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineDecrease prices of vertices in S

1

-1

x1

x2x3

y1

y2

y3

9, 3

10,2 10,0

10,1 10,-1

10,-1

Gfp=-5p=-3

p=-3

9, 1

p=-2

1,-1

Page 250: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineConstruct NA 0 BF is found

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

Gf 1,-1p=-5

p=-3p=-3

p=-2

ts

1

1

Page 251: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is still {x1,x2,x3,y3}

1

-1

x1

x2x3

y1

y2

y3

9, 3

10,2 10,0

10,1 10,-1

10,-1

Gfp=-5

p=-3p=-3

9, 1

p=-2

1,-1

Page 252: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineDecrease prices of vertices in S

1

-1

x1

x2x3

y1

y2

y3

9, 3

10,2 10,-1

10,1 10,-1

10,-1

Gfp=-6p=-4

p=-4

9, 1

p=-3

1,-1

Page 253: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineThe admissible graph:

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

10,-1

GAp=-6

p=-4p=-4

p=-3

1,-1

Page 254: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineConstruct N

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

10,-1

p=-6p=-4

p=-4

p=-3

1,-1

ts

1

1

Page 255: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is now {x1,x2,x3,y2,y3}

1

-1

x1

x2x3

y1

y2

y3

9, 3

10,2 10,-1

10,1 10,-1

10,-1

Gfp=-6

p=-4p=-4

9, 1

p=-3

1,-1

Page 256: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineDecrease prices of vertices in S

1

-1

x1

x2x3

y1

y2

y3

9, 4

10,1 10,-1

10,1 10,-1

10,-1

Gfp=-7p=-5

p=-5

9, 1

p=-4p=-1

1,-1

Page 257: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineBuild N

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

10,-1

p=-7p=-5

p=-5

p=-4p=-1

ts

1

1

1,-1

Page 258: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is still {x1,x2,x3,y2,y3}

1

-1

x1

x2x3

y1

y2

y3

9, 4

10,1 10,-1

10,1 10,-1

10,-1

Gfp=-7

p=-5p=-5

9, 1

p=-4p=-1

1,-1

Page 259: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineDecrease prices of vertices in S

1

-1

x1

x2x3

y1

y2

y3

9, 5

10,0 10,-1

10,1 10,-1

10,-1

Gfp=-8p=-6

p=-6

9, 1

p=-5p=-2

1,-1

Page 260: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineBuild N

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

10,-1

p=-8p=-6

p=-6

p=-5p=-2

1,-1

ts

1

1

Page 261: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

S is still {x1,x2,x3,y2,y3}

1

-1

x1

x2x3

y1

y2

y3

9, 5

10,0 10,-1

10,1 10,-1

10,-1

Gfp=-8

p=-6p=-6

9, 1

p=-5p=-2

1,-1

Page 262: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of Refine

1

-1

x1

x2x3

y1

y2

y3

9, 6

10,-1 10,-1

10,1 10,-1

10,-1

Gfp=-9p=-7

p=-7

9, 1

p=-7p=-3

Decrease prices of vertices in S

1,-1

Page 263: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineThe admissible graph:

1

-1

x1

x2x3

y1

y2

y3

10,-1

10,-1

10,-1

GA 1,-1

10,-1

p=-9p=-7

p=-7

p=-7p=-3

Page 264: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineBuild N and find a BF (1 flow unit)

1

-1

x1

x2x3

y1

y2

y3

10,-1 10,-1

10,-1

10,-1

Gfp=-9

p=-7p=-7

p=-7p=-3

1,-1

ts

1

1

Page 265: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineAdd the BF to the pseudo flow

x1

x2x3

y1

y2

y3

9, 6

9,-1 9,-1

10,1 10,-1

9,-1

Gfp=-9

p=-7p=-7

9, 1

p=-7p=-3

1,1 1,1

1,1

1,-1

p=0

Page 266: Finding Minimum-Cost Circulation By Successive Approximation

An Iteration of RefineNo more active vertices – iteration over!

x1

x2x3

y1

y2

y3

9, 6

9,-1 9,-1

10,1 10,-1

9,-1

Gfp=-9

p=-7p=-7

9, 1

p=-7p=-3

1,1 1,1

1,1

1,-1

p=0

Page 267: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

The following strong lemma proves the main ideas of the Blocking-Flow Method:

Page 268: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Lemma 8.1a. The set S computed in the inner loop

contains only vertices with ef(v)≥0.b. At the beginning of every iteration of the

inner loop, f is ε-optimal w.r.t. p; Decreasing the prices of vertices in S preserve ε-optimality.

c. GA remains acyclic throughout the algorithm (as before).

Page 269: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Lemma 8.1a – Proof:By induction on the number of iterations of

the inner loop: Base – Initially, there are no arcs in GA, so only

ef(v)>0 vertices are contained in S. Step – We add a blocking flow on N, which, by

definition, disconnects all paths from ef(v)>0 vertices to ef(v)<0 vertices!

Page 270: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

We will look at a path from s to t

After the BF is found at least one arc is saturated on every path, hence the green vertex is not reachable from the red (active) vertex.

What happens if the first or last arc is saturated?

s t

Page 271: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Lemma 8.1b – Proof:By the same induction:

Base – At the first iteration, f is ε-optimal. Step – The price decrease of vertices in S

preserves ε-optimality:The decrease does not affect arcs from S to S or from

S to S.Arcs from S to S have their reduced cost increased.Arcs from S to S have their reduced cost decreased

by ε, but recall that beforehand cp(v,w)≥0 !

Page 272: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Ss t

Suppose this is the state before the price reduction in S:

S

Page 273: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Ss t

Arcs within S are not effected

S

Page 274: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Ss t

Same goes for arcs in S

S

Page 275: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Ss t

Arcs going from S to S have their reduced cost increased

S

Page 276: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Ss t

Arcs going from S to S have their reduced cost decreased, but still greater than -ε!

S

Page 277: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

Lemma 8.1c – Proof:By the same induction:

Base – Initially, there are no arcs in GA. Step – The price decrease can add arcs from S

to S, but will make all arcs from S to S non- admissible, thus GA remains acyclic.

Page 278: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Correctness

From 8.1b we conclude that f is ε-optimal at all times during the inner loop.

Therefore, if refine terminates, the returned f is an ε-optimal circulation, as needed!

Thus the correction of the Blocking-Flow Method is proven.

Page 279: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Complexity

We will bound the number of iterations of the inner loop of refine:

Lemma 8.2The number of inner loops is at most 3n

Page 280: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Complexity

Proof:Note that the inner loop never changes the

vertex excess from non-negative to negative or from non-positive to positive.

Page 281: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Complexity

Proof:Note that the inner loop never changes the

vertex excess from non-negative to negative or from non-positive to positive.

Only non-negative excess vertices have their price changed by iε after i iterations (this results from 8.1a).

Page 282: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Complexity

Proof:Note that the inner loop never changes the

vertex excess from non-negative to negative or from non-positive to positive.

Only non-negative excess vertices have their price changed by iε after i iterations.

Recall Lemma 5.8 –The price reduction is at most 3nε, and the bound is obtained!

Page 283: Finding Minimum-Cost Circulation By Successive Approximation

Blocking-Flow Method Complexity

Lemma 8.3The Blocking-Flow Method takes

time, giving a total algorithm bound of

where B(n,m) is the time to find a blocking flow in an acyclic network (here we make use of 8.1c)

,O nB n m

, logO nB n m nC

Page 284: Finding Minimum-Cost Circulation By Successive Approximation

And That’s That for Dinic…

Page 285: Finding Minimum-Cost Circulation By Successive Approximation

ConclusionThe main ideas presented:Successive approximation – finding an

approximated (ε-optimal) solution “good enough” for optimality.

The algorithm framework achieves this concept using a refine method.

Recall that this only works for integer costs, to get log(nC) iterations.

Page 286: Finding Minimum-Cost Circulation By Successive Approximation

ConclusionThe main ideas presented:We saw two ways for implementing refine:

The Generic Method – push & relabel The Blocking-Flow Method

Both methods can be implemented efficiently to achieve complexity of(or using Dynamic Trees)

3O n

2logO nm n m

Page 287: Finding Minimum-Cost Circulation By Successive Approximation

Questions???