The Continuous Approximation Approach

1-to-1 Distribution
John H. Vande Vate
Spring, 2001
1
1
When Demand Varies
Predictably
• D(t) = cumulative demand to time t
• D’(t) = rate of demand at time t.
• Two cases:
– Only Rent Costs matter
– Only Inventory Costs matter
2
2
To Minimize the Maximum...
• Make them all the same size
• If we have n shipments in time t, make
them all size D(t)/n
• Question reduces to n
– Trade off shipment cost (smaller n) vs
– Inventory cost (larger n)
3
3
That’s just an EOQ problem
• Total cost with n shipments is
– Transportation cost (ignore variable portion)
• fixed*n
– Inventory Cost
• Rent Cost is $/unit/year
• Rent * (D(T)/n)*T
– Average Cost per unit
• Rent*T/n + fixed*n/D(T)
– So n is Rent*T*D(T)/fixed
4
4
More realistic - Ignore Rent
• Wagner-Whitin Dynamic programming
approach.
• Computationally intensive
• How accurate is the forecast of demand?
• How sensitive is the cost to the answer?
5
5
Wagner-Whitin
• Discuss Later
6
6
The Continuous Approximation
Approach
There is some t’ where Area = (t3-t2)2D’(t’)/2
Fixed shipment cost + ci*area
Area  (t3-t2)height/2
height  (t3-t2)D’(t’)
t0
t1
t2
t’
t3
7
7
Step Function
• H(t) = (ti - ti-1) if ti-1  t < ti
• So total
cost = (Fixed + c*areai)
= (Fixed + c*(ti - ti-1)2D’(ti’)/2)
= (Fixed + c*H(ti’)2D’(ti’)/2)
= (Fixed /H(t) + c*H(t)D’(t’)/2)dt
An abuse of notation
8
8
Equivalence
= (Fixed + c*H(ti’)2D’(ti’)/2)
= (Fixed /H(t) + c*H(t)D’(t’)/2)dt
Why?
• Fixed /H(t)dt =  ti ti-1Fixed /H(t)dt
•
•
=  ti ti-1Fixed /(ti - ti-1)dt
=  Fixed
• c*H(t)D’(t’)/2dt =  ti ti-1c*H(t)D’(ti’)/2dt
•
=  ti ti-1c*(ti - ti-1) D’(ti’)/2dt
•
=  c*(ti - ti-1)2 D’(ti’)/2
•
=  c*H(t’i)2 D’(ti’)/2
9
9
Approximation
Total cost
= (Fixed + c*H(ti’)2D’(ti’)/2)
= (Fixed /H(t) + c*H(t)D’(t’)/2)dt
(Fixed /H(t) + c*H(t)D’(t)/2)dt
• Find a smooth function H(t) that
minimizes the cost (an EOQ formula)
• H(t) = (2Fixed/cD’(t))
10
10
H(t) and Headways
7
6
5
4
H(t)
h
3
2
1
11
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
11
What is H(t)?
•
•
•
•
•
If Demand is constant with rate D’
We dispatch every t time units
Cost per time = Fixed/t + ctD’/2
Best headway is
t = (2Fixed/cD’)
• Compare with H(t)
• H(t) = (2Fixed/cD’(t))
12
12
Back to the Discrete World
• We have a continuous approximation
H(t) to the discrete (step function)
headways.
• How do we recover implementable
headways from H(t)?
13
13
Consistent Headways
• Finding Headways consistent with H(t)
• Headway = Avg of H(t) in [0, Headway]
• Avg = Integral of H(t) over the Headway/Headway
• Headway2 = Integral of H(t) over the Headway
• Find Headways so that the squares approximate the
area under H(t)
14
14
Example
1.2
60
1
50
0.8
40
0.6
30
0.4
20
0.2
10
0
D'(t)
D(t)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
15
15
H(t) and Headways
7
6
5
4
H(t)
h
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
16
16
Example Cont’d
t
D'(t)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
D(t)
0.12
0.12
0.12
0.05
0.05
0.05
0.38
0.38
0.38
0.95
0.95
0.95
0.98
0.98
0.98
0.75
0.75
0.75
0.73
0.73
H(t)
0.60
1.20
1.79
2.07
2.34
2.62
4.53
6.44
8.35
13.08
17.81
22.55
27.42
32.30
37.18
40.94
44.71
48.47
52.11
55.75
4.09
4.09
4.09
6.04
6.04
6.04
2.29
2.29
2.29
1.45
1.45
1.45
1.43
1.43
1.43
1.63
1.63
1.63
1.66
1.66
Integral of H(t) t*t
h
Integral of H(t) t*t
h
4.09
1
5
8.18
4
5
12.27
9
5
18.31
16
5
24.35
25
5
30.40
36
6.04
1
32.68
49
8.33
4
34.97
64
10.62
9
37.26
81
12.91
16
38.71
100
14.36
25
40.17
121
15.81
36
41.62
144
17.27
49
43.05
169
18.70
64
44.48
196
20.13
81
45.92
225
21.56
100
47.55
256
23.19
121
49.18
289
24.82
144
50.80
324
26.45
169
52.46
361
28.11
196
54.12
400
29.77
225
3
3
3
17
17
How’d we do?
•
•
•
•
Inventory Cost 25.34
Shipment Cost 10
Total Cost 35.34
Is that any good?
18
18
Optimum Answer
set Periods;
param Demand{Periods};
table DemandTable IN "ODBC"
"DSN=Wagner"
"Demand":
Periods<-[Period], Demand;
read table DemandTable;
param FixedTransp := 1;
param VarTransp := 1;
param Holding := 1; /* $/unit/period */
var Inv{Periods} >= 0; /* Shipment quantity */
var Ship{Periods} binary; /* Whether or not we ship */
var Q{Periods} >= 0; /* Shipment size */
19
19
One Model
minimize TotalCost:
sum{t in Periods} FixedTransp*Ship[t] +
sum{t in Periods} VarTransp*Q[t] +
sum{t in Periods} Holding*Inv[t];
s.t. InitialInventory:
Q[1] - Inv[1] = Demand[1];
s.t. DefineInventory{t in Periods: t > 1}:
Inv[t-1] + Q[t] - Inv[t] = Demand[t];
s.t. SetupOrNot{t in Periods}:
Q[t] <= Ship[t]*sum{k in Periods: k >= t} Demand[k];
20
20
Comparison
• Optimum Solution 25.5
• Answer from CA Method 35.3
21
21
Why so Bad?
t
• D’(t) changes pretty wildly
1.2
60
1
50
0.8
40
0.6
30
0.4
20
0.2
10
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
D'(t)
D(t)
D'(t)
1.00
2.00
3.00
4.00
5.00
6.00
7.00
8.00
9.00
10.00
11.00
12.00
13.00
14.00
15.00
16.00
17.00
18.00
19.00
20.00
22
0.12
0.12
0.12
0.05
0.05
0.05
0.38
0.38
0.38
0.95
0.95
0.95
0.98
0.98
0.98
0.75
0.75
0.75
0.73
0.73
22
More on the Optimization Model
set Periods;
param Demand{Periods};
table DemandTable IN "ODBC"
"DSN=Wagner"
"Demand":
Periods<-[Period], Demand;
read table DemandTable;
param FixedTransp := 1;
param VarTransp := 1;
param Holding := 1; /* $/unit/period */
var Ship{Periods} binary;
/* Amount we ship in period s that meets demand in period t */
var Q{s in Periods, t in Periods: t >= s} >= 0;
23
23
A Better Model
minimize TotalCost:
sum{t in Periods} FixedTransp*Ship[t] +
sum{s in Periods, t in Periods: t >= s} VarTransp*Q[s,t] +
sum{s in Periods, t in Periods: t >= s} (t-s)*Q[s,t];
s.t. MeetDemand{t in Periods}:
sum{s in Periods: s <= t} Q[s,t] = Demand[t];
s.t. ShipOrNot{s in Periods, t in Periods: t >=s}:
Q[s,t] <= Ship[s]*Demand[t];
24
24
Why’s it Better
• Solves faster
• LP relaxation closer to MIP solutions
• Didn’t aggregate constraints
Q[s,t] <= Ship[s]*Demand[t]
• Implies
sum{t in Periods: t >= s} Q[s,t]
<= Ship[s]*sum{t in Periods: t>= s}
Demand[t];
Q[s] <= Ship[s]*sum{t in Periods: t >= s}
25
Demand[t];
25
Back To Wagner - Whitin
• A Computationally intensive Dynamic
Programming Procedure for solving
• Why?
• Advantage/Disadvantage of CA over
MIP
26
26
Aside on Importing Data
•
•
•
•
ODBC = Open Data Base Connectivity
ODBC Administrator : Control Panel
DSN = Data Source Name
Driver = Method for reading the DSN,
e.g., Excel 97
• Security and other features
27
27
With AMPL
•
•
•
•
Table <<tablename>> IN “ODBC”
“DSN=<<dsnname>>”
“tablename”:
definedset <- [index],
parametername~columnname, …;
• IN, OUT, INOUT
• SQL= sql statement
28
28