Lecture 5 – Integration of Network Flow Programming Models

advertisement
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
TRUE
TRUE
TRUE
100
Change
Name:
Type:
Goal:
Cost:
Net1
Net
Min
5300
Solver:
Type:
Sens.:
Side:
Excel Solver
Linear
Yes
No
Ph. 1 Iter.
13
Total Iter.
15
Comp. Time
00:06
Status Optimal
Solve
Vary
Arc Data and Flows
Num.
Name
Flow
1
Phoe-Chi
200
2
Phoe-LA
200
3
Phoe-Dal
200
4
Phoe-Atl
100
5
Dal-LA
0
6
Dal-Chi
0
7
Dal-NY
50
8
Dal-Atl
50
9
Atl-NY
0
10
Atl-Dal
0
11
Atl-Chi
0
12
Aus-LA
0
13
Aus-Dal
200
14
Aus-Atl
0
15
Gain-Dal
0
16
Gain-Atl
0
17
Gain-NY
200
Origin
Term.
1
1
1
1
4
4
4
4
5
5
5
7
7
7
8
8
8
2
3
4
5
3
2
6
5
6
4
2
3
4
5
4
5
6
Upper
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
200
And here is the solution ...
Cost
6
3
3
7
5
4
6
2
5
2
4
7
2
5
6
4
7
Red. Cost
-3
-7
-2
0
0
0
0
0
1
4
2
0
0
1
4
0
-1
Node Data and Balance Constraints
Num.
Name
Fixed Balance Dual Values
1
Phoe
700
0
-11
2
Chi
-200
0
-2
3
LA
-200
0
-1
4
Dal
-300
0
-6
5
Atl
-150
0
-4
6
NY
-250
0
0
7
Aus
200
0
-8
8
Gain
200
0
-8
Basis
-4
6
12
-7
8
27
-13
-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
Microsoft Excel 11.4 Sensitivity Report
1
2
3 Adjustable Cells
4
5
Cell
Name
6
$E$11 Phoe-Chi Flow
7
$E$12 Phoe-LA Flow
8
$E$13 Phoe-Dal Flow
9
$E$14 Phoe-Atl Flow
10
$E$15 Dal-LA Flow
11
$E$16 Dal-Chi Flow
12
$E$17 Dal-NY Flow
13
$E$18 Dal-Atl Flow
14
$E$19 Atl-NY Flow
15
$E$20 Atl-Dal Flow
16
$E$21 Atl-Chi Flow
17
$E$22 Aus-LA Flow
18
$E$23 Aus-Dal Flow
19
$E$24 Aus-Atl Flow
20
$E$25 Gain-Dal Flow
21
$E$26 Gain-Atl Flow
22
$E$27 Gain-NY Flow
23
24 Constraints
25
26
Cell
Name
27
$N$11 Phoe Balance
28
$N$12 Chi Balance
29
$N$13 LA Balance
30
$N$14 Dal Balance
31
$N$15 Atl Balance
32
$N$16 NY Balance
33
$N$17 Aus Balance
34
$N$18 Gain Balance
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
Objective
Coefficient
0
-7.000000003
-2
0
0
2.999999975
0
0
1.000000054
3.999999964
4.99999999
0
0
1.000000054
4.000000055
0
-0.999999989
Shadow
Price
0
0
0
0
0
0
0
0
0
-6
-10
-5
-7
-11
-3
-3.000000011
G
6
3
3
7
5.000000056
3.99999999
6
2
5.000000056
1.999999949
3.99999999
7.000000005
2
5.000000056
6.00000003
3.99999999
7
Constraint
R.H. Side
0
0
0
0
0
0
0
0
H
Allowable
Increase
2.999999974
7.000000003
2
13.00800361
1E+30
1E+30
1.000000054
0.999999989
1E+30
1E+30
1E+30
0
1.000000054
1E+30
1E+30
4.000000055
0.999999989
Allowable
Decrease
1E+30
1E+30
1E+30
2
0
2.999999975
0.999999989
1.000000054
1.000000054
3.999999964
4.99999999
7.000000005
0
1.000000054
4.000000055
0.999999989
1E+30
Allowable
Increase
Allowable
Decrease
1E+30
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.
Download