Multi commodity  flows

73
Multi commodity flows Idan Maor Tel Aviv University

description

Multi commodity  flows. Idan Maor Tel Aviv University. interdiction. G=(N,A) is a directed graph capacity for every i,j V: If (i,j)  A then = 0 . k pairs of distinguished vertices, (s1, t1),…(sk, tk). the cost of sending 1 unit of commodity k over ( i ,j). - PowerPoint PPT Presentation

Transcript of Multi commodity  flows

Page 1: Multi commodity  flows

 Multi commodity flows

Idan MaorTel Aviv University

Page 2: Multi commodity  flows

interdiction• G=(N,A) is a directed graph

• capacity for every i,j V: If (i,j) A then = 0 .

• k pairs of distinguished vertices, (s1, t1),…(sk, tk).

• the cost of sending 1 unit of commodity k over (i,j).

• the flow of commodity k over (i,j).

Page 3: Multi commodity  flows

example

𝑡1

𝑡 2

𝑠1

𝑠2

21

(5,-1,4)

(7,-2,-4)

(7,-4,-2)

(5,4,-1)

(10,-6,-3) (10,0,0)

(4,0,0)

(, , )

Page 4: Multi commodity  flows

example

𝑡1

𝑡 2

𝑠1

𝑠2

21

|

(7,-2,-4)

(7,-4,-2)

(5,4,-1)

(10,-6,-3) (10,0,0)

(4,0,0)

(, , )

Page 5: Multi commodity  flows

example

𝑡1

𝑡 2

𝑠1

𝑠2

21

|

(7,-2,-4)

(7,-4,-2)

|

(10,-6,-3) (10,0,0)

(4,0,0)

(, , )

Page 6: Multi commodity  flows

example

𝑡1

𝑡 2

𝑠1

𝑠2

21

|

(7,-4,-2)

|

(3,-6,-3)(3,0,0)

(4,0,0)

|

||

(, , )

Page 7: Multi commodity  flows

example

𝑡1

𝑡 2

𝑠1

𝑠2

21

|

(4,-4,-2)

|

|

||

| |

| |

(, , )

Page 8: Multi commodity  flows

example(, , )

𝑡1

𝑡 2

𝑠1

𝑠2

21

𝑓 𝑖𝑗1=5

|

|| |

| | |

|

(5,-1,4)

(7,-2,-4)

(7,-4,-2)

(5,4,-1)

(10,-6,-3) (10,0,0) (4,0,0)

=(5*-1)+(7*-2)+(7*-6)+(7*0)+(5*-1)+(3*-2)+(3*-3)+(3*0)+(3*0)=-85

Page 9: Multi commodity  flows

Some observations

• If there is only one commodity the problem is min-cost max flow.

• We can not use the simple reduction to min cost max flow by adding a super source and a super sink .

• the flow can be fractional, Even if the cost and capacities are integers.

• If there is a demand that the flow will be integer, then the problem is NP –Complete.

• Even for unit capacities, and 2 commodities.

Page 10: Multi commodity  flows

Some observations

• We can not use the simple reduction to min cost max flow by adding a super source and a super sink, even if the all the costs are the same.

• The solution is 0.

𝑡 2

𝑡1

𝑠1

𝑠2

(∞,-1,-1)

(∞,-1,-1)

Page 11: Multi commodity  flows

Some observations

• The solution is - ∞.

𝑡 2

𝑡1

𝑠1

𝑠2

(∞,-1)

(∞,-1)

𝑠0 𝑠2

(∞,0)

(∞,0)(∞,0)

(∞,0)

Page 12: Multi commodity  flows

the flow can be fractional, Even if the cost and capacities are integers

• Unit Capacity.• Cost is -1 𝑆1

𝑡1

𝑡 3

𝑡 2

𝑠3

𝑠2 32

1

Page 13: Multi commodity  flows

• Unit Capacity.• Cost is -1.• Option 1: 1 unit flow From s1 to t1.Result -4.

𝑆1

𝑡1

𝑡 3

𝑡 2

𝑠3

𝑠2 32

1

the flow can be fractional, Even if the cost and capacities are integers

Page 14: Multi commodity  flows

• Unit Capacity.• Cost is -1.• Option 2: 1 unit flow From s2 to t2.Result -4.

