Jonathan Kalechstain

advertisement
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
k
v
Using multipliers
• We are given a graph 𝐺 = (𝑉, 𝐸)
• We associate a positive πœ‡π‘–,𝑗 with every arc
𝑖, 𝑗 ∈ E
• 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 πœ‡π‘–,𝑗 = 1
Example
Assume that πœ‡π‘’,𝑣 = 0.8
V received 8 units of
flow!
u
10
v
Notations and Assumptions
•
•
•
•
•
G=(V,E) is a directed graph
Capacity function u(v,w) > 0 for every (𝑣, 𝑀) ∈ 𝐸
Cost function c(v,w) ≥ 0 for every 𝑣, 𝑀 ∈ 𝐸
An arc multiplier πœ‡π‘£,𝑀 ≥ 0 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
0 ≤ π‘₯ 𝑖, 𝑗 ≤ 𝑒 𝑖, 𝑗 , ∀(𝑖, 𝑗) ∈ 𝐸
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 πœ‡π‘’,𝑣 = 0.8 and 𝑐 𝑒, 𝑣 = 4
V received 8 units of
flow and we pay 40
units not 32!
u
X(u,v)=10
v
Augmented Forest
structures
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
πœ‡π‘–,𝑗
1
u
v
3
0.5
2
1
4
3
4
5
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
v
u
(2,3)
1
0.5
2
• Add two units of flow from 1 to 2!
• 2 receives 6 units of flow
1
4
3
4
5
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
v
u
3
1
(6,0.5)
2
• 2 send its 6 unit of flow out!
• 3 receives 3 units of flow
1
4
3
4
5
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
1
u
v
3
0.5
2
• 3 send its 3 unit of flow out!
• 4 receives 12 units of flow
1
(3,4)
3
4
5
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
1
u
v
3
0.5
4
3
2
• 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
πœ‡ 𝑃 =
(𝑖,𝑗)∈𝑃
πœ‡π‘–,𝑗
(𝑖,𝑗)∈𝑃 πœ‡π‘–,𝑗
(12,1)
4
=
3∗0.5∗4∗1
1
=6
5
Example
Not all arcs are
forward arcs
πœ‡π‘–,𝑗
v
u
2
1
6
2
2
3
4
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
v
u
(1,2)
1
6
2
• Add one units of flow from 1 to 2!
• 2 receives 2 units of flow
2
3
4
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
1
u
v
2
(-3,6)
1
2
2
3
• 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
4
Example
( π‘₯ 𝑖, 𝑗 π‘Žπ‘‘π‘‘π‘–π‘‘π‘–π‘œπ‘›, πœ‡π‘–,𝑗 )
v
u
2
1
πœ‡ 𝑃 =
(𝑖,𝑗)∈𝑃
πœ‡π‘–,𝑗
(𝑖,𝑗)∈𝑃 πœ‡π‘–,𝑗
=
2∗2
6
1
6
(2,3)
3
2
• Now to keep the mass balance constraint node 3 adds
1
of flow.
3
2
• Node 4 receives 3 extra units of flow.
2
• So after sending 1 unit of flow from 1, 4 gets 3 units.
2
Therefore the multiplier is 3 .
4
=
2
3
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 πœ‡ π‘Š > 1, then an excess is created in node
s. we call this a gainy cycle.
• If πœ‡ π‘Š < 1, then a deficit is created in node
s. we call this a lossy cycle.
• If πœ‡ π‘Š = 1, then mass balanced is
conserved in all nodes. we call this a
breakeven cycle.
πœ‡ π‘Š =
πœ‡
(𝑖,𝑗)∈π‘Š 𝑖,𝑗
(𝑖,𝑗)∈π‘Š πœ‡π‘–,𝑗
• Property 2: if πœ‡ π‘Š is the multiplier of a cycle
1
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 πœ‡ π‘Š ≠ 1 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 |πœƒ ∗
πœ‡ π‘Š − 1 | 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 G =
(𝑉, 𝐸) 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
πœ‡(W) ≠ 1
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 nonaugmentedforest arcs at their lower bound
• we refer to the arcs in U as nonaugmentedforest arcs at their upper bound.
• The triple (𝐹, 𝐿, π‘ˆ) defines an augmented
forest structure.
Feasibility
• An augmented forest structure (𝐹, 𝐿, π‘ˆ) is feasible if we set
π‘₯𝑖,𝑗 = 0 ∀ 𝑖, 𝑗 ∈ 𝐿 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 0 < π‘₯𝑖,𝑗 < 𝑒𝑖,𝑗 , ∀ 𝑖, 𝑗 ∈ 𝐹
• 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 πœ‹: V → R 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 0 < π‘₯𝑖,𝑗
< 𝑒𝑖,𝑗 then 𝑐𝑖,𝑗
=0
πœ‹
∗
2. If π‘₯𝑖,𝑗
= 0 then 𝑐𝑖,𝑗
≥0
πœ‹
∗
3. If π‘₯𝑖,𝑗
= πœ‡π‘–,𝑗 then 𝑐𝑖,𝑗
≤0
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.
1.
2.
3.
∗
πœ‹
If 0 < π‘₯𝑖,𝑗
< πœ‡π‘–,𝑗 then 𝑐𝑖,𝑗
=0
∗
πœ‹
If π‘₯𝑖,𝑗
= 0 then 𝑐𝑖,𝑗
≥0
∗
πœ‹
If π‘₯𝑖,𝑗
= 𝑒𝑖,𝑗 then 𝑐𝑖,𝑗
≤0
πœ‹
∗
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. 0 < π‘₯𝑖,𝑗
< 𝑒𝑖,𝑗 in this case it is given that 𝑐𝑖,𝑗
=0
∗
∗
πœ‹
2. π‘₯𝑖,𝑗
= 0 in this case π‘₯𝑖,𝑗 ≥ π‘₯𝑖,𝑗
=0, and because 𝑐𝑖,𝑗
≥
0, we multiply two non negative numbers so the
result is not negative.
∗
∗
3. π‘₯𝑖,𝑗
= 𝑒𝑖,𝑗 in this case π‘₯𝑖,𝑗 ≤ π‘₯𝑖,𝑗
=𝑒𝑖,𝑗 , and because
πœ‹
𝑐𝑖,𝑗
≤ 0, we multiply two non positive numbers so the
result is not negative.
So now 𝑐 πœ‹ ∗ π‘₯ − π‘₯ ∗ = 𝑐 πœ‹ π‘₯ − 𝑐 πœ‹ π‘₯ ∗ ≥ 0, 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:
πœ‹
∗
1. 𝑐𝑖,𝑗
= 0, ∀ 𝑖, 𝑗 ∈ 𝐹 (because 0 ≤ π‘₯𝑖,𝑗
≤ 𝑒𝑖,𝑗 )
πœ‹
∗
2. 𝑐𝑖,𝑗
≥ 0, ∀ 𝑖, 𝑗 ∈ 𝐿 (because 0 = π‘₯𝑖,𝑗
)
πœ‹
∗
3. 𝑐𝑖,𝑗
≤ 0, ∀ 𝑖, 𝑗 ∈ π‘ˆ (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
πœ‹
𝑐𝑖,𝑗
= 0, ∀ 𝑖, 𝑗 ∈ 𝐹 , so we use the following
πœ‹
equation: 𝑐𝑖,𝑗 = 𝑐𝑖,𝑗 − πœ‹ 𝑖 + πœ‡π‘–,𝑗 πœ‹ 𝑗 = 0
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 𝑐𝑖,𝑗 − πœ‹ 𝑖 +
πœ‡π‘–,𝑗 πœ‹ 𝑗 = 0, 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
πœƒ).
Algorithm pseudo code
Example
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
v
u
(10,1)
(5,2)
(6,3)
(8,3)
(10,2)
Special arc
Example
Special arc
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
πœ‹(𝑒)
Determine
πœ‹ π‘Ÿπ‘œπ‘œπ‘‘ = πœƒ
root
πœƒ
(10,1)
(5,2)
(6,3)
(8,3)
(10,2)
Example
Special arc
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
πœ‹(𝑒)
root
πœƒ
(10,1)
πœƒ − 10
(8,3)
(5,2)
(6,3)
(10,2)
1. Running DFS(not including
the special arc), going to
red.
2. π‘π‘π‘™π‘Žπ‘π‘˜,π‘Ÿπ‘’π‘‘ − πœ‹ π‘π‘™π‘Žπ‘π‘˜ +
πœ‡π‘π‘™π‘Žπ‘π‘˜,π‘Ÿπ‘’π‘‘ πœ‹ π‘Ÿπ‘’π‘‘ =
10 − πœƒ + 1 ∗ πœ‹ π‘Ÿπ‘’π‘‘ = 0
→ πœ‹ π‘Ÿπ‘’π‘‘ = πœƒ − 10
Example
Special arc
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
πœ‹(𝑒)
root
πœƒ
(10,1)
πœƒ − 10
(8,3)
3πœƒ − 22
(5,2)
(6,3)
(10,2)
1. Running DFS(not including
the special arc), going to
yellow.
2. π‘π‘¦π‘’π‘™π‘™π‘œπ‘€,π‘Ÿπ‘’π‘‘ − πœ‹ π‘¦π‘’π‘™π‘™π‘œπ‘€
+ πœ‡π‘¦π‘’π‘™π‘™π‘œπ‘€,π‘Ÿπ‘’π‘‘ πœ‹ π‘Ÿπ‘’π‘‘ =
8 − πœ‹ π‘¦π‘’π‘™π‘™π‘œπ‘€ + 3 ∗ πœƒ − 10
=0
→ πœ‹ π‘¦π‘’π‘™π‘™π‘œπ‘€ = 3πœƒ − 22
………
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
πœ‹(𝑒)
root
πœƒ
(10,1)
πœƒ − 10
(8,3)
3πœƒ − 22
(6,3)
(5,2)
−2.5 + 0.5πœƒ
(10,2)
−6.25 + 0.25πœƒ
Special arc
Special Arc
Special arc
(𝑐𝑖,𝑗 , πœ‡π‘–,𝑗 )
πœ‹(𝑒)
root
−17
(10,1)
−27
(8,3)
−73
(6,3)
(5,2)
−11
(10,2)
−10.5
π‘π‘Ÿπ‘’π‘‘,𝑏𝑙𝑒𝑒 − πœ‹ π‘Ÿπ‘’π‘‘
+ πœ‡π‘Ÿπ‘’π‘‘,𝑏𝑙𝑒𝑒 πœ‹ 𝑏𝑙𝑒𝑒 =
6 − πœƒ − 10 + 3(−2.5 + 0.5πœƒ)
=0
→ 0.5θ = −8.5 → πœƒ = −17
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:
More of
the tree
e(i)+πœ‡π‘—,𝑖 𝑒(𝑗)
e(i)
𝑖
𝑖
π‘₯𝑗,𝑖 = 0
π‘₯𝑗,𝑖 = 𝑒(𝑗)
j
j
e(j)
0
j is a leaf
node
After update, we delete
the leaf node j and the
relevant edge
Case 2:
More of
the tree
After update, we delete
the leaf node j and the
relevant edge
𝑒(𝑗)
e(i)
e(i)+ πœ‡
𝑖,𝑗
𝑖
𝑖
π‘₯𝑖,𝑗 = 0
π‘₯𝑖,𝑗 = −
j
j
e(j)
0
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 𝑒 π‘Ÿπ‘œπ‘œπ‘‘ = 0, 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)
Pseudo code
Running Example
5
e(i)
πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗
(1,0)
(1,0)
0
0
(0.5, πœƒ)
(3,0)
e(j)
10
(2,0)
-20
Special arc
Running Example
5
e(i)
πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗
(1,0)
(1,0)
0
0
(0.5, πœƒ)
(3,0)
e(j)
10
(2,0)
-20
Special arc
We set :
𝑒 π‘Ÿπ‘’π‘‘ = 𝑒 π‘Ÿπ‘’π‘‘ − πœƒ = −πœƒ
𝑒 𝑏𝑙𝑒𝑒 = 𝑒 𝑏𝑙𝑒𝑒 +
πœ‡π‘Ÿπ‘’π‘‘,𝑏𝑙𝑒𝑒 πœƒ = 0.5πœƒ
Running Example
5
e(i)
(πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗 )
(1,0)
(1,0)
−πœƒ
0.5πœƒ
(0.5, πœƒ)
(3,10)
e(j)
10
(2,0)
-20
Special arc
Now lets look at the yellow leaf:
We have an edge (yellow,red)
So :
𝑒 π‘¦π‘’π‘™π‘™π‘œπ‘€ = 0
𝑒 π‘Ÿπ‘’π‘‘ = 𝑒 π‘Ÿπ‘’π‘‘ +
πœ‡π‘¦π‘’π‘™π‘™π‘œπ‘€,π‘Ÿπ‘’π‘‘ ∗ 10 = −πœƒ + 3 ∗ 10
= −πœƒ + 30
Flow(yellow,red)=10
Running Example
5
e(i)
(πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗 )
(1,0)
(1,0)
−πœƒ + 30
0.5πœƒ
(0.5, πœƒ)
e(j)
(2,10)
-20
Special arc
Now lets look at the green leaf:
We have an edge (blue,green)
So :
𝑒 π‘”π‘Ÿπ‘’π‘’π‘› = 0
𝑒 𝑏𝑙𝑒𝑒 = 𝑒 𝑏𝑙𝑒𝑒 −
20
= 0.5πœƒ − 10
πœ‡π‘π‘™π‘’π‘’,π‘”π‘Ÿπ‘’π‘’π‘›
Flow(blue,green)=10
Running Example
5
e(i)
(πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗 )
(1,0)
(1,0)
−πœƒ + 30
0.5πœƒ − 10
(0.5, πœƒ)
e(j)
Special arc
Now lets look at the blue leaf:
We have an edge (black,blue)
So :
𝑒 𝑏𝑙𝑒𝑒 = 0
𝑒 π‘π‘™π‘Žπ‘π‘˜ = 𝑒 π‘π‘™π‘Žπ‘π‘˜ +
0.5πœƒ − 10
= 0.5πœƒ − 5
1
Flow(black,blue)=−0.5πœƒ + 10
Running Example
0.5πœƒ − 5
e(i)
(πœ‡π‘–,𝑗 , π‘₯𝑖,𝑗 )
e(j)
(1,0)
−πœƒ + 30
Special arc
Now lets look at the red leaf:
We have an edge (black,red)
So :
𝑒 π‘Ÿπ‘’π‘‘ = 0
𝑒 π‘π‘™π‘Žπ‘π‘˜ = 𝑒 π‘π‘™π‘Žπ‘π‘˜ +
−πœƒ + 30
= −0.5πœƒ + 25
1
Flow(black,red)=πœƒ − 30
Now to determine πœƒ:
−0.5πœƒ + 25 = 0 → πœƒ = 50
Final flow
5
b(i)
20
π‘₯𝑖,𝑗
-15
0
0
50
10
b(j)
10
10
-20
Special arc
• It is easy to prove this algorithm finds a
unique flow and value of πœƒ.
• Eventually we get some linear function of πœƒ
for 𝑒 π‘Ÿπ‘œπ‘œπ‘‘ = 𝑓 π‘Ÿπ‘œπ‘œπ‘‘ + g π‘Ÿπ‘œπ‘œπ‘‘ πœƒ = 0 →
πœƒ=
𝑓(π‘Ÿπ‘œπ‘œπ‘‘)
−
𝑔(π‘Ÿπ‘œπ‘œπ‘‘)
• 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
1
g(root)= πœ‡ 𝑃𝑏→π‘Ÿπ‘œπ‘œπ‘‘ πœ‡π‘Ž,𝑏 −
πœ‡(π‘ƒπ‘Ÿπ‘œπ‘œπ‘‘→π‘Ž )
• So g(root)=0 ⇔ πœ‡ 𝑃𝑏→π‘Ÿπ‘œπ‘œπ‘‘ πœ‡π‘Ž,𝑏 πœ‡(π‘ƒπ‘Ÿπ‘œπ‘œπ‘‘→π‘Ž )=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
Pseudo Code
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.5, 𝑀, ∞)
The forest is the set of
self arcs.
b(i)
𝑒(𝑖)
Set π‘₯𝑖,𝑖 = 1−πœ‡
5
(2, 𝑀, ∞)
0
(0.5, 𝑀, ∞)
10
(2, 𝑀, ∞)
0
(2, 𝑀, ∞)
-20
𝑖,𝑖
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:
Pivot Rules
πœ‹
For any eligible arc (i, j) we refer to I𝑐𝑖,𝑗
I 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
70
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 : 0 ≤
π‘₯𝑖,𝑗 + 𝛿𝑦𝑖,𝑗 ≤ 𝑒𝑖,𝑗 ∀ 𝑖, 𝑗 ∈ 𝐹 ∪ { π‘˜, 𝑙 }
• It is easy to see that if 𝑦𝑖,𝑗 > 0 then the edge will go up to it’s lower
bound, and if 𝑦𝑖,𝑗 < 0 then the opposite will happen.
• Denote 𝛿𝑖,𝑗 by the maximum number of units allowed to use to
make 𝑖, 𝑗 reach it’s lower\upper bound then:
(𝑒𝑖,𝑗 −π‘₯𝑖,𝑗 )
• 𝛿𝑖,𝑗 =
𝑦𝑖,𝑗
π‘₯𝑖,𝑗
−
𝑦𝑖,𝑗
𝑖𝑓 𝑦𝑖,𝑗 > 0
𝑖𝑓 𝑦𝑖,𝑗 < 0
∞ 𝑖𝑓 𝑦𝑖,𝑗 = 0
• So the largest value for which π‘₯ + 𝛿𝑦 is feasible is 𝛿 = min[𝛿𝑖,𝑗 ]
• 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 𝛿
> 0 (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
𝛿 > 0) 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 𝐼0 = 100 units of the wine, and she has
𝐢0 = 10,000 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 𝐢4 available at
the end of the third period.
(π‘π‘œπ‘ π‘‘, π‘π‘Žπ‘π‘Žπ‘π‘–π‘‘π‘¦, π‘šπ‘’π‘™π‘‘π‘–π‘π‘™π‘–π‘’π‘Ÿ)
v
u
𝑃 = (𝑝1 , 𝑝2 , 𝑝3 )
Warehouse:
Can store 1000
units of wine
𝐼0 = 100 𝑒𝑛𝑖𝑑𝑠
=10,000$
Flow represent wine
quantity here
1
sell
1
(0, ∞, )
𝑝1
buy
1’
Flow represent $ here
$
(π‘–π‘›π‘£π‘’π‘›π‘‘π‘œπ‘Ÿπ‘¦_β„Žπ‘œπ‘™π‘‘π‘–π‘›π‘”
, 1000,1)
𝑒𝑛𝑖𝑑
2
3v
sell (0, ∞, 𝑝 )
3
sell
buy
2’
(0, ∞, π‘π‘Žπ‘›π‘˜ π‘–π‘›π‘‘π‘Ÿπ‘’π‘ π‘‘)
3’
4’
The End
Download