Lecture 5 – Integration of Network Flow Programming Models Topics • Min-cost flow problem (general model) • Mathematical formulation and problem characteristics • Pure vs.

Download Report

Transcript Lecture 5 – Integration of Network Flow Programming Models Topics • Min-cost flow problem (general model) • Mathematical formulation and problem characteristics • Pure vs.

Lecture 5 – Integration of Network
Flow Programming Models
Topics
• Min-cost flow problem (general model)
• Mathematical formulation and problem
characteristics
• Pure vs. generalized networks
Distribution Problem
[supply / demand]
(shipping cost)
[700]
arc lower bounds = 0
arc upper bounds = 200
(6)
CHIC
2
PHOE
(3)
[–200]
3
4
(5)
ATL
(2)
(5)
(7)
(6)
GAINS
8
AUS
7
5
[–150]
(4)
(2)
(7)
[–250]
(6)
(2)
DAL
[–300]
6
(4)
(3)
(5)
NY
(4)
(7)
1
LA
[–200]
[200]
[200]
Min-Cost Flow Problem
Example: Distribution problem
• Warehouses store a particular commodity in Phoenix,
Austin and Gainesville.
• Customers - Chicago, LA, Dallas, Atlanta, & New York
Supply [ si ] at each warehouse i
Demand [ dj ] of each customer j
• Shipping links depicted by arcs, flow on each arc is
limited to 200 units.
• Dallas and Atlanta - transshipment hubs
• Per unit transportation cost (cij ) for each arc
Problem: Determine optimal shipping plan that
minimizes transportation costs
Notation for Min-Cost Flow Problem
In general: [supply/demand] on nodes
(shipping cost per unit) on arcs
In example: all arcs have an upper bound of 200
nodes labeled with a number 1,...,8
• Must indicate notation that is included in model:
(cij ) unit flow cost on arc (i, j )
(uij ) capacity (or simple upper bound) on arc (i, j )
(gij ) gain or loss on arc (i, j )
• All 3 could be included: (cij , uij , gij )
Spreadsheet Input Data
arc origin termination lower upper
name node
node
bound bound cost gain
xij
i
j
lij
uij
cij gij
i
j
The origin node is the arc’s tail
external
flow
si or -di
The termination node is called the head
Supplies are positive and demands are negative
External flow balance: total supply = total demand
Data Entry Using Jensen Network Solver
Network Model
5300
17
T RU E
T RU E
T RU E
100
Change
N ame: N et1
T ype: N et
G oal: M in
C os t:
5300
Solver:E xc el Solver
T ype:L inear
Sens .:Y es
Side: N o
P h. 1 I ter.
13
T otal I ter.
15
C omp. T ime 0 0 :0 6
StatusO ptimal
Solve
Vary
A rc Dat a and Flows
N um.
N ame
Flow
O rigin
1
Phoe-Chi
200
1
2
Phoe-LA
200
1
3
Phoe-Dal
200
1
4
Phoe-Atl
100
1
5
Dal-LA
0
4
6
Dal-Chi
0
4
7
Dal-NY
50
4
8
Dal-Atl
50
4
9
Atl-NY
0
5
10
Atl-Dal
0
5
11
Atl-Chi
0
5
12
Aus-LA
0
7
13
Aus-Dal
200
7
14
Aus-Atl
0
7
15
Gain-Dal
0
8
16
Gain-Atl
0
8
17
Gain-NY
200
8
T erm.
2
3
4
5
3
2
6
5
6
4
2
3
4
5
4
5
6
U pper
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
And here is the solution ...
C os t Red. C os t
6
-3
3
-7
3
-2
7
0
5
0
4
0
6
0
2
0
5
1
2
4
4
2
7
0
2
0
5
1
6
4
4
0
7
-1
Node Data and Balance Const raints
N um.
N ame
Fixed Balanc eD ual V alues Bas is
1
Phoe
700
0
-11
-4
2
Chi
-200
0
-2
6
3
LA
-200
0
-1
12
4
Dal
-300
0
-6
-7
5
Atl
-150
0
-4
8
6
NY
-250
0
0
27
7
Aus
200
0
-8
-13
8
Gain
200
0
-8
-16
Solution to Distribution Problem
[supply / demand]
(flow)
[-200]
(200)
[700]
[-250]
NY
CHIC
(50)
PHOE
(100)
(200)
(200)
LA
[-300]
DAL
(50)
ATL
[-150]
(200)
[-200]
(200)
GAINS
AUS
[200]
[200]
Sensitivity Report for Distribution Problem
A
B
C
D
Microsof t Excel 11.4 Sensit ivity Report
1
2
3 A djus table C ells
4
5
Cell
Name
6
$ E $ 1 1 P hoe- C hi Flow
7
$ E $ 1 2 P hoe- L A Flow
8
$ E $ 1 3 P hoe- D al Flow
9
$ E $ 1 4 P hoe- A tl Flow
10
$ E $ 1 5 D al- L A F low
11
$ E $ 1 6 D al- C hi F low
12
$ E $ 1 7 D al- N Y Flow
13
$ E $ 1 8 D al- A tl Flow
14
$ E $ 1 9 A tl-N Y F low
15
$ E $ 2 0 A tl-D al Flow
16
$ E $ 2 1 A tl-C hi Flow
17
$ E $ 2 2 A us - L A F low
18
$ E $ 2 3 A us - D al Flow
19
$ E $ 2 4 A us - A tl Flow
20
$ E $ 2 5 G ain-D al Flow
21
$ E $ 2 6 G ain-A tl F low
22
$ E $ 2 7 G ain-N Y F low
23
2 4 C ons traints
25
26
Cell
Name
27
$ N $ 1 1 P hoe Balanc e
28
$ N $ 1 2 C hi B alanc e
29
$ N $ 1 3 L A Balanc e
30
$ N $ 1 4 D al B alanc e
31
$ N $ 1 5 A tl Balanc e
32
$ N $ 1 6 N Y Balanc e
33
$ N $ 1 7 A us Balanc e
34
$ N $ 1 8 G ain Balanc e
Final
Value
200
200
200
100
0
0
50
50
0
0
0
0
200
0
0
0
200
Final
Value
E
F
Reduced
Cost
Object ive
Coef f icient
0
- 7 .0 0 0 0 0 0 0 0 3
-2
0
0
2 .9 9 9 9 9 9 9 7 5
0
0
1 .0 0 0 0 0 0 0 5 4
3 .9 9 9 9 9 9 9 6 4
4 .9 9 9 9 9 9 9 9
0
0
1 .0 0 0 0 0 0 0 5 4
4 .0 0 0 0 0 0 0 5 5
0
- 0 .9 9 9 9 9 9 9 8 9
Shadow
Price
0
0
0
0
0
0
0
0
0
-6
-10
-5
-7
-11
-3
- 3 .0 0 0 0 0 0 0 1 1
G
6
3
3
7
5 .0 0 0 0 0 0 0 5 6
3 .9 9 9 9 9 9 9 9
6
2
5 .0 0 0 0 0 0 0 5 6
1 .9 9 9 9 9 9 9 4 9
3 .9 9 9 9 9 9 9 9
7 .0 0 0 0 0 0 0 0 5
2
5 .0 0 0 0 0 0 0 5 6
6 .0 0 0 0 0 0 0 3
3 .9 9 9 9 9 9 9 9
7
Constraint
R.H. Side
0
0
0
0
0
0
0
0
H
A llowable
Increase
2 .9 9 9 9 9 9 9 7 4
7 .0 0 0 0 0 0 0 0 3
2
1 3 .0 0 8 0 0 3 6 1
1 E +3 0
1 E +3 0
1 .0 0 0 0 0 0 0 5 4
0 .9 9 9 9 9 9 9 8 9
1 E +3 0
1 E +3 0
1 E +3 0
0
1 .0 0 0 0 0 0 0 5 4
1 E +3 0
1 E +3 0
4 .0 0 0 0 0 0 0 5 5
0 .9 9 9 9 9 9 9 8 9
A llowable
Decrease
1 E +3 0
1 E +3 0
1 E +3 0
2
0
2 .9 9 9 9 9 9 9 7 5
0 .9 9 9 9 9 9 9 8 9
1 .0 0 0 0 0 0 0 5 4
1 .0 0 0 0 0 0 0 5 4
3 .9 9 9 9 9 9 9 6 4
4 .9 9 9 9 9 9 9 9
7 .0 0 0 0 0 0 0 0 5
0
1 .0 0 0 0 0 0 0 5 4
4 .0 0 0 0 0 0 0 5 5
0 .9 9 9 9 9 9 9 8 9
1 E +3 0
A llowable
Increase
A llowable
Decrease
1 E +3 0
0
0
0
0
0
0
0
0
200
0
100
100
50
0
100
Characteristics of Network Flow Problems
 Conservation of flow at nodes. At each node