𝑆1

𝑡1

𝑡 3

𝑡 2

𝑠3

𝑠2 32

1

the flow can be fractional, Even if the cost and capacities are integers

Page 15: Multi commodity  flows

• Unit Capacity.• Cost is -1.• Option 3: 1 unit flow From s3 to t3.Result -4.

𝑆1

𝑡1

𝑡 3

𝑡 2

𝑠3

𝑠2 32

1

the flow can be fractional, Even if the cost and capacities are integers

Page 16: Multi commodity  flows

• Unit Capacity.• Cost is -1.• Option 4: 1/2 unit flow From s1 to t1From s2 to t2From s3 to t3Result -6.

𝑆1

𝑡1

𝑡 3

𝑡 2

𝑠3

𝑠2 32

1

the flow can be fractional, Even if the cost and capacities are integers

Page 17: Multi commodity  flows

Assumptions

• Homogeneous goods, Each unit of flow of commodity k over (i,j)  consume one unit of capacity.

•  No congestion, there is no interaction between the goods meaning the cost is linear in the flow.

• Indivisible goods, flow can be fractional.

Page 18: Multi commodity  flows

Formal definition

• Min

• Subject to :–   (i,j) ϵA

–  (i,j) ϵA

Page 19: Multi commodity  flows

Solution approaches

• Good news : We can solve the problem using linear programming.

• Bad News: up to date, there is no other way to solve the problem precisely without using linear programming.

• All the approaches will be based on linear programming.

Page 20: Multi commodity  flows

Solution approaches

• Price-directive decomposition.– This approach will remove the bundle constraints(  (i,j) ϵA), and by that we decompose the problem to K separated min-cost flow problems.

– Instead of the constraints this approach “charge“ some price from each commodity for using the arc.

Page 21: Multi commodity  flows

Solution approaches• Resource-directive decomposition.

– This approach will be based, that every optimal solution for the problem will result by flow  on each arc.

– So we can consider the problem as a resource allocation problem, we will allocate a capacity for each arc and commodity.

– The problem decompose to K separated min-cost flow problems.

– This approach start with initial capacity's, and the improve them iteratively.

Page 22: Multi commodity  flows

Optimality conditions• Since the multi commodity flow problem is a linear programming 

problem we can use the linear programming optimality conditions.

• The linear programming problem has two constraints:– A bundle constraint for every arc.   (i,j) ϵA.

– A mass balance constraint for every node. 

• The dual linear has two types of variables:– A price  on each arc.– A node potential (i) for each node and commodity.

Page 23: Multi commodity  flows

Optimality conditions

Using the dual variables the Reduce cost for the problem• =+(i)+(j).• - is the arc price, it provide linkage between the different reduced costs.

• (i)- then  i node potential for commodity k.

Page 24: Multi commodity  flows

Optimality conditions

The dual linear program is :

Page 25: Multi commodity  flows

Multi commodity flow complementary slackness conditions

• Using the dual theorem of linear programming, We get that :

• The commodity flow optimal if and only if, there exists node potentials (i), and non negataive arc prices such that:

Page 26: Multi commodity  flows

Multi commodity flow complementary slackness conditions

• The arc prices are the linkage between the different commodity's, if some arc is not saturated then  can be equal to 0.

Page 27: Multi commodity  flows

Partial dualization

• If are optimal flow and are optimal arc prices for the multi commodity problem then for each commodity k,  are also the optimal solution for the following incapacitated min cost flow problem :

Page 28: Multi commodity  flows

Partial dualization

• In the min cost flow problem a solution x* is an optimal solution if and only if there exits a set of node potentials π, such the reduced costs and flow values satisfy :

Page 29: Multi commodity  flows

Partial dualization

• =+(i)+(j).1)• The correctness is due to the fact that  and  are optimal.

Page 30: Multi commodity  flows

Partial dualization

• =+(i)+(j).2)• The correctness is due to the fact that  and  are optimal.

Page 31: Multi commodity  flows

Partial dualization

• =+(i)+(j).3)• The correctness is due to the fact that  and  are optimal.

Page 32: Multi commodity  flows

Partial dualization• The property of partial dualization, give us a an approach for solving the problem.

