generalized flows
DESCRIPTION
GENERALIZED FLOWS. Jonathan Kalechstain 27.5.2013 Tel Aviv University. Introduction. Until now, we made an assumption that if k units of flow leaves node u, then k units of flow arrives at node v. - PowerPoint PPT PresentationTRANSCRIPT
Introduction
โข Until now, we made an assumption that if k units of flow leaves node u, then k units of flow arrives at node v.
โข This assumption may not be always true, like in transmission of unstable gas , or leaking pipes.
uk
v
Using multipliers
โข We are given a graph โข We associate a positive with every arc โข Assume that if 1 unit of flow was sent from
node i along the arc then units of flow arrived at node j.
โข Notice that the model is a generalization of the minimal cost flow problem, with every arc having the multiplier
Notations and Assumptions
โข G=(V,E) is a directed graphโข Capacity function u(v,w) > 0 for every โข Cost function c(v,w) for every โข An arc multiplier for every โข Balance function b(v) for every we will have a
numberโ b(v) > 0 โ supplyโ b(v) < 0 โ demand
An Important Remark
โข is an upper bound on the flow that we send from i, not the flow that arrives at node j.
โข is the cost per unit flow we send from i, not the per unit cost that arrives at node j
Flows along Paths
โข Let P be a path from node s to node t (not directed) in the network. Let and denote the sets of forward arcs and backwards arcs in P.
โข Definition: the path multiplier of a path P is defined as follows:
Forward arc means that if we send flow along a path, the arc is the same direction as the path.If itโs in opposite direction we call it a backward arc
Example
u v
( , )
1 2 3 4 5(2,3) 0.5 4 1
โข Add two units of flow from 1 to 2!โข 2 receives 6 units of flow
Example
u v
( , )
1 2 3 4 53 (6,0.5) 4 1
โข 2 send its 6 unit of flow out!โข 3 receives 3 units of flow
Example
u v
( , )
1 2 3 4 53 0.5 (3,4) 1
โข 3 send its 3 unit of flow out!โข 4 receives 12 units of flow
Example
u v
( , )
1 2 3 4 53 0.5 4 (12,1)
โข 4 send its 12 unit of flow out!โข 5 receives 12 units of flow โข 2 units were first sent, and eventually 12 were
received. Notice the relation is 6
Example
1 2 3 4(1,2) 6 2
โข Add one units of flow from 1 to 2!โข 2 receives 2 units of flow
u v
( , )
Example
1 2 3 42 (-,6) 2
โข In order to keep the mass balance constraint, after node 2 got 2 units of flow, 3 decreases itโs flow by one third of a unit
โข 2 receives -2 units of flow
u v
( , )
Example
1 2 3 42 6 (2,)
โข Now to keep the mass balance constraint node 3 adds of flow.
โข Node 4 receives extra units of flow.โข So after sending 1 unit of flow from 1, 4 gets units. Therefore the multiplier is .
u v
( , )
Conclusion
โข Property 1: If we send 1 unit of flow from node s to another node t along a path P, then units become available at node t.
Flows along Cycles
โข Let W be a path from node s to itself (not directed, with some orientation) in the network. Let and denote the sets of forward arcs and backwards arcs in W.
โข The cycle multiplier of a circle W is :
Some definitions
โข If , then an excess is created in node s. we call this a gainy cycle.
โข If , then a deficit is created in node s. we call this a lossy cycle.
โข If , then mass balanced is conserved in all nodes. we call this a breakeven cycle.
๐ (๐ )=โ
(๐ , ๐ )โ๐๐๐ , ๐
โ(๐ , ๐ )โ๐
๐๐ , ๐
โข Property 2: if is the multiplier of a cycle W with a particular orientation, then is the multiplier of the same cycle with opposite direction
Proof: nominator and denominator switch by definition. โข Property 3: if the cycle is loosy with one
orientation and gainy with the other.
๐ (๐ )=โ
(๐ , ๐ )โ๐๐๐ , ๐
โ(๐ , ๐ )โ๐
๐๐ , ๐
โข Property 4: By sending units along a nonbreakeven cycle starting at node s, we create an imbalance of units at node s.
Proof: at first we send units, and then by property 1, units arrive back at node s, so the size of the imbalance is -
Reminder:Property 1: If we send 1 unit of flow from node s to another node t along a path P, then units become available at node t.
Augmented Tree
โข Let be a subgraph of such that and . โข is considered an augmented tree if is a
spanning tree of together with some extra edge which is called the extra arc
โข An augmented tree has a designated node called the root. Each augmented tree is hanging from itโs root
Example
b and c are two augmented trees of the graph a. The extra arc is represented by a dashed line
โข An augmented tree contains exactly one circle.โข The cycle is referred to as the extra cycleโข An augmented tree is called a good
augmented tree if for the extra cycle W
Augmented Forest
โข We define an augmented forest when as a collection of node-disjoint augmented trees that span all the nodes in the graph.
โข An augmented forest is considered good if each of itโs components is a good augmented tree.
โข See 2 slides ago at d, to see an example of an augmented forest of the graph.
โข The arcs of the augmented forest are called augmented-forest arcs and the remaining arcs are called nonaugmented-forest arcs
Augmented Forest Structures and Optimality Conditions
โข Let โข Let define a partition of E, and let F be a good
augmented forest.โข we refer to the arcs in L as nonaugmented-
forest arcs at their lower boundโข we refer to the arcs in U as nonaugmented-
forest arcs at their upper bound.โข The triple defines an augmented forest
structure.
Feasibility
โข An augmented forest structure is feasible if we set and and the flow X on the augmented-forest arcs satisfy the generalized flow definition (mass balance constraints and flow bounds).โข We say that an augmented forest structure is nondegenerate
if โข We will also say that a feasible augmented forest structure is
an optimal augmented forest structure if its associated flow X is an optimal solution of the generalized flow problem
Node Potentials and Reduced Costs
โข Let be the node potentials functionโข With respect to , we define the reduced cost
of an arc as :
Generalized Flow Optimality Condition
โข A flow x* is an optimal solution of the generalized network flow problem if it is feasible and for some potential function the following conditions are satisfied:
1. If then 2. If then 3. If then
Proof
Claim 1 : minimizing is equivalent to minimizing Similar to a proof was given in the past
Back to the sentence: let x be some arbitrary flow.
Looking at Letโs prove that each term in the summation is not negative:Lets look at the following 3 cases to prove this:1. in this case it is given that 2. in this case =0, and because , we multiply two
non negative numbers so the result is not negative.
3. in this case =, and because , we multiply two non positive numbers so the result is not negative.
1. If then 2. If then 3. If then
Augmented Forest Structure Optimality Conditions
This propertyโs proof is immediate from the last sentence: โข A feasible augmented forest structure with the
associated flow is an optimal augmented forest structure if for some function the pair satisfy the following optimality conditions:
1. (because ) 2. (because ) 3. (because )
Determining Node Potentials for an Augmented Forest Structure
โข Let be an augmented forest structure. The augmented forest F contains several augmented trees.
โข The following algorithm is performed per tree.โข Let be some augmented tree, and let node h
be itโs root. โข We would like to satisfy the condition that , so
we use the following equation:
The main idea
โข We start by setting which will be determined later.
โข We then use DFS on the not directed tree T, and because of connectivity and DFS properties, we will always know or when , so for each node we will get a single equation with one variable (and ).
โข We use the extra arc to determine , and update the potentials (they are linear functions of ).
Example(๐ ๐ , ๐ ,๐๐ , ๐)
๐
Special arc
(10,1)
(10,2)
(5,2)
(8,3)
(6,3)
Determine root
๐ (๐ข)
Example(๐ ๐ , ๐ ,๐๐ , ๐)
๐
Special arc
(10,1)
(10,2)
(5,2)
(8,3)
(6,3)
1. Running DFS(not including the special arc), going to red.
root
๐ (๐ข)
๐โ10
Example(๐ ๐ , ๐ ,๐๐ , ๐)
๐
Special arc
(10,1)
(10,2)
(5,2)
(8,3)
(6,3)
1. Running DFS(not including the special arc), going to yellow.
root
๐ (๐ข)
๐โ10
3 ๐โ22
โฆโฆโฆ(๐ ๐ , ๐ ,๐๐ , ๐)
๐
Special arc
(10,1)
(10,2)
(5,2)
(8,3)
(6,3)
root
๐ (๐ข)
๐โ10
3 ๐โ22
โ2.5+0.5 ๐
โ6.25+0.25 ๐
Special Arc(๐ ๐ , ๐ ,๐๐ , ๐)
โ17
Special arc
(10,1)
(10,2)
(5,2)
(8,3)
(6,3)
root
๐ (๐ข)
โ27
โ73
โ11
โ10.5
Time complexity: O(n)
Determining Flow for an Augmented Forest Structure
โข Let be an augmented tree structure with the current assumption that the network is uncapacitated, which means .
โข We present an algorithm determining the flow for each augmented tree.
โข In this algorithm we start from the leaf nodes, and advance toward the root.
โข Let be some augmented tree of the forest.โข We define as the imbalance of a node, and
begin with .โข We set the flow of the extra arc and all other
arcs get flow 0.โข We can say we decreased the imbalance at
node a by units, and increased it at node b by units.
โข Now we start updating the graph in the following way:
Case 1:
j
e(j)
๐
e(i)
More of the tree
j is a leaf node
j
๐
e(i)+
0
๐ฅ ๐ ,๐=0 ๐ฅ ๐ ,๐=๐( ๐)
After update, we delete the leaf node j and the relevant edge
Case 2:
j
e(j)
๐
e(i)
More of the tree
j is a leaf node
j
๐
e(i)+
0
๐ฅ๐ , ๐=0 ๐ฅ๐ , ๐=โ๐( ๐)๐๐ , ๐
After update, we delete the leaf node j and the relevant edge
โข After updating the rest of the leaves (each time we get a new tree ) each arc is a function of
โข we set , calculate the value of , and place it in all of the arcs flows.
โข Now we have a flow that satisfy the mass balance constraint (if all arcs were not capacitated)
Running Example
๐๐ , ๐ ,๐ฅ ๐ , ๐
e(i)
e(j)
Special arc
(1,0)
0 0
10 -20
(3,0) (2,0)
5
(1,0)
(0.5, )
Running Example
๐๐ , ๐ ,๐ฅ ๐ , ๐
e(i)
e(j)
Special arc
(1,0)
0 0
-20
(3,0) (2,0)
5
(1,0)
(0.5, )
We set :
10
Running Example
(๐ยฟยฟ ๐ , ๐ ,๐ฅ ๐ , ๐)ยฟ
e(i)
e(j)
Special arc
(1,0)
โ๐ 0.5 ๐
-20
(3,10) (2,0)
5
(1,0)
Now lets look at the yellow leaf:We have an edge (yellow,red)So :
Flow(yellow,red)=10(0.5, )
10
Running Example
(๐ยฟยฟ ๐ , ๐ ,๐ฅ ๐ , ๐)ยฟ
e(i)
e(j)
Special arc
(1,0)
โ๐+30 0.5 ๐
-20
(2,10)
5
(1,0)
Now lets look at the green leaf:We have an edge (blue,green)So :
Flow(blue,green)=10(0.5, )
Running Example
(๐ยฟยฟ ๐ , ๐ ,๐ฅ ๐ , ๐)ยฟ
e(i)
e(j)
Special arc
(1,0)
โ๐+30 0.5 ๐โ10
5
(1,0)
Now lets look at the blue leaf:We have an edge (black,blue)So :
Flow(black,blue)=(0.5, )
Running Example
(๐ยฟยฟ ๐ , ๐ ,๐ฅ ๐ , ๐)ยฟ
e(i)
e(j)
Special arc
โ๐+30
0.5 ๐โ5
(1,0)
Now lets look at the red leaf:We have an edge (black,red)So :
Flow(black,red)=
Now to determine :
โข It is easy to prove this algorithm finds a unique flow and value of .
โข Eventually we get some linear function of for โข It is important to show that g(root) is never 0.
Proof:
โข It is easy to see that is the imbalance of the root, resulting from setting the flow on the arc as
โข Setting the flow on the arc as creates a deficit of units at a, and an excess of at b. let denote the tree path from x to y, and let denote the path multiplier.
โข We can cancel the deficit at node a by sending from the root, and cancel the excess at node b by sending from node b to the root ( units arrive at the root)
โข So using the last conclusions we can say that g(root)=
โข So g(root)==1, but this is exactly the multiplier of the circle.
So if the circle is not breakeven (i.e the augmented tree is good), the proof stands.
Extending to capacitated case
1. The initialization is the same.2. For every do begin :setting the required flow : set deficit : set excess.
3. Run the previous algorithm
Conclusion about the flow
โข We need the augmented trees to be good augmented tree.
โข Our flow satisfy mass balance constraint, but doesnโt promise the flow is legitimate (e.g. negative flow as seen in example)
โข The flow on the arcs of the augmented forest that satisfy the mass balance constraint is unique, so the forest structure is feasible if and only if the flow bounds are satisfied
Properties from linear programming (no proof)
โข Arcs in a set B have a unique solution if and only if B is a good augmented forest
โข A set B of arcs defines a basis(an extreme point on the polytope) of the generalized network problem if and only if B is a good augmented forest.
This means that there exist an optimal solution for a good augmented tree.
The Generalized Network Simplex Algorithm
โข This algorithm maintains a good feasible augmented forest structure at every iteration, using pivot rules to eventually reach an improved augmented forest structure that satisfies the optimality conditions
Obtaining an Initial Good Augmented Forest Structure
โข Easy to achieve an artificial initial augmented forest structure, simply by adding self edges with sufficiently large cost, infinite capacity and appropriate multipliers on these edges.
โข We will avoid full details and proof but assume we have a good initial augmented forest structure.
โข Computing x and like explained in previous slides.
Initial Augmented Forest
0 0
-20
5
10
(๐ยฟยฟ ๐ , ๐ ,๐ ๐ , ๐ ,๐ข๐ , ๐)ยฟ
b(i)
(0.5
(2 (2
(2(0.5
The forest is the set of self arcs.
Set
M is big enough so that if a feasible solution exists, no optimal solution with positive flow on the self arcs exists.
Optimality Testing and the Entering Arc
To determine whether a spanning tree structure is optimal we check:
If the spanning tree structure satisfies the conditions it is optimal
we terminate
Else, the algorithm selects a non-forest violating arc to enter the forest:
70
Pivot Rules
For any eligible arc (i, j) we refer to II as its violation.The network simplex algorithm can select any eligible arc to enter the tree and still would terminate finitely(with some provisions for dealing with degeneracy)
Pivot rules for selecting entering arcs:โข Dantzig's pivot ruleโข First eligible arc pivot ruleโข Candidate list pivot rule
These rules were shown in the simplex lecture
Identifying the Leaving Arc
โข Assume the entering arc is (will prove only for this case).โข Denote as the change in flow units for if we use 1
unit of flow on โข If we knew the values then it would be easy to know
the maximum number of flow we can use on so all edges will remain between their lower and upper bound.
โข This promise we have an arc that reached itโs lower or higher bound โ this is the arc we drop.
Determine
โข Use the Algorithm presented before to compute the value of each arc in the trees of k,l:
โข At first the flow is 0 for all edges, and the imbalance vector is:
e(i) = -1 if i=k e(i) = if i=l e(i) = 0 else The arc flow we obtain are the values
Determine the Maximum Flow On (k,l) Within the Bounds
โข If we add units of flow to (k,l) then to keep the flow bounds :
โข It is easy to see that if then the edge will go up to itโs lower bound, and if then the opposite will happen.
โข Denote by the maximum number of units allowed to use to make reach itโs lower\upper bound then:
โข So the largest value for which is feasible is
โข We augment units on the arc and change the value of each arc to .
โข The leaving arc is one of the arcs for which is defined (the blocking arc).
โข We say that the iteration is not degenerate if (or else we had a degenerate tree)
โข All of these actions take O(m) time
Updating the Augmented Forest
โข When leaving arc (p, q) is determined for a given entering arc (k, I), we updates the tree structure
โข If the leaving arc is the same as the entering arc, (when ฮด = ฮดpq =upq), the tree does not change.-the arc (k, I) merely moves from the set L to the set U, or vice versa.
โข If the leaving arc differs from the entering arc, we need to prove we still have a good augmented forest. We use the fact that the simplex method moves from one basis to another, and each basis is a good augmented forest.
Updating Potentials, Tree Indices
โข Use the node potential algorithm presented before for the new tree(s) O(n) time.
โข Update the tree indices โ can do it from scratch in O(n) time.
Termination (1)
โข The Algorithm moves from one feasible augmented forest structure to the other until it satisfies the optimality conditions.
โข In a pivot operation, the objective function value decreases by the amount of at every iteration (no proof)
โข If each pivot operation is nondegenrate (i.e ) each subsequent augmented forest structure has a smaller cost.
Termination (2)
โข Since any network has a finite number of augmented forest structures, and each augmented forest structure has a unique associated cost(which decreases with every iteration), the generalized network simplex algorithm terminates.
Dealing with Degenerate Pivots
โข We define as an n-vector whose elements are for a sufficiently small real number .
โข If we replace by it is possible to prove that the augmented forest structure at every iteration is not degenerate and therefore the algorithm terminates.
โข It is also possible to prove that an optimal augmented forest structure of the perturbed problem is also an optimal augmented forest structure of the original problem.
Complexityโข #of iterations * complexity of iteration.โข Cannot bound the number of iterations by any polynomial p(n,m).โข In practice the number of iterations is generally a low order
polynomial p(n,m).โข All of the operations: identifying the entering arc, computing
values, updating flows, potentials and tree indices require O(m) time.
So in practice the time complexity is a low order polynomial p(n,m).โข Empirical investigations found that the generalized network simplex
algorithm is 2 to 3 times slower than that of the minimal cost simplex algorithm.
An Application Example
โข Sally owns a warehouse of fixed capacity 1000 units to store a type of wine whose price is unstable
โข She knows the price of the product for the next 3 time periods, and she needs to manage her purchases, sales and storage patterns.
โข Suppose she holds units of the wine, and she has dollars in assets.
โข In each period she can sell and buy wine under the limitations.โข The price of the wine varies(we define it as at time i) and
ultimately all of the wine must be sold.โข The idea is to maximize the amount of cash available at the end
of the third period.
, )Warehouse:Can store 1000 units of wine=10,000$
1 2 3v
1โ 2โ 3โ 4โ
sell sell sell
buy buy
u v
(๐๐๐ ๐ก ,๐๐๐๐๐๐๐ก๐ฆ ,๐๐ข๐๐ก๐๐๐๐๐๐ )
(๐๐๐ฃ๐๐๐ก๐๐๐ฆh๐๐๐๐๐๐$
๐ข๐๐๐ก,1000 ,1)
(0 ,โ ,๐๐๐๐ ๐๐๐ก๐๐๐ ๐ก)
(0 ,โ ,๐3)(0 ,โ ,
1๐1
)
Flow represent wine quantity here
Flow represent $ here