flow in = flow out.
At supply nodes there is an external inflow
(positive)
At demand nodes there is an external outflow
(negative).
 Flows on arcs must obey the arc bounds; i.e.,
lower bound & upper bound (capacity)

Each arc has a per unit cost & the goal is to
minimize total cost.
Distribution Network Used in Formulation
[external flow]
(cost)
lower = 0, upper = 200
[700]
(3)
[-200]
3
[-200]
(6)
1
2
6
(4)
(7)
(3)
[-250]
(6)
(4)
(5)
(7)
(2)
(5)
4
5
(2)
[-300]
(2)
(7)
(5)
[-150]
(4)
(6)
8
7
[200]
 Notation
[200]
Pure Minimum Cost Flow Problem
G = (N, A)  network with node set N and arc set A
Indices i, j  N denote nodes and (i, j )  A denote arcs
Originating set of arcs for node i (tails are i ) is the
forward star of i
FS(i ) = { (i, j ) : (i, j ) A }
Terminating set of arcs for node i is the
reverse star of i
RS(i ) = { (j,i ) : (j,i )  A }.
In our example:
FS(1) = { (1,2), (1,3), (1,4), (1, 5) }
RS(1) = Ø
FS(4) = { (4,2), (4,3), (4,5), (4,6) }
RS(4) = { (1,4), (5, 4), (7,4), (8,4) }
Flow balance equation for node i :
 xij –  xji = bi
