4-1 OR/MA 504 Chapter 4 Network Modeling Introduction to Mathematical Programming
4-1
OR/MA 504
Chapter 4
Network Modeling
Introduction to Mathematical Programming
4-2
Introduction• A large variety of linear programming
applications can be represented graphically as networks.
• This chapter focuses on several such problems:
– Transshipment Problems– Shortest Path Problems– Maximal Flow Problems– Transportation/Assignment Problems– Generalized Network Flow Problems– The Minimum Spanning Tree Problem
4-3
Network Flow Problem Characteristics
• Network flow problems can be represented as a collection of nodes connected by arcs.
• There are three types of nodes:– Supply– Demand– Transshipment
• We’ll use negative numbers to represent supplies and positive numbers to represent demand.
4-4
A Transshipment Problem:The Bavarian Motor Company
Newark1
Boston2
Columbus3
Atlanta5
Richmond4
J'ville7
Mobile6
$30
$40
$50
$35
$40
$30
$35$25
$50
$45 $50
-200
-300
+80
+100
+60
+170
+70
4-5
Defining the Decision VariablesFor each arc in a network flow model
we define a decision variable as:
Xij = the amount being shipped (or flowing) from node i to node j
For example…X12 = the # of cars shipped from node 1 (Newark) to node 2 (Boston)X56 = the # of cars shipped from node 5 (Atlanta) to node 6 (Mobile) Note: The number of arcs
determines the number of variables!
4-6
Defining the Objective Function
Minimize total shipping costs.
MIN: 30X12 + 40X14 + 50X23 + 35X35 +40X53 + 30X54 + 35X56 +
25X65 + 50X74 + 45X75 + 50X76
4-7
Constraints for Network Flow Problems:The Balance-of-Flow Rules
For Minimum Cost Network Apply This Balance-of-Flow Flow Problems Where: Rule At Each Node:
Total Supply > Total DemandInflow-Outflow >= Supply or DemandTotal Supply < Total DemandInflow-Outflow <=Supply or Demand
Total Supply = Total Demand Inflow-Outflow = Supply or Demand
4-8
Defining the Constraints• In the BMC problem:
Total Supply = 500 carsTotal Demand = 480 cars
• For each node we need a constraint like this:
Inflow - Outflow >= Supply or Demand• Constraint for node 1:
–X12 – X14 >= – 200 (Note: there is no inflow for node 1!)
• This is equivalent to:+X12 + X14 <= 200
(Supply >= Demand)
4-9
Defining the Constraints• Flow constraints
–X12 – X14 >= –200 } node 1+X12 – X23 >= +100} node 2+X23 + X53 – X35 >= +60 } node 3+ X14 + X54 + X74 >= +80 } node 4+ X35 + X65 + X75 – X53 – X54 – X56 >= +170} node 5+ X56 + X76 – X65 >= +70 } node 6–X74 – X75 – X76 >= –300 } node 7
• Nonnegativity conditionsXij >= 0 for all ij
4-10
Implementing the Model
See file Fig4-1.xls
4-11
Optimal Solution to the BMC Problem
Newark1
Boston2
Columbus3
Atlanta5
Richmond4
J'ville7
Mobile6
$30
$40
$50
$40
$50
$45
-200
-300
+80
+100
+60
+170
+70
120
80
20
40
70
210
4-12
The Shortest Path Problem• Many decision problems boil down to
determining the shortest (or least costly) route or path through a network.– Ex. Emergency Vehicle Routing
• This is a special case of a transshipment problem where:– There is one supply node with a supply of -1– There is one demand node with a demand of
+1– All other nodes have supply/demand of +0
4-13
The American Car Association
B'hamAtlanta
G'ville
Va Bch
Charl.
L'burg
K'ville
A'ville
G'boro Raleigh
Chatt.
12
3
4
6
5
7
8
9
10
11
2.5 hrs3 pts
3.0 hrs4 pts
1.7 hrs4 pts
2.5 hrs3 pts
1.7 hrs5 pts
2.8 hrs7 pts
2.0 hrs8 pts
1.5 hrs2 pts
2.0 hrs9 pts
5.0 hrs9 pts
3.0 hrs4 pts
4.7 hrs9 pts
1.5 hrs3 pts 2.3 hrs
3 pts
1.1 hrs3 pts
2.0 hrs4 pts
2.7 hrs4 pts
3.3 hrs5 pts
-1
+1
+0
+0
+0
+0
+0
+0
+0
+0
+0
4-14
Solving the Problem
• There are two possible objectives for this problem– Finding the quickest route
(minimizing travel time)– Finding the most scenic route
(maximizing the scenic rating points)See file Fig4-2.xls
4-15
The Equipment Replacement Problem
• The problem of determining when to replace equipment is another common business problem.
• It can also be modeled as a shortest path problem…
4-16
The Compu-Train Company• Compu-Train provides hands-on software training.• Computers must be replaced at least every two
years.• Two lease contracts are being considered:
– Each requires $62,000 initially– Contract 1:
• Prices increase 6% per year• 60% trade-in for 1 year old equipment• 15% trade-in for 2 year old equipment
– Contract 2:• Prices increase 2% per year• 30% trade-in for 1 year old equipment• 10% trade-in for 2 year old equipment
4-17
Network for Contract 1
1 3 5
2 4
-1 +1
+0
+0 +0
$28,520
$60,363
$30,231
$63,985
$32,045
$67,824
$33,968
Cost of trading after 1 year: 1.06*$62,000 - 0.6*$62,000 = $28,520
Cost of trading after 2 years: 1.062*$62,000 - 0.15*$62,000 = $60,363
Cost of trading in year 2 after trading in year 1:
1.062*$62,000 – 0.6(1.06*$62,000) = $69,663 - $39,432 = $30,231
4-18
Solving the Problem
See file Fig4-3.xls
4-19
Transportation & Assignment Problems
• Some network flow problems don’t have trans-shipment nodes; only supply and demand nodes.
Mt. Dora1
Eustis2
Clermont3
Ocala4
Orlando5
Leesburg6
Distances (in miles)CapacitySupply
275,000
400,000
300,000 225,000
600,000
200,000
GrovesProcessing Plants
2150
40
3530
22
55
2520
These problems are implemented more effectively using the technique described
in Chapter 2.
4-20
Generalized Network Flow Problems• In some problems, a gain or loss
occurs in flows over arcs.– Examples
•Oil or gas shipped through a leaky pipeline• Imperfections in raw materials entering a
production process•Spoilage of food items during transit•Theft during transit• Interest or dividends on investments
• These problems require some modeling changes.
4-21
Coal Bank Hollow Recycling
Material Cost Yield Cost Yield SupplyNewspaper $13 90% $12 85% 70 tonsMixed Paper $11 80% $13 85% 50 tonsWhite Office Paper $9 95% $10 90% 30 tonsCardboard $13 75% $14 85% 40 tons
Process 1 Process 2
Pulp Source Cost Yield Cost Yield Cost YieldRecycling Process 1 $5 95% $6 90% $8 90%Recycling Process 2 $6 90% $8 95% $7 95%
Newsprint Packaging Paper Print Stock
Demand 60 tons 40 tons 50 tons
4-22
Network for Recycling ProblemNewspaper
1
Mixed paper
2
3
Cardboard
4
Recycling Process 1
5
6
Newsprint pulp
7
Packing paper pulp
8
Printstockpulp
9
-70
-50
-30
-40
+60
+40
+50
White office paper
Recycling Process 2
$13
$12
$11
$13
$9
$10
$14
$13
90%
80%
95%
75%
85%85%
90%
85%
$5
$6
$8
$6
$7
$8
95%
90%
90%
90%
95%
95%+0
+0
4-23
Defining the Objective Function
Minimize total cost.
MIN: 13X15 + 12X16 + 11X25 + 13X26 + 9X35+ 10X36 + 13X45 + 14X46 +
5X57 + 6X58 + 8X59 + 6X67 + 8X68 + 7X69
4-24
Defining the Constraints-I
• Raw Materials-X15 -X16 >= -70 } node 1-X25 -X26 >= -50 } node 2-X35 -X36 >= -30 } node 3-X45 -X46 >= -40 } node 4
4-25
Defining the Constraints-II
• Recycling Processes
+0.9X15+0.8X25+0.95X35+0.75X45- X57- X58-X59 >= 0 } node 5
+0.85X16+0.85X26+0.9X36+0.85X46-X67-X68-X69 >= 0 } node 6
4-26
Defining the Constraints-III
• Paper Pulp+0.95X57 + 0.90X67 >= 60 } node 7+0.90X57 + 0.95X67 >= 40 } node 8+0.90X57 + 0.95X67 >= 50 } node 9
4-27
Implementing the Model
See file Fig4-4.xls
4-28
Important Modeling Point• In generalized network flow problems, gains and/or losses associated with flows across each
arc effectively increase and/or decrease the available supply.• This can make it difficult to tell if the total supply is adequate to meet the total demand.• When in doubt, it is best to assume the total supply is capable of satisfying the total
demand and use Solver to prove (or refute) this assumption.
4-29
The Maximal Flow Problem
• In some network problems, the objective is to determine the maximum amount of flow that can occur through a network.
• The arcs in these problems have upper and lower flow limits.
• Examples– How much water can flow through a
network of pipes?– How many cars can travel through a
network of streets?
4-30
The Northwest Petroleum Company
Oil Field
Pumping Station 1
Pumping Station 2
Pumping Station 3
Pumping Station 4
Refinery1
2
3
4
5
6
6
4
3
6
4
5
2
2
4-31
Max Flow Problem Set-Up• Solve as transshipment problem:
– Add return arc from ending node to the starting node
– Assign demand of 0 to all nodes in network
– Maximize flow over the return arc
4-32
The Northwest Petroleum Company
Oil Field
Pumping Station 1
Pumping Station 2
Pumping Station 3
Pumping Station 4
Refinery1
2
3
4
5
6
6
4
3
6
4
5
2
2
+0
+0
+0
+0
+0+0
4-33
Formulation of the Max Flow ProblemMAX: X61
Subject to: +X61 - X12 - X13 = 0+X12 - X24 - X25 = 0+X13 - X34 - X35 = 0+X24 + X34 - X46 = 0+X25 + X35 - X56 = 0+X46 + X56 - X61 = 0
with the following bounds on the decision variables:0 <= X12 <= 6 0 <= X25 <= 2 0 <= X46 <= 60 <= X13 <= 4 0 <= X34 <= 2 0 <= X56 <= 40 <= X24 <= 3 0 <= X35 <= 5 0 <= X61 <= inf
4-34
Implementing the Model
See file Fig4-5.xls
4-35
Optimal Solution
Oil Field
Pumping Station 1
Pumping Station 2
Pumping Station 3
Pumping Station 4
Refinery1
2
3
4
5
6
6
4
3
6
4
5
2
2
5
3
2
42
5
4
2
4-36
Special Modeling Considerations:Flow Aggregation
1
2
3
4
5
6
-100
-100
+75
+50
+0
+0$3
$4
$4
$5
$5
$5
$3
$6
Suppose the total flow into nodes 3 & 4 must be at least 50 and 60, respectively. How would you model this?
4-37
1
2
3
4
5
6
-100
-100
+75
+50
+0
+0$3
$4
$4
$5
$5
$5
$3
$6
30
40
+0
+0
L.B.=50
L.B.=60
Nodes 30 & 40 aggregate the total flow into nodes 3 & 4, respectively.
Special Modeling Considerations:Flow Aggregation
4-38
Special Modeling Considerations:Multiple Arcs Between Nodes
1
1
10
2
-75
+0
+50-75
$8
$0
$6
2 +50
Two two (or more) arcs cannot share the same beginning and ending nodes. Instead, try...
$6
U.B. = 35
$8
U.B. = 35
4-39
Special Modeling Considerations:Capacity Restrictions on Total Supply
1-100
2-100
3+75
4+80
$5, UB=40
$3, UB=35
$4, UB=30$6, UB=35
Supply exceeds demand, but the upper bounds prevent the demand from being met.
4-40
Special Modeling Considerations:Capacity Restrictions on Total Supply
1-100
2-100
3+75
4+80
$5, UB=40
$3, UB=35
$6, UB=35
$4, UB=300
+200
$999, UB=100
$999, UB=100
Now demand exceeds supply. As much “real” demand as possible will be met in the least costly way.
4-41
The Minimal Spanning Tree Problem
• For a network with n nodes, a spanning tree is a set of n-1 arcs that connects all the nodes and contains no loops.
• The minimal spanning tree problem involves determining the set of arcs that connects all the nodes at minimum cost.
4-42
Minimal Spanning Tree Example:Windstar Aerospace Company
2
3
1
4
5
6
$150
$100
$40
$85
$65
$50
$90
$80
$75$85
Nodes represent computers in a local area network.
4-43
The Minimal Spanning Tree Algorithm1. Select any node. Call this the current subnetwork.2. Add to the current subnetwork the cheapest arc
that connects any node within the current subnetwork to any node not in the current subnetwork. (Ties for the cheapest arc can be broken arbitrarily.) Call this the current subnetwork.
3. If all the nodes are in the subnetwork, stop; this is the optimal solution. Otherwise, return to step 2.
4-44
Solving the Example Problem - 1
2
3
1
4
5
6
$100
$85 $90
$80
$85
4-45
Solving the Example Problem - 2
2
3
1
4
5
6
$100
$85 $90
$80
$85$75
$50
4-46
Solving the Example Problem - 3
2
3
1
4
5
6
$100
$85
$80
$85$75
$50
$65
4-47
Solving the Example Problem - 4
2
3
1
4
5
6
$100
$80
$85$75
$50
$65
$40
4-48
Solving the Example Problem - 5
2
3
1
4
5
6
$80
$85$75
$50
$65
$40
$150
4-49
Solving the Example Problem - 6
2
3
1
4
5
6
$80
$75
$50
$65
$40
4-50
End of Chapter 4