Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Math Models of OR:Network Flow Problems
John E. Mitchell
Department of Mathematical SciencesRPI, Troy, NY 12180 USA
November 2018
Mitchell Network Flow Problems 1 / 21
Introduction
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 2 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Introduction
Simplex and network flow problemsWe’ve looked at several kinds of network flow problems, all of whichare linear optimization problems. We’ve looked at using the simplexalgorithm to solve most of them, exploiting the structure of the problemto make it more efficient.
1 Find an initial basic feasible solution (a spanning tree for many ofthese problems).
2 Use complementary slackness to find a dual solution (dual istypically underdetermined and can be found using a chainreaction).
3 Check dual feasibility in the constraints corresponding to thenonbasic variables.
4 If feasible: STOP with optimality.5 Else, Find the simplex direction to bring in a nonbasic variable
with a negative reduced cost (usually a cycle in the network).6 Find the steplength so one of the basic variables leaves the basis.7 Update, and return to Step 2.
Mitchell Network Flow Problems 3 / 21
Transportation problem
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 4 / 21
Transportation problem
Transportation problemsOnly source nodes and destination nodes, with each source linkedto each destination.Each edge has cost cij and is uncapacitated.Dual variables ui for source i and vj for destination j .Dual constraints: ui + vj ≤ cij for all edges (i , j).
s3
s2
s1
d3
d2
d1c11 = 2
c12 = 4
c13 = 3c21 = 1
c22 = 5
c23 = 2
c31 = 1
c32 = 1
c33 = 620
20
20
20
30
10
supply sources destinations demand
Mitchell Network Flow Problems 5 / 21
Transportation problem
Transportation problemsOnly source nodes and destination nodes, with each source linkedto each destination.Each edge has cost cij and is uncapacitated.Dual variables ui for source i and vj for destination j .Dual constraints: ui + vj ≤ cij for all edges (i , j).
s3
s2
s1
d3
d2
d1c11 = 2
c12 = 4
c13 = 3c21 = 1
c22 = 5
c23 = 2
c31 = 1
c32 = 1
c33 = 620
20
20
20
30
10
supply sources destinations demand
Mitchell Network Flow Problems 5 / 21
Transportation problem
Transportation problemsOnly source nodes and destination nodes, with each source linkedto each destination.Each edge has cost cij and is uncapacitated.Dual variables ui for source i and vj for destination j .Dual constraints: ui + vj ≤ cij for all edges (i , j).
s3
s2
s1
d3
d2
d1c11 = 2
c12 = 4
c13 = 3c21 = 1
c22 = 5
c23 = 2
c31 = 1
c32 = 1
c33 = 620
20
20
20
30
10
supply sources destinations demand
Mitchell Network Flow Problems 5 / 21
Transportation problem
Transportation problemsOnly source nodes and destination nodes, with each source linkedto each destination.Each edge has cost cij and is uncapacitated.Dual variables ui for source i and vj for destination j .Dual constraints: ui + vj ≤ cij for all edges (i , j).
s3
s2
s1
d3
d2
d1c11 = 2
c12 = 4
c13 = 3c21 = 1
c22 = 5
c23 = 2
c31 = 1
c32 = 1
c33 = 620
20
20
20
30
10
supply sources destinations demand
Mitchell Network Flow Problems 5 / 21
Transportation problem
Optimal solution
s3
s2
s1
d3
d2
d1x11 = 10
x12 = 10
x13 = 0x23 = 20
x32 = 20
Optimal dual solution:
First set u1 = 0, thenui + vj = cij for basic xij
210 410 30 u1 = 01 5 220 u2 = −11 120 6 u3 = −3v1 = 2 v2 = 4 v3 = 3
Mitchell Network Flow Problems 6 / 21
Minimum cost network flow
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 7 / 21
Minimum cost network flow
Minimum cost network flow
Allow more general network structure.Each edge has cost cij and is uncapacitated.Each node i has dual variable yi .Dual constraints: yi − yj ≤ cij for edge (i , j) leading from i to j .
1
2
3
4
5c12 = 2
c13 = 6
c24 = 1
c 32=
5
c35 = 3
c43 = 2c45
= 6
Node 1: Supply 10Node 2: Supply 10Node 3: Supply 20Node 4: Transshipment nodeNode 5: Demand 40
Mitchell Network Flow Problems 8 / 21
Minimum cost network flow
Minimum cost network flow
Allow more general network structure.Each edge has cost cij and is uncapacitated.Each node i has dual variable yi .Dual constraints: yi − yj ≤ cij for edge (i , j) leading from i to j .
1
2
3
4
5c12 = 2
c13 = 6
c24 = 1
c 32=
5
c35 = 3
c43 = 2c45
= 6
Node 1: Supply 10Node 2: Supply 10Node 3: Supply 20Node 4: Transshipment nodeNode 5: Demand 40
Mitchell Network Flow Problems 8 / 21
Minimum cost network flow
Minimum cost network flow
Allow more general network structure.Each edge has cost cij and is uncapacitated.Each node i has dual variable yi .Dual constraints: yi − yj ≤ cij for edge (i , j) leading from i to j .
1
2
3
4
5c12 = 2
c13 = 6
c24 = 1
c 32=
5
c35 = 3
c43 = 2c45
= 6
Node 1: Supply 10Node 2: Supply 10Node 3: Supply 20Node 4: Transshipment nodeNode 5: Demand 40
Mitchell Network Flow Problems 8 / 21
Minimum cost network flow
Minimum cost network flow
Allow more general network structure.Each edge has cost cij and is uncapacitated.Each node i has dual variable yi .Dual constraints: yi − yj ≤ cij for edge (i , j) leading from i to j .
1
2
3
4
5c12 = 2
c13 = 6
c24 = 1
c 32=
5
c35 = 3
c43 = 2c45
= 6
Node 1: Supply 10Node 2: Supply 10Node 3: Supply 20Node 4: Transshipment nodeNode 5: Demand 40
Mitchell Network Flow Problems 8 / 21
Minimum cost network flow
Solution
1
2
3
4
5c12 = 2, x12 = 10
c13 = 6
c24 = 1, x24 = 20
c32 = 5
c35 = 3, x35 = 40
c43 = 2, x43 = 20
c45 = 6
Find the dual variables.
y1 − y2 = 2y2 − y4 = 1y3 − y5 = 3y4 − y3 = 2
=⇒
Set y5 = 0:
=⇒ y3 = 3=⇒ y4 = 5=⇒ y2 = 6=⇒ y1 = 8
Mitchell Network Flow Problems 9 / 21
Minimum cost network flow with capacities
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 10 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Problems with edge capacities
Now allow capacities uij on the edges.Use network simplex with upper bounds: variable can be nonbasicat upper or lower bound.Need dual variables yi for each node i and also dual variables wijfor each edge for the upper bound constraint.Explicitly introduced dual variables zij for the lower boundconstraints also, so the dual constraints have the formyi − yj + zij − wij = cij .Complementary slackness:
1 If xij basic then zij = 0, wij = 0, yi − yj = cij .2 If xij = 0 and nonbasic then wij = 0, zij ≥ 0, and yi − yj ≤ cij .3 If xij = uij and nonbasic then zij = 0, wij ≥ 0, and yi − yi ≥ cij .
Mitchell Network Flow Problems 11 / 21
Minimum cost network flow with capacities
Example problem
1
2
3
4
5
6
triples are (cost cij , capacity uij , flow xij )
(2,3,3) UB
(3,7,5) B (7,4,0) LB
(5,6,3) B
(7,4,3) B
(3,2,0) LB
(7,5,5) UB
(5,3,2) B(9,8,3) B
x13 basic implies y1 − y3 = 3x24 basic implies y2 − y4 = 5x34 basic implies y3 − y4 = 5x35 basic implies y3 − y5 = 7x56 basic implies y5 − y6 = 9
Setting y6 = 0 then givesy5 = 9, y3 = 16, y1 = 19,y4 = 11, y2 = 16.
Mitchell Network Flow Problems 12 / 21
Shortest path
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 13 / 21
Shortest path
Shortest path problems
Have a general network with edge costs cij . Want to find the shortestpath between two specific nodes s and t . Can model as a network flowproblem:
Node s has supply 1, node t has demand 1.All other nodes are transshipment nodes.
Optimal solution is integral and hence binary, provided all costs arenonnegative.
Later: we will see a dynamic programming approach to this problem.
Mitchell Network Flow Problems 14 / 21
Shortest path
Example problem
s
2
3
4
tc12 = 2
c13 = 6
c24 = 1
c 32=
5
c35 = 3
c43 = 2
c45= 6
Source: node sSink: node t
Node s: supply 1Node t : demand 1
s
2
3
4
tc12 = 2, x12 = 1
c13 = 6
c24 = 1, x24 = 1
c32 = 5
c35 = 3, x35 = 1
c43 = 2, x43 = 1
c45 = 6
Mitchell Network Flow Problems 15 / 21
Max flow and min cut
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 16 / 21
Max flow and min cut
Max Flow problems
Have single source s and single sink t .Have capacities uij on the edges, but no edge costs.Solve the problem using augmenting paths to push flow from sto t .Can represent as linear optimization problem. Dual problem hasinterpretation as a MAXCUT problem.Can transform to a minimum cost network flow problem withcapacities: Add an edge from t to s with cost −1 and capacity∞;all other edges have cost 0. Nodes are all transshipment.
Mitchell Network Flow Problems 17 / 21
Max flow and min cut
Max Flow problems
Have single source s and single sink t .Have capacities uij on the edges, but no edge costs.Solve the problem using augmenting paths to push flow from sto t .Can represent as linear optimization problem. Dual problem hasinterpretation as a MAXCUT problem.Can transform to a minimum cost network flow problem withcapacities: Add an edge from t to s with cost −1 and capacity∞;all other edges have cost 0. Nodes are all transshipment.
Mitchell Network Flow Problems 17 / 21
Max flow and min cut
Max Flow problems
Have single source s and single sink t .Have capacities uij on the edges, but no edge costs.Solve the problem using augmenting paths to push flow from sto t .Can represent as linear optimization problem. Dual problem hasinterpretation as a MAXCUT problem.Can transform to a minimum cost network flow problem withcapacities: Add an edge from t to s with cost −1 and capacity∞;all other edges have cost 0. Nodes are all transshipment.
Mitchell Network Flow Problems 17 / 21
Max flow and min cut
Max Flow problems
Have single source s and single sink t .Have capacities uij on the edges, but no edge costs.Solve the problem using augmenting paths to push flow from sto t .Can represent as linear optimization problem. Dual problem hasinterpretation as a MAXCUT problem.Can transform to a minimum cost network flow problem withcapacities: Add an edge from t to s with cost −1 and capacity∞;all other edges have cost 0. Nodes are all transshipment.
Mitchell Network Flow Problems 17 / 21
Max flow and min cut
Max Flow problems
Have single source s and single sink t .Have capacities uij on the edges, but no edge costs.Solve the problem using augmenting paths to push flow from sto t .Can represent as linear optimization problem. Dual problem hasinterpretation as a MAXCUT problem.Can transform to a minimum cost network flow problem withcapacities: Add an edge from t to s with cost −1 and capacity∞;all other edges have cost 0. Nodes are all transshipment.
Mitchell Network Flow Problems 17 / 21
Max flow and min cut
Formulating as a min cost network flow problem
s
1
2 3
t
(15,15)
(17,10)
(12,0) (8,0)(16,15)
(10,10)(13,10) edge labels:
(uij , xij)
Equivalent to a minimum cost network flow problem with upper bounds:
s
1
2 3
t
(0,15,15)
(0,17,10)(0,12,0) (0,8,0)
(0,16,15)
(0,10,10)(0,13,10)
(−1,+∞,25)
edge labels:(cij ,uij , xij)
Mitchell Network Flow Problems 18 / 21
Sensitivity analysis
Outline
1 Introduction
2 Transportation problem
3 Minimum cost network flow
4 Minimum cost network flow with capacities
5 Shortest path
6 Max flow and min cut
7 Sensitivity analysis
Mitchell Network Flow Problems 19 / 21
Sensitivity analysis
Sensitivity analysisIf supplies and demands change: If can adjust flow along only thebasic arcs and still stay feasible, then we stay optimal. Since dualvariables stay the same from complementary slackness, we maintaindual feasibility.
s3
s2
s1
d3
d2
d1x11 = 10+t
x12 = 10−t
x13 = 0x23 = 20
x32 = 20+t
+t
+tOptimal dual solution:
First set u1 = 0, thenui + vj = cij for basic xij
210+t 410−t 30 u1 = 01 5 220 u2 = −11 120+t 6 u3 = −3v1 = 2 v2 = 4 v3 = 3
Mitchell Network Flow Problems 20 / 21
Sensitivity analysis
Change in optimal value
Optimal dual solution:210+t 410−t 30 u1 = 01 5 220 u2 = −11 120+t 6 u3 = −3v1 = 2 v2 = 4 v3 = 3
Still dual feasible.Still primal feasible and hence optimal provided −10 ≤ t ≤ 10.Optimal value decreases by 1 unit for each one unit increase in t :
from duality, increase is t(u3 + v1) = −t ;from the edge costs, increase is t(2− 4 + 1) = −t .
Mitchell Network Flow Problems 21 / 21