(i, j )FS(i )
(j,i )RS(i )
where bi = positive for supply node i
= negative for demand node i
= 0 otherwise
Pure Min-Cost Flow Model
Indices/sets
i, j  N
(i, j )  A
FS(i )
RS(i )
Data
nodes
arcs
forward star of i
reverse star of i
cij
lij
unit cost of flow on (i, j )
uij
upper bound on flow (i, j )
bi
external flow at node i
lower bound on flow (i, j )
Total supply = total demand: i bi = 0
Decision variables
xij = flow on arc (i, j )
Formulation for pure min-cost flow model
Min
 cijxij
(i, j )A
s.t.
 xij
(i, j )FS(i )

 xji = bi, " i N
(j, i )RS(i )
lij  xij  uij, " (i, j ) A
Decision variables are the flow variables xij
j
i
By examining the flow balance constraints we see that
xij appears in exactly two of them:
xij
0
..
.
0
+1
0
node i
0
1
0
node j
( or in the other
order if i > j )
..
.
..
.
0
This structure is called total
unimodularity and guarantees
integer solutions
Observations from LP Model
• If we add the constraints we obtain zero on the left-hand
side so the right-hand side must also be zero for
feasibility.
• In particular, this means
sum of supplies = sum of demands.
• Mathematically, we have one redundant constraint.
• Must be careful in interpreting shadow prices on the
flow balance constraints.
• Cannot change only a supply or demand and have
model make sense.
Generalized Minimum Cost Network
Flow Model
• Only one modification to “pure” formulation
 a possible gain (or loss) on each arc, denoted by gij
• If gij = 0.95 then 100 units of flow leaves node i and
95 units arrive at node j
Generalized Formulation
Min
s.t.
 cijxij
(i, j )A
 xij
(i, j )FS(i )

 gjixji = bi, " i N
(j, i )RS(i )
lij  xij  uij, " (i, j )A
Note that if gij =1 "(i, j )  A, then we obtain the
“pure” model
Gains and Losses
• Might experience 5% spoilage of a perishable good during
transportation on a particular arc.
gij = 0.95 for the associated arc (i,j).
• In production of manufacturing formulations we might incur
losses due to production defects.
• In financial examples we can have gains due to currency
exchange or gains due to returns on investments.
US
$
Year 1
Gain = 1.78
Gain = 1.15
Swiss
francs
Year 2
Currency
exchange
15% return
on investment
Pure Network Problems vs. General
Network Problems
Fact:
If bi, lij and uij are integer-valued then all
extreme points of the feasible region for a pure
network flow problem give integer values for xij.
(Same cannot be said for generalized network models.)
This integer property means that if we use the simplex
method to solve a pure network flow problem then we
are guaranteed that xij will be integer at optimality.
This is critical when we formulate the assignment,
shortest path problems, and other network problems.
Special cases of the pure min-cost flow model:
• Transportation problem
• Assignment problem
• Shortest path problem
• Maximum flow problem
Checking for Arbitrage Opportunities
1
2
3
4
5
•
US $
Yen(100)
CHF
D-Mark
Brit £
US $
Yen(100)
CHF
D-Mark
Brit £
1
.95
.69
.58
1.50
1.05
1
.71
.61
1.56
1.45
1.41
1
0.88
2.08
1.72
1.64
1.14
1
2.08
.68
.64
.48
.39
1
The table is to be read as follows:
The 1.45 in row 1 column 3 means that $1 US will
purchase 1.45 Swiss Francs (CHF).
•
In addition, there is a 1% fee that is charged on
each exchange.
Arbitrage Network: Generalized Min-Cost
Flow Problem
US $
Arc costs:
cij = $ equivalent
(first column of table)
[-1]
1
For example:
c12 = 1.05, c35 = 0.48
Yen
5
2
CHF
3
4
Brit £
D-Mark
Each arc has a gain of gij. For example, g12 = (1.05)(0.99)
g35 = (0.48)(0.99)
Solution to Arbitrage Network
US $
Arc gains in
optimal cycle:
g54 = 2.535
1
5
Brit £
g43 = 0.871
g35 = 0.475
CHF
3
4
D-Mark
Start with 13.801 £  34.986 D-Mark 
30.473 CHF  14.475 £
Remove 0.674 £  $1 leaving 13.801 £
Total cycle gain:
= 1.0488
= 4.88%
Note (£  $):
g51 = 1.485
What You Should Known About
General Network Flow Problems
• How to view flow on an arch with a gain or
loss.
• How to formulate a general network flow
problem as a linear program.
• What the implications are for a network flow
problem with gains.
• How to solve general network flow problems
using the Excel add-ins.