Title: Modeling Flows
1Modeling Flows
- John H. Vande Vate
- Spring, 2006
2New Project Opportunity
- Sponsor CARE and Shelter First
- Design temporary shelters (tents)
- Design delivery mechanism
- Design logistics network
- Evaluate inventory levels, locations and cost
3Agenda
- Network Flows
- Review definition
- Simple Transportation Model
- Minimum Cost Flow Model
- Adding Realism
- Multiple commodities
- Weight, Cube, Linear Cube
- Concave Costs
- Modeling Time
4Reference
- Network Flows Theory, Algorithms, and
Applications (Hardcover)by Ravindra K. Ahuja,
Thomas L. Magnanti, James B. Orlin
5What Are They?
- Specially Structured Linear Programs
- Each variable appears in at most two constraints
- At most one constraint with a 1 coefficient
- At most one constraint with a -1 coefficient
- Each variable may be constrained by bounds
- Integer Data gt Integer Solutions
6Transportation Model
- Move Goods from Plants to Warehouses
- Single Commodity!
- Plants have supplies
- Warehouses have demands
- Costs are proportional to volume shipped (this
usually isnt very realistic)
7Example 2-3 (p 36)
- Single Product
- Two plants with identical production costs
- Two warehouses
- Markets allocated to warehouses for now
- Proportional transportation costs
8Example 2-3 contd
9Transportation Model (AMPL)
- Set Plants
- Set Warehouses
- Param Supply Plants
- Param Demand Warehouses
- Param CostPlants, Warehouses
- Var FlowPlants, Warehousesgt 0
- minimize TotalCost
- sump in Plants, w in Warehouses
Costp,wFlowp,w - s.t. WithinSupplyp in Plants
- sumw in Warehouses Flowp, w lt Supplyp
- s.t. MeetDemandw in Warehouses
- sump in Plants Flowp, w gt Demandw
10Minimum Cost Flow
- Move Goods from Plants to Markets via Warehouses
- Single Commodity!
- Plants have supplies
- Markets have demands
- Costs are proportional to volume shipped
11Example 2-3 Contd
12Minimum Cost Flow
- Set Locs
- Set Edges in Locs cross Locs
- param CostEdges
- param NetSupplyLocs
- var FlowVolEdges gt 0
- minimize TotalCost
- sum(f,t) in Edges Costf,tFlowVolf,t
- s.t. PathDefinitionloc in Locs
- sum(loc, t) in Edges FlowVolloc,t
- - sum(f, loc) in Edges FlowVolf, loc
NetSupplyloc
13Homogenous Product
Must be able to interchange positions of product
anywhere
14Another New Project
- Milliken Co. growing business in Asia looking
to explore distribution strategy Where should it
be positioning inventories to serve that region?
15Multi-Commodity Flows
- Several single commodity models
- You cant to turn lead into gold
- Conserve flow of each product through each
facility - Joined by common constraints
- Often capacity on lanes
- Or modeling cost (through capacity)
-
16Multiple Products
17Conveyance Capacity
- Weight Limits, e.g., 40,000 lbs
- Cubic Capacity (53 trailer)
- 3,970 cubic ft.
- Length 52' 6"
- Width 99"
- Height 110"
- Linear Cube (53 trailer)
- If load is not stackable, just floor space
18Conveyance Capacity
19Multiple Products Weight Cube
20Note
- No Longer a Network Model
- Solutions not integral
- Adding integrality constraints
21Multiple Products Weight Cube
22Concave Cost
Cost per unit decreasing
Cost
Without special constraints, what will solver do?
Shipment Size
23Modeling Economies of Scale
- Linear Programming
- Greedy
- Takes the High-Range Unit Cost first!
- Integer Programming
- Add constraints to ensure first things first
- Several Strategies
24Convex Combination
27
What will the cost be?
22
Total Cost
1/5th of the way
First Break Point
Second Break Point
0
10
Mid Point
20
25Conclusion
- If the Volume of Activity is a fraction ? of the
way from one breakpoint to the next, the cost
will be that same fraction of the way from the
cost at the first breakpoint to the cost at the
next - If Volume 10? 20(1-?)
- Then Cost 22? 27(1-?)
26Idea
- Express Volume of Activity as a Weighted Average
of Breakpoints - Express Cost as the same Weighted Average of
Costs at the Breaks - Activity Min Level ?0 Break 1 ?1
- Break 2 ?2 Max Level ?3
- Cost Cost at Min Level ?0 Cost at Break 1 ?1
- Cost at Break 2 ?2 Cost at Max
Level ?3 - 1 ?0 ?1 ?2 ?3
27Does that Do It?
High-Range Cost/Unit
Mid-Range Cost/Unit
Low Range Cost/Unit
X
Total Cost
Minimum Sustainable Level
Maximum Operating Level
First Break Point
Second Break Point
0
Volume of Activity
28 Role of Integer Variables
- Ensure we express Activity as a combination of
two consecutive breakpoints - var InRegion1..NBreaks binary
Total Cost
Minimum Sustainable Level
Maximum Operating Level
Second Break Point
First Break Point
0
29Constraints
- Lambda2 0 unless activity is between
- BreakPoint1 and BreakPoint2 (Region2) or
- BreakPoint2 and BreakPoint3 (Region3)
- Lambda2 ? InRegion2 InRegion3
Total Cost
Minimum Sustainable Level
Maximum Operating Level
Second Break Point
First Break Point
BreakPoint3
BreakPoint1
BreakPoint2
BreakPoint0
30We cant go wrong
High-Range Cost/Unit
Mid-Range Cost/Unit
Low Range Cost/Unit
X
Minimum Sustainable Level
Maximum Operating Level
First Break Point
Second Break Point
0
Volume of Activity
31Concave Costs
32In AMPL Speak
- param NBreaks
- param BreakPoint0..NBreaks
- param CostAtBreak0..NBreaks
- var Lambda0..NBreaks gt 0
- var Activity
- var Cost
- s.t. DefineCost
- Cost sumb in 0..NBreaks CostAtBreakbLambda
b - s.t. DefineActivity
- Activity sumb in 0..NBreaks
BreakPointbLambdab - s.t. ConvexCombination
- 1 sumb in 0..NBreaksLambdab
33And Activity in One Region
- InRegion1 InRegion2 InRegion3 ? 1
- Why ? 1?
- If it is in Region2
- Lambda1 ? InRegion1 InRegion2 1
- Lambda2 ? InRegion2 InRegion3 1
- Other Lambdas are 0
34AMPL Speak
- param NBreaks
- param BreakPoint0..NBreaks
- param CostAtBreak0..NBreaks
- var Lambda0..NBreaks gt 0
- var Activity
- var Cost
- s.t. DefineCost
- Cost sumb in 0..NBreaks CostAtBreakbLambda
b - s.t. DefineActivity
- Activity sumb in 0..NBreaks
BreakPointbLambdab - s.t. ConvexCombination
- 1 sumb in 0..NBreaksLambdab
35What We Added
- var InRegion1..NBreaks binary
- s.t. InOneRegion
- sumb in 1..NBreaks InRegionb lt 1
- s.t. EnforceConsecutiveb in 0..NBreaks-1
- Lambdab lt InRegionb InRegionb1
- s.t. LastLambda
- LambdaNBreaks lt InRegionNBreaks
36Good News!
- AMPL offers syntax to automate this
- Read Chapter 14 of Fourer for details
- ltltBreakPoint1, BreakPoint2 Slope1,
Slope2, Slope3gtgt Variable - Slope1 before BreakPoint1
- Slope2 from BreakPoint1 to BreakPoint2
- Slope3 after BreakPoint2
- Has 0 cost at activity 0
37Modeling Time
- Incorporating Schedules into Network Flow Models
- Example
- Given several scheduled pick-ups and deliveries
(must pick-up and deliver on-time) - Question How many vehicles required?
- Assumption One load on a vehicle at a time (No
shared capacity)
38Example
- How many vehicles are required to meet a schedule
of departures and returns - No shared capacity
39Network Model
40How to Construct the Routes?
Route ending with 3
Route 5 gt 3
41How to Construct the Routes?
Route ending with 6
Route 2 gt 7 gt 6
422nd Example of Time
- How many vehicles?
- Common
- Schedule provided
- No shared capacity
- Different Not just one terminal
43As a Network Problem
44Singapore Electric Generator
45Average Balances
- Averages (Starting Ending)/2
46Inventory
- Balancing Your Checkbook
- Previous Balance Income - Expenses New
Balance - Modeling Dynamic Inventory
- Starting Inv. Production - Shipments Ending
Inv.
47Singapore Electric Generator
48Network Model
- Ending Inv Calculated Ending Inv
- Prod. Qty lt Production Limits
- FinalInv gt MinimumEndingInv
-
49Network Model
- Ending Inv Calculated Ending Inv
- How Many constraints is this?
- Which constraints does Ending Inv for Jan appear
in? - With what coefficients?
- Which constraints does Production Qty in February
appear in?
50Summary
- Network Flows
- Transportation
- Supply Demand
- Minimum Cost Flows
- Supply, Demand Flow conservation
- Multicommodity Flows
- Conserve flow of each commodity
- Weight, Cube Conveyances
- Not a network flow model
- Non-integral solutions
- Non-Linear Costs
- Requires integer variables
- Modeling Time
51Next
- Inventory
- Deterministic (predominantly)
- Pipeline
- Cycle
- Stochastic (later)
- Safety stock safety