890 likes | 1.07k Views
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.
E N D
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. • This assumption may not be always true, like in transmission of unstable gas , or leaking pipes. u v k
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
Example Assume that V received 8 units of flow! u v 10
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
Formulation Of The Generalized Flow Problem(linear programming) • Minimize Subject to: And
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
Example Assume that and V received 8 units of flow and we pay 40 units not 32! u v X(u,v)=10
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 All arcs are forward arcs v u 1 0.5 4 4 5 3 2 1
Example ( , ) v u 1 0.5 4 4 5 3 2 1 • Add two units of flow from 1 to 2! • 2 receives 6 units of flow
Example ( , ) v u 1 (6,0.5) 4 4 5 3 2 1 • 2 send its 6 unit of flow out! • 3 receives 3 units of flow
Example ( , ) v u 1 0.5 (3,4) 4 5 3 2 1 • 3 send its 3 unit of flow out! • 4 receives 12 units of flow
Example ( , ) v u (12,1) 0.5 4 4 5 3 2 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 Not all arcs are forward arcs v u 6 2 4 3 2 1
Example ( , ) v u 6 2 4 3 2 1 • Add one units of flow from 1 to 2! • 2 receives 2 units of flow
Example ( , ) v u (-,6) 2 4 3 2 1 • 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
Example ( , ) v u 6 (2,) 4 3 2 1 • 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 .
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 lossycycle. • 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: • If then • If then • If then
Proof Claim 1 : minimizing is equivalent to minimizing Similar to a proof was given in the past Back to the sentence: letx be some arbitrary flow.
If then If then If then Looking at Let’s prove that each term in the summation is not negative: Lets look at the following 3 cases to prove this: • in this case it is given that • in this case =0, and because , we multiply two non negative numbers so the result is not negative. • in this case =, and because , we multiply two non positive numbers so the result is not negative.
So now , which means that . We showed that with the 3 conditions, some feasible flow is minimal.
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: • (because ) • (because ) • (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 v u (10,1) (5,2) (6,3) (10,2) (8,3)
Example Special arc Determine root (10,1) (5,2) (6,3) (10,2) (8,3)
Example Special arc Running DFS(not including the special arc), going to red. root (10,1) (5,2) (6,3) (10,2) (8,3)
Example Special arc Running DFS(not including the special arc), going to yellow. root (10,1) (5,2) (6,3) (10,2) (8,3)
……… Special arc root (10,1) (5,2) (6,3) (10,2) (8,3)
Special Arc Special arc root (10,1) (5,2) (6,3) Time complexity: O(n) (10,2) (8,3)
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: More of the tree After update, we delete the leaf node j and the relevant edge e(i)+ e(i) j j 0 e(j) j is a leaf node
Case 2: More of the tree After update, we delete the leaf node j and the relevant edge e(i)+ e(i) j j 0 e(j) j is a leaf node
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)