• We first find optimal arc prices and then attempt to find the optimal node potentials and flows by solving the single-commodity minimum cost flow problems.

• This approach is the Price-directive decomposition.

Page 33: Multi commodity  flows

Lagrangian Relaxation

• The multi commodity flow problem:

• Subject to :

Page 34: Multi commodity  flows

Lagrangian Relaxation• In order to apply the Lagrangian Relaxation on the multi 

commodity flow problem , we associate non negative multipliers  and create the Lagrangian sub problem:

• Or equivalently :

• Subject to :

Page 35: Multi commodity  flows

Lagrangian Relaxation• Since the sub problem is defined for a given multipliers, the 

term  is constant and we can formulate the sub problem as :

• The resulting objective function has a cost of   associated with every flow variable .

• Since the constraints contains only one flow variable per commodity, we can decompose the problem to K min cost flow problems.

Page 36: Multi commodity  flows

Lagrangian Relaxation procedure

1. Solve the min cost flow problem for each of the commodity's, for a fixed lagrangian multiplier, with cost 

2. Update the multipliers in the following way:

– the optimal solution of the min cost flow problem of the last iteration.

–Max(0, α)

Page 37: Multi commodity  flows

Lagrangian Relaxation procedure

• The scalar  is the step size, and it specifies how far we move from the current solution.

• Notice that the arc prices change the following way:o  if the total flow we use is greater then the 

capacity, we raise the arc price.o Otherwise we lower the arc price(but keep it non 

negative).

Page 38: Multi commodity  flows

Lagrangian Relaxation procedure

• Advantages:o Using this procedure lets us exploit the underlying network flow structure.

o The updating of the lagrange multipliers is simple.o We can use it partly, for getting a good base for the simplex algorithm. 

• Disadvantages:o In order to ensure that the method converge, we need to take small step 

sizes, and as result it does not converge fast.o Since the method is dual based then even if we find the optimal 

multipliers , is does not promise us that the flow variables  are optimal.

Page 39: Multi commodity  flows

Column generation approach

In order to simplify the problem, in this part will add a new assumptions:• Each commodity k has a single source  and single sink , and a flow requirement .

• There are no negative cycles in the network.• Since there are no negative cycles, there exits an optimal solution such that the flow on each cycle is zero.

Page 40: Multi commodity  flows

Reformulation with Path Flows

• - the collection of all paths from to , in the network.

• f(p) – the flow on path pϵ

• (p) - an arc path indicator variable, that is (p)=1, if arc (i,j)ϵp and (p)=0 otherwise.

• (p)- the cost of unit flow on path pϵ.

Page 41: Multi commodity  flows

formulation with Path Flows• Let notice that :

(p)= (p) =

• We can write each flow variable  as decomposition of path flow:=.

• So we can represent the objective function in the terms of path flows:=

 []=

.

Page 42: Multi commodity  flows

formulation with Path Flows

• The path flow linear program:

Page 43: Multi commodity  flows

formulation with Path Flows

• The path flow formulation has one constraint per arc : 

• The path flow formulation has one constraint for each commodity: 

• The path flow can have an exponential number of variables, since there is a variable for each path in the graph.

Page 44: Multi commodity  flows

Arc formulation Vs Path formulation category Arc formulation Path formulation

Number of constraints m + n*K m + K

Number of variables m*n*k exponential

The exponential number of variables are not a pitfall for this approach, since the linear pogromming structure promise us that there exits an optimal solution with at most m+ K paths .

there is no need to represents all the columns (paths), all the time we can use lazy approach and generate only when nodded.

Page 45: Multi commodity  flows

Optimality conditions• We will use the linear programming problem optimality conditions.

• the path flow formulation has one bundle constraint for each arc, the dual linear program will have The arc price .

• the path flow formulation has one demand constraint for each commodity, the dual linear program will have  for each commodity.

• Using the dual variables we can define the reduce cost for the path flow formulation as :

 =+

Page 46: Multi commodity  flows

Path flow complementary slackness conditions

• The commodity path flow f(p) optimal if and only if, there exists commodity prices  and arc prices such that:

Page 47: Multi commodity  flows

Path flow complementary slackness conditions

• The condition:Just state that if we don’t use the total capacity of some arc, then the arc price   can be zero.

