5-1 network modeling chapter 5
TRANSCRIPT
5-1
Network Modeling
Chapter 5
5-2
Introduction• A number of business problems can be
represented graphically as networks.• Advantages of Network Models versus LPs:
– Networks are convenient way to think about and model many problems
– Network flow models yield integer solutions naturally as long as the supply and demand data is integer
– Specialized extremely fast algorithms have been developed for network problems Critical for very large problems. However, Solver does include these algorithm and we shall simply use the regular LP simplex algorithm available
• We will focus on a few such problems:– Transshipment– Shortest Path– Transportation/Assignment– Maximal Flow
5-3
Network Flow Problem Characteristics
• General network flow problems (transshipment 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.
• There exists efficient algorithms for the transshipment problem that are one or more orders of magnitude faster than the standard Simplex LP solver; however, Solver only has one generic Simplex solver for all LP problems
5-4
A Transshipment Problem:The Bavarian Motor Company
Newark1
Boston2
Columbus
3
Atlanta5
Richmond
4
J'ville7
Mobile6
$30
$40
$50
$35
$40
$30
$35
$25
$50
$45 $50
-200
-300
+80
+100
+60
+170
+70
5-5
Defining the Decision Variables
For 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)Notes:
1. The number of arcs determines the number of variables
2. Lower and upper bounds could be placed on the flow
5-6
Defining the Objective Function
Minimize total shipping costs.
MIN: 30X12 + 40X14 + 50X23 + 35X35
+40X53 + 30X54 + 35X56 + 25X65
+ 50X74 + 45X75 + 50X76
5-7
Constraints for Network Flow Problems:Balance-of-Flow Concepts or “Rules”
For Minimum Cost Network Flow Problem Where:
Apply The Following:
Total Supply > Total Demand
Supply Nodes: Inflow – Outflow >= SupplyDemand Nodes: Inflow – Outflow >= Demand(Or Inflow – Outflow = Demand)Transshipment Nodes: Inflow – Outflow = 0
Total Supply < Total Demand
Supply Nodes: Inflow – Outflow = Supply(Not Inflow – Outflow <= Supply)Demand Nodes: Inflow – Outflow <= DemandTransshipment Nodes: Inflow – Outflow = 0
Total Supply = Total Demand
Supply Nodes: Inflow – Outflow = SupplyDemand Nodes: Inflow – Outflow = DemandTransshipment Nodes: Inflow – Outflow = 0
5-8
Motivation Behind “Rules”
1
X21
+100
X13
X41
X15
Consider the following two cases for a hypothetical node 1 (rest of network not shown):
Case B
1
X21
-100
X13
X41
X15
Case A
5-9
Illustration of Rule 1
1
X21
+100
X13
X41
X15
Case A Case B
1
X21
-100
X13
X41
X15
Total Supply > Total Demand which means, in general, we should be able to meet all the demand Inflow-Outflow >= Supply or Demand
Case A: X21+X41-X13-X15>=-100, or -X21-X41+X13+X15<=100(i.e., not all supply from node 1 has to be used)
Case B: X21+X41-X13-X15>=100, or X21+X41-X13-X15=100(i.e., all demand at node 1 has to be met)
5-10
Illustration of Rule 2
1
X21
+100
X13
X41
X15
Case A Case B
1
X21
-100
X13
X41
X15
Total Supply < Total Demand which means, we cannot to meet all the demand even if use all the supply Inflow-Outflow = SupplyInflow –Outflow <= Demand
Case A: X21+X41-X13-X15=-100, or -X21-X41+X13+X15=100(i.e., all supply from node 1 is used) Note that -X21-X41+X13+X15> =100 is wrong!
Case B: X21+X41-X13-X15<=100, or(i.e., not all demand at node 1 has to be met)
5-11
Illustration of Rule 3
1
X21
+100
X13
X41
X15
Case A Case B
1
X21
-100
X13
X41
X15
Total Supply = Total Demand which means, we should be able to exactly meet all the demand Inflow-Outflow = Supply or Demand
Case A: X21+X41-X13-X15=-100, or -X21-X41+X13+X15 =100(i.e., all supply from node 1 is used)
Case B: X21+X41-X13-X15=100, or(i.e., all demand at node 1 is met)
5-12
A Word of Caution
• These rules are there to help us write the proper flow balance constraints.
• In reality, the essential underlying rule is that what comes into a node (via arcs or external supply) comes out of the node (again via arcs or external demand).
• Note that the stated rules make the implicit assumption that the supplies, regardless at what nodes they occur at, can be routed through the network to meet demands at their appropriate nodes. – This assumption may not always be true.
– When this assumption is untrue, we may have an infeasible model
– We will look later on at one way to handle the infeasibility
5-13
Defining the Constraints
• In the BMC problem: Total Supply = 500 carsTotal Demand = 480 cars
• For each supply or demand 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)
5-14
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
5-15
Implementing the Model
See file Fig5-2.xls
5-16
Optimal Solution to the BMC Problem
Newark1
Boston2
Columbus
3
Atlanta5
Richmond
4
J'ville7
Mobile6
$30
$40
$50
$40
$50
$45
-200
-300
+80
+100
+60
+170
+70
120
80
20
40
70
210
5-17
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
• There exists efficient algorithms for the shortest path problem that can solve huge networks (say, with 10,000 nodes and 1 million variables) in a matter of seconds; however, Solver only has one generic Simplex solver for all LP problems.
5-18
The American Car Association
B'hamAtlanta
G'ville
Va Bch
Charl.
L'burg
K'ville
A'ville
G'boro Raliegh
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
5-19
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 Fig5-7.xls
5-20
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…
5-21
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
5-22
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 on arc: cost of new computers minus salvage value for traded in computersCosts for arcs out of node 1: Cost of trading after 1 year (arc to node 2): 1.06*$62,000 - 0.6*$62,000 = $28,520 Cost of trading after 2 years (arc to node 3): 1.062*$62,000 - 0.15*$62,000 = $60,363Costs for arcs out of node 2: Cost of trading after 1 year (arc to node 3): 1.062*$62,000 - 0.6*1.06*$62,000 = $30,231 Cost of trading after 2 years (arc to node 4): 1.063*$62,000 - 0.15*1.06*$62,000 = $63,985And so on …
5-23
Solving the Problem
See file Fig5-12.xls
5-24
Transportation & Assignment Problems
• Some network flow problems don’t have trans-shipment nodes; only supply and demand nodes. These are termed “transportation problems” (Example covered in Chapter 3).
• Transportation problems with flows that are either zero or 1 are called “assignment problems” (e.g., assigning jobs to machines on next slide).
• There exists efficient algorithms for each of these two different problems that are one or more orders of magnitude faster than generic LP solvers ; however, Solver only has one generic Simplex solver for all LP problems.
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 approach in Chapter 3 (Fig 3-24.xls).
5-25
• Assignment models are used to assign, on a one-to-one basis, members of one set to members of another set in a least-cost (or least-time) manner.
• Assignment models are special cases of transportation models where all flows are 0 or 1.
• It is identical to the transportation model except with different inputs.
Assignment Problems
5-26
There are four jobs that must be completed by five machines. Machines 1, 3 and 5 can hold at most one job each, whereas machines 2 and 4 can handle two jobs each.
1
1
1
2
2
1
1
1
1
Machine 1
Machine 2
Machine 3
Machine 4
Machine 5
Job 1
Job 2
Job 3
Job 4
$14
$5
$8
$7
.
.
.
Example
5-27
The objective is to minimize the overall cost.
Refer to Assignment.xls file referenced under Lecture.
Job
Machine
1 2 3 4
1 $14 $5 $8 $7
2 $2 $12 $6 $5
3 $7 $8 $3 $9
4 $2 $4 $6 $10
5 $5 $5 $4 $8
Assignment Problem Example - Continued
5-28
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?• There exists efficient algorithms for the maximal
problem that can solve huge networks (say, with 10,000 nodes and 1 million variables) in a matter of seconds; however, Solver only has one generic Simplex solver for all LP problems.
5-29
The Northwest Petroleum Company
Oil Field
Pumping Station 1
Pumping Station 2
Pumping Station 3
Pumping Station 4
Refinery1
2
3
4
5
6
UB =6
UB = 4
UB = 3
UB = 6
UB = 4
UB = 5
UB = 2
UB = 2
5-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
UB = 6
UB = 4
UB = 3
UB = 6
UB = 4
UB = 5
UB = 2
UB = 2
5-31
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 <= 6
0 <= X13 <= 4 0 <= X34 <= 2 0 <= X56 <= 4
0 <= X24 <= 3 0 <= X35 <= 5 0 <= X61 <= inf
5-32
Implementing the Model
See file Fig5-24.xls
5-33
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
4
2
5
4
2
5-34
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?
5-35
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.
This allows us to place lower bounds on the aggregate flows into these nodes.
Special Modeling Considerations:Flow Aggregation
5-36
Special Modeling Considerations:Multiple Arcs Between Nodes
1-75
$8
2 +50
Two (or more) arcs can share the same beginning and ending nodes. You just need to label them differently in the algebraic formulation : e.g., X121 and X122. Implementation in Excel would be identical to before.
The book also offers an alternative scheme …
$6
1
10
2
+0
+50-75
$0
$6
U.B. = 35
$8
U.B. = 35
5-37
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=30
Supply exceeds demand, but the upper bounds prevent the demand from being met.Note that this situation may even happen without the capacity restrictions. It may be that the network is not connected in a fashion to allow the available supply to reach the required demand.
5-38
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=30
0
+200
$999, UB=100
$999, UB=100
Now, demand exceeds total supply and you can use Rule 2.As much “real” demand as possible will be met in the least costly way.
5-39
End of Chapter 5