Lecture 5 – Integration of Network Flow Programming Models

Download Report

Transcript Lecture 5 – Integration of Network Flow Programming Models

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)
AUS
7
5
[–150]
(7)
(4)
(2)
(7)
[–250]
(6)
(2)
DAL
[–300]
6
(4)
(3)
(5)
NY
(4)
(7)
1
LA
[–200]
[200]
(6)
GAINS
8
[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
Data Entry Using Math Programming/Network Add-in.
Network Model
TRUE
FALSE
TRUE
FALSE
FALSE
100
100
0
60
FALSE
FALSE
FALSE
Change
Solve
Name: dist_1
Solver: Jensen Network
Ph. 1 Iter.
13
Type: Net
Type: Linear
Total Iter.
15
Goal: Min
Sens.: No
Comp. Time 00:00
Objective:
5300
Side: No
Status Optimal
Select the Relink Buttons command from the OR_MM menu before clicking a button.
Arc Data and Flows
Num.
Name
1
Phoe-Chi
2
Phoe-LA
3
Phoe-Dal
4
Phoe-Atl
5
Dal-LA
6
Dal-Chi
7
Dal-NY
8
Dal-Atl
9
Atl-NY
10
Atl-Dal
11
Atl-Chi
12
Aus-LA
13
Aus-Dal
14
Aus-Atl
15
Gain-Dal
16
Gain-Atl
17
Gain-NY
Flow
Origin Term. Upper
200
1
2
200
200
1
3
200
200
1
4
200
100
1
5
200
0
4
3
200
0
4
2
200
50
4
6
200
50
4
5
200
0
5
6
200
0
5
4
200
0
5
2
200
0
7
3
200
200
7
4
200
0
7
5
200
0
8
4
200
0
8
5
200
200
8
6
200
And here is the solution ...
Cost
6
3
3
7
5
4
6
2
5
2
4
7
2
5
6
4
7
Node Data and Balance Constraints
Num. Name Fixed Balance
1
Phoe
700
0
2
Chi
-200
0
3
LA
-200
0
4
Dal
-300
0
5
Atl
-150
0
6
NY
-250
0
7
Aus
200
0
8
Gain
200
0
Solution to Distribution Problem
[supply / demand]
(flow)
[-200]
[-250]
(200)
[700]
PHOE
NY
CHIC
(50)
(100)
(200)
(200)
LA
[-300]
DAL
(50)
ATL
[-150]
(200)
[-200]
(200)
GAINS
AUS
[200]
[200]
Sensitivity Report for Max Flow Problem
Variable Analysis
Num.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Name
Phoe-Chi
Phoe-LA
Phoe-Dal
Phoe-Atl
Dal-LA
Dal-Chi
Dal-NY
Dal-Atl
Atl-NY
Atl-Dal
Atl-Chi
Aus-LA
Aus-Dal
Aus-Atl
Gain-Dal
Gain-Atl
Gain-NY
Value
200.
200.
200.
100.
0.
0.
50.
50.
0.
0.
0.
0.
200.
0.
0.
0.
200.
Status
Basic
Upper
Upper
Basic
Lower
Lower
Basic
Basic
Lower
Lower
Lower
Lower
Basic
Lower
Lower
Lower
Upper
Objective Value:
5,300.
Reduced
Objective
Range
Range
Cost
Coefficient Lower Limit Upper Limit
0.
6.
--9.
0.
3.
--3.
-2.
3.
--5.
0.
7.
7.
--7.
5.
-2.
--3.
4.
1.
--0.
6.
5.
7.
0.
2.
1.
2.
1.
5.
4.
--4.
2.
-2.
--5.
4.
-1.
--7.
7.
0.
--0.
2.
1.
2.
1.
5.
4.
--4.
6.
2.
--0.
4.
4.
---1.
7.
--8.
Status
Shadow
Price
Constraint
Limit
Equality
Equality
Equality
Equality
Equality
Equality
Equality
Equality
3.
-3.
0.
-2.
-4.
-8.
0.
0.
700.
-200.
-200.
-300.
-150.
-250.
200.
200.
Constraint Analysis
Num.
Name
Value
1
2
3
4
5
6
7
8
Phoe
Chi
LA
Dal
Atl
NY
Aus
Gain
0.
0.
0.
0.
0.
0.
0.
0.
Range
Range
Lower Limit Upper Limit
700.
-200.
-200.
-300.
-150.
-250.
200.
200.
700.
-200.
-200.
-300.
-150.
-250.
200.
200.
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)
(6)
[-150]
(4)
8
7
[200]
 Notation
[200]
LP for Distribution Problem
Pure network  flow at each node is conserved
 flow across an arc is conserved
 no gains or losses can occur on arcs
Min
s.t.
sit.
6x 12 +
3x 13
xx1221 + +x13 x23
x12  x 42
x13x23 + +x 43 x43
xx4141 + +x 42x43
.
.
.
x 84
+ 3x 14 +
7x 16 +  + 4x 85 + 7x 86
+ x+14 x
+24 x+15 x
 x52
 x 73
 x63
+ x 43 + x45 + x 46  x 54
+ x46 +
x47 + x24
= 700
Node 1
=  200 Node 2
=  200 =  .
.
=

300

x
+ x 54

74 + 84
84 =
x
.
..
.
+ x 85
+
x 86
= 200
xij  200, for all (i, j ) combinations which are arcs
Flow balance
constraints
for each of
the 8 nodes
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
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.
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:
 xij –  xji = bi
(i, j )FS(i )
(j,i )RS(i )
where bi is positive for supply and negative for
demand at node i.
Pure Min-Cost Flow Problem
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 )
Decision Variables
xij = flow on arc (i, j )
Formulation
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
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:
c14 = 1, c35 = 0.69
Yen
5
2
CHF
3
4
Brit £
D-Mark
Each arc has a gain of gij. For example, g12 = (1.05)(0.99)
g51 = (1.50)(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 formulate a general network flow
problem as a linear program.
• What the relationship is between the maximum
flow and the minimum cut in a network.
• What the implications are for a network flow
problem with gains.
• How to solve general network flow problems
using the Excel add-ins.