* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Idan Maor
Perturbation theory wikipedia , lookup
Lateral computing wikipedia , lookup
Three-phase traffic theory wikipedia , lookup
Genetic algorithm wikipedia , lookup
Computational electromagnetics wikipedia , lookup
Inverse problem wikipedia , lookup
Knapsack problem wikipedia , lookup
Computational complexity theory wikipedia , lookup
Dynamic programming wikipedia , lookup
Multi-objective optimization wikipedia , lookup
Rental harmony wikipedia , lookup
Computational fluid dynamics wikipedia , lookup
Travelling salesman problem wikipedia , lookup
Mathematical optimization wikipedia , lookup
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).
π
β’ πππ
the flow of commodity k over (i,j).
1
(πππ , πΆππ
,
example
πΆππ2 )
(5,-1,4)
π 1
π‘1
(7,-2,-4)
1
(10,-6,-3)
(10,0,0)
2
(4,0,0)
(7,-4,-2)
π 2
(5,4,-1)
π‘2
1
(πππ , πΆππ
,
example
πΆππ2 )
|πππ1 | = 5
π 1
π‘1
(7,-2,-4)
1
(10,-6,-3)
(10,0,0)
2
(4,0,0)
(7,-4,-2)
π 2
(5,4,-1)
π‘2
1
(πππ , πΆππ
,
example
πΆππ2 )
|πππ1 | = 5
π 1
π‘1
(7,-2,-4)
1
(10,-6,-3)
(10,0,0)
2
(4,0,0)
(7,-4,-2)
π 2
|πππ2 | = 5
π‘2
1
(πππ , πΆππ
,
example
πΆππ2 )
π 1
|πππ1 | = 5
|πππ1 |
=7
π‘1
|πππ1 | = 7
1
|πππ1 | = 7
(3,-6,-3)
2
(3,0,0)
(4,0,0)
(7,-4,-2)
π 2
|πππ2 | = 5
π‘2
1
(πππ , πΆππ
,
example
πΆππ2 )
π 1
|πππ1 | = 5
|πππ1 |
=7
|πππ1 | = 7
1
|πππ2 | = 3
(4,-4,-2)
π 2
π‘1
|πππ1 | = 7
2
|πππ2 | = 3
|πππ2 | = 3
|πππ2 | = 3
|πππ2 | = 5
π‘2
1
(πππ , πΆππ
,
example
πΆππ2 )
π 1
(5,-1,4)
πππ1 = 5
|πππ1 |
=7
|πππ1 |
(7,-2,-4)
1
|πππ2 | = 3
=7
(10,-6,-3)
|πππ2 | = 3
π‘1
|πππ1 | = 7
2
(10,0,0)
|πππ2 | = 3
|πππ2 | = 3
(4,0,0)
(7,-4,-2)
π 2
(5,4,-1)
|πππ2 | = 5
π π
πππ π‘ = 1β€πβ€πΎ (π,π)βπΈ π₯ππ
πππ =(5*-1)+(7*-2)+(7*-6)+(7*0)+
(5*-1)+(3*-2)+(3*-3)+(3*0)+(3*0)=-85
π‘2
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.
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.
π 1
π 2
β’
The solution is 0.
(β,-1,-1)
(β,-1,-1)
π‘2
π‘1
Some observations
π 1
(β,-1)
π‘2
(β,0)
(β,0)
π 0
π 2
(β,0)
(β,0)
π 2
β’
The solution is - β.
(β,-1)
π‘1
the flow can be fractional, Even if the cost and
capacities are integers
β’ Unit Capacity.
β’ Cost is -1
π‘3
π1
1
π 2
2
π‘1
π‘2
3
π 3
the flow can be fractional, Even if the cost and
capacities are integers
β’ Unit Capacity.
β’ Cost is -1.
β’ Option 1:
1 unit flow
From s1 to t1.
Result -4.
π‘3
π1
1
π 2
2
π‘1
π‘2
3
π 3
the flow can be fractional, Even if the cost and
capacities are integers
β’ Unit Capacity.
β’ Cost is -1.
β’ Option 2:
1 unit flow
From s2 to t2.
Result -4.
π‘3
π1
1
π 2
2
π‘1
π‘2
3
π 3
the flow can be fractional, Even if the cost and
capacities are integers
β’ Unit Capacity.
β’ Cost is -1.
β’ Option 3:
1 unit flow
From s3 to t3.
Result -4.
π‘3
π1
1
π 2
2
π‘1
π‘2
3
π 3
the flow can be fractional, Even if the cost and
capacities are integers
β’ Unit Capacity.
β’ Cost is -1.
β’ Option 4:
1/2 unit flow
From s1 to t1
From s2 to t2
From s3 to t3
Result -6.
π‘3
π1
1
π 2
2
π‘1
π‘2
3
π 3
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.
Formal definition
β’ Min
1β€πβ€πΎ
π π
π₯
(π,π)βπ΄ ππ πππ
β’ Subject to :
β
π
π₯
π ππ β€ πππ β (i,j) Ο΅A
β
π
π₯
π ππ β
π
π₯
π ππ = π π
π
π
β π₯ππ
β₯ 0 βπΟ΅πΎ β (i,j) Ο΅A
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.
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.
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.
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.
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.
Optimality conditions
The dual linear program is :
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:
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.
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 :
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 :
Partial dualization
Ο
π
β’ πππ
=(πππ
+π€π,π ) β π π (i)+π π (j).
1)
β’ The correctness is due to the fact that
π€π,π are optimal.
π
π¦ππ
and
Partial dualization
Ο
π
β’ πππ
=(πππ
+π€π,π ) β π π (i)+π π (j).
2)
β’ The correctness is due to the fact that
π€π,π are optimal.
π
π¦ππ
and
Partial dualization
Ο
π
β’ πππ
=(πππ
+π€π,π ) β π π (i)+π π (j).
3)
β’ The correctness is due to the fact that
π€π,π are optimal.
π
π¦ππ
and
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.
Lagrangian Relaxation
β’ The multi commodity flow problem:
β’ Subject to :
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 :
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.
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, Ξ±)
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).
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.
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.
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Ο΅ππ .
formulation with Path Flows
β’
Let notice that :
πΆ π (p)=
π
(π,π)βπ΄ πππ
πΏπ,π (p) =
π
(π,π)βπ πππ
β’
π
We can write each flow variable π₯ππ
as decomposition of path flow:
π
π₯ππ
= πβππ πΏπ,π (p)f(p).
β’
So we can represent the objective function in the terms of path flows:
π π
1β€πβ€πΎ (π,π)βπ΄ π₯ππ πππ =
π
(π,π)βπ΄ πππ [ πβππ πΏπ,π (p)f(p)]=
πΆ π (p)π(π)
1β€πβ€πΎ (π,π)βπ΄
.
formulation with Path Flows
β’ The path flow linear program:
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.
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.
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 :
ππΟ,π€ =π π (π)+
(π,π)βπ π€π,π
β ππ =
π
(πππ
+π€π,π ) β π π
(π,π)βπ
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:
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 :
π
(πππ
+π€π,π ) = π π
(π,π)βπ
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.
High level description of
the simplex algorithm
1. Select a basis B that deο¬nes 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 value
a.
b.
then chose it, and increase it until a variable that is the base reach to
zero.
Stop and return the solution.
Some observations about
the 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.
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.
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.
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.
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.
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. π π,π
= [ 1β€πβ€πΎ πβππ πΏπ,π (p)f(p) β π’π,π ].
β’ 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.
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:
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.
Resource-Directive Decomposition
π
β’ r=(ππ,π
) to be the resource allocation vector.
β’ Letβs define the resource allocation problem using r:
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 :
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.
Resource-Directive Decomposition
If (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) = πβπΎ π§ π (π π )β€ 1β€πβ€πΎ π π π₯ π .
According to the definition of the recourse allocation problem.
Resource-Directive Decomposition
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.
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).
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.
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 Ο=(ππ,π
).
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.
Finding a sub gradient of z(r).
a sub gradient Ο of z(r) at point r=π is any vector that satisfies
π§ π β₯ π§(π)+ Ο(r-π).
For all π = π1 , π 2 β¦ . , π πΎ with π π β π
π .
π
π - the set of all resource allocations for commodity k, such that
the sub problem is feasible .
Finding a sub gradient of z(r).
Claim :
let πΎ π πππ 1 β€ π β€ πΎ be a sub gradient of π§ π π π at the point π π ,
then πΎ=(πΎ 1 , πΎ 2 ,β¦., πΎ πΎ ) is a sub gradient of z(r) at π=(π1 , π 2 , β¦.
π πΎ ).
Proof:
1. Since πΎ π is a sub gradient of π§ π π π , π§ π π π β₯ π§ π (π π )+
πΎ π (π π -π π ), βπ π β π
πΎ .
2. z(r) = πβπΎ π§ π (π π )
3. Ο(rβπ) =
πβπΎ πΎ
π (π π βπ π )
Finding a sub gradient of π§
π
π
π .
Lets look on the network flow problem:
π§ π = min ππ₯: ππ₯ = π, 0 β€ π₯ β€ π , q is a vector of upper
bounds on the arc flows.
π₯ β βthe optimal solution when π β =q.
β
β
π₯π,π
< ππ,π
ππ,π ={ β
β
π₯π,π = ππ,π
0
π
ππ,π
Claim:
For any non negative vector qβ, for which the problem is feasible,
π§ π β² β₯ π§ π β + π(qβ-π β ).
i.e. π is a sub gradient of the objective function.
Finding a sub gradient of π§
π
Proof:
According to the definition of reduce cost cx=π π π₯ β ππ
π§ π β =π π π₯ β β ππ= ππ β βππ.
The last equality follows from the optimality condition :
π
β
β
ππ,π
=0 if 0 < π₯π,π
< ππ,π
, And the definition of π.
β
β
π₯π,π
< ππ,π
ππ,π ={ β
β
π₯π,π = ππ,π
0
π
ππ,π
π
π .
Finding a sub gradient of π§
Proof:
Let xβ be the solution of the problem when q=qβ.
Then π§ πβ² =π π π₯ β² β ππ β₯ πqβ βππ.
Since π π β₯ π and 0 β€ π₯ β² β€ πβ².
We got :
π§ πβ² β₯ πqβ βππ
π§ π β =ππ β βππ
π§ πβ² +ππ β βππ β₯ π§ π β +πqβ βππ
π§ πβ² β₯ π§ π β +π(qβ βπ β ).
π
π
π .
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
π
ππ,π
1β€πβ€πΎ (π,π)βπ΄
β
π
π β² π,π
2
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.
The
End