• From  ,we can understand that every path p in the basis satisfies =0.  Since 

• So we get every path p in the basis :

Page 48: Multi commodity  flows

Path flow complementary slackness conditions

From , we get that :

•  is the shortest path from node to  with respect to the modified costs .

• in the optimal solution every path p that carries a flow from node to must be the shortest path with respect to the modified costs.

• With this result we can decompose the multi commodity problem to independent shortest path problems.

Page 49: Multi commodity  flows

High level description ofthe simplex algorithm

1. Select a basis B that defines a bfs(basic feasible solution).

2. Calculate the objective function value of this bfs.

3. If there exits a variable that is not in the basis and can lower the objective function valuea.  then chose it, and increase it until a variable that is the base reach to 

zero.b. Stop and return the solution.

Page 50: Multi commodity  flows

Some observations aboutthe simplex algorithm

• The simplex method maintains a basis B at each iteration.

• Using the basis B it defines a set of multipliers π(in our case they are  and ), such that πB = (matrix notion).

• The method define the simplex multipliers so the reduce cost   of the basic variables will be equal to zero(=- πB).

• It’s easy to see that we don’t require information about variables that are not in the base in order to calculate the multipliers.

Page 51: Multi commodity  flows

Column Generation Solution Procedure

• To use the Colum generation approach we need to show, how to enter a non basic variable to the basis without examine every Colum.

• Since the simplex algorithm maintain the multipliers    and  such the reduce cost of every basic variable is zero =0 , we just need to check if there exits a path that it cost with respect to the modified costs  is negative.

• if there exits such a path we can return the path and enter it to the base, otherwise the solution is optimal.

Page 52: Multi commodity  flows

Column Generation Solution Procedure

• We can find such path easily by running a shortest path algorithm for each commodity k, with respect to the modified costs  .

• If there is no path that it’s length is negative then we are done, else we found a path and we will enter it as the new variable and recalculate the appropriate new multipliers  and  such the reduce cost of every basic variable is zero =0 .

• The rest of the steps are the same as in the simplex algorithm.

Page 53: Multi commodity  flows

Column Generation Solution Procedure

• Claim: the solution is optimal if all the paths length in the network with respect to the modified costs  are non negative.

• Proof : the solution is optimal if it stratify the complementary slackness.

Page 54: Multi commodity  flows

Column Generation Solution Procedure

• it’s easy to see that this condition is satisfied since the reduce cost ()of all paths in the base is zero, and the flow(f(p)) on the paths that are not in the base is zero.

• This is the assumption of the claim.

Page 55: Multi commodity  flows

Column Generation Solution Procedure

• Let look on the slack variable  , this variable state how much of the capacity of the edge is used, i.e. ].

• If  is not the base then  = 0(variables that are not in the base are equal to 0).

• otherwise  is in the base and its reduce cost is 0- equal to 0, so we get that =0.

Page 56: Multi commodity  flows

Resource-Directive Decomposition• In The resource directive decomposition approach, we will 

allocate an individual capacity for each commodity per arc. the resulting resource directive problem:

Page 57: Multi commodity  flows

Resource-Directive Decomposition• Lets define r=() to be the resource allocation vector.• The resource directive problem is equivalent to the multi 

commodity problem in the sense that :

– If (x,r) is feasible in the resource directive problem then x is a feasible solution for the multi commodity problem and both problems has the same objective function value.

– If x is a feasible solution for the original problem and we set r=x, we will get a solution at least as good as in the resource directive problem.

  

Page 58: Multi commodity  flows

Resource-Directive Decomposition• r=() to be the resource allocation vector.

• Let’s define the resource allocation problem using r:

Page 59: Multi commodity  flows

Resource-Directive Decomposition• It’s easy to see that for a fixed value of resource vector r, the 

resource directive problem decompose to K independent network min cost max flow problems.

• z(r) =min  • The value of  of the k sub problem  :

Page 60: Multi commodity  flows

Resource-Directive Decomposition• The resource directive problem to the resource allocation 

problem in the sense that :

1. If (x,r) is feasible in the resource directive problem , then r is feasible in the resource allocation problem and .

2. If r is a feasible in the resource allocation problem then for some vector x, (x,r) is a feasible solution for the resource directive problem and z(r)=cx.

Page 61: Multi commodity  flows

Resource-Directive DecompositionIf (x,r) is feasible in the resource directive problem , then r is feasible in the resource allocation problem and .

Proof: it’s easy to see that if (x,r) is feasible in the resource directive problem then r is also feasible in the resource allocation problem, since the problems share the same resources contrarians 

For the second part since x is feasible for every commodity we get :z(r) = ≤.According to the definition of the recourse allocation problem.

Page 62: Multi commodity  flows

Resource-Directive DecompositionIf r is a feasible in the resource allocation problem then for some vector x, (x,r) is a feasible solution for the resource directive problem and z(r)=cx.

Proof: If r is a feasible solution for the resource allocation problem then by the definition of =cx for some vector x.So x there a vector x that satisfies z(r)=c(x).

Page 63: Multi commodity  flows

Resource-Directive Decomposition• From the previous property we can conclude that instead of solving the 

multi commodity problem we can solve the resource allocation problem by having a problem with simple constrains but a complex objective function z(r).

• Although the objective function z(r) is complicated it’s easy to calculate, for a fixed vector r we only need to compute the K min cost max flow problems.

• The objective function of the resource allocation problem z(r) is piecewise linear convex function of r.

• Both properties(the convexity and the piecewise linearity), derived from the fact that the resource allocation is a special case of linear programing.

Page 64: Multi commodity  flows

Solving the Resource-Directive Model• Since the objective function is non differentiable we can not 

use gradient optimization methods.

• Instead we could use heuristic methods such as “one arc at a time”, i.e. adding 1 unit to  and subtracting 1 unit from This is a simple approach but it’s does not promise convergence.

• We can view the changing of the resource allocation of r as: r=r+θϒ. that is a step size θ in a direction ϒ=().

Page 65: Multi commodity  flows

Solving the Resource-Directive Model

• Similar to sub gradient optimization we would like to choose a step size θ in a direction ϒ such that promise :– Feasibility.– Convergence to the optimal solution.

•  in order to achieve this goals we will use a two steps  approach:– We will find a sub gradient direction and a step size that will ensure 

convergence.– If moving to r+θϒ, will make solution non feasible we will transform it 

to a point r’ that will be feasible.

 

Page 66: Multi commodity  flows

Finding a sub gradient of z(r).a sub gradient ϒ of z(r) at point r= is any vector that satisfies )+ ϒ(r-).For all  with - the set of all resource allocations for commodity k, such that the sub problem is feasible .

Page 67: Multi commodity  flows

Finding a sub gradient of z(r).Claim :l be a sub gradient of at the point , then =(, ,…., ) is a sub gradient of z(r) at =(, , …. ).Proof:1. Since  is a sub gradient of ,  )+ (-), .2. z(r) =  

Page 68: Multi commodity  flows

Finding a sub gradient of .Lets look on the network flow problem: , q is a vector of upper bounds on the arc flows.

the optimal solution when  =q. ={Claim:For any non negative vector q’, for which the problem is feasible, (q’-).i.e.  is a sub gradient of the objective function.

Page 69: Multi commodity  flows

Finding a sub gradient of .Proof:According to the definition of reduce cost cx===  .

The last equality follows from the optimality condition :=0 if And the definition of   ={

Page 70: Multi commodity  flows

Finding a sub gradient of .Proof:Let x’ be the solution of the problem when q=q’.Then =q’ .Since   and .We got : q’ = 

+ +q’ +(q’ ).

Page 71: Multi commodity  flows

Converting a non feasible solution After receiving the new resource allocation vector r, we need to verify the feasibility.If it’s not feasible we need to move to another point r’ in order to preserve the feasibility. one approach that ensures that the algorithm converges is to choose the closet point to r, in the sense to minimize 

Page 72: Multi commodity  flows

Conclusion We can solve the problem in the following way :• Solve the k min cost max flow problem with the current 

resource allocation.• Find the sub gradient of the resource allocation according to 

the sub gradient of each of the min cost max flow problems.• Update the resource allocation according to r=r+ϒθ.• If the new resource allocation is feasible, continue with it, 

otherwise move to the point r’ that is closet feasible point to r.

Page 73: Multi commodity  flows

The End