Mechanical Engineering 101 - University of California,...

36
© 20032012, McMains, Dornfeld ME 101 lecture 4 1 Mechanical Engineering 101 University of California, Berkeley Lecture #4

Transcript of Mechanical Engineering 101 - University of California,...

Page 1: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, DornfeldME 101 lecture 4 1

Mechanical Engineering 101

University of California, Berkeley

Lecture #4

Page 2: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 2

Today’s lecture

• Shortage Costs• Forecasting

Page 3: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 4

Holding costs vs. shortage costs

• tradeoff!• Higher holding costs for more safety stock

Sho

rtage

cost

s

Safety stock, SS

Page 4: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 5

Your demand forecast for time period 116?

Period 0 30 50 70 90 115

120

160

80

Dem

and

1. D <802. 80 <= D <1203. 120 <= D <1504. 150 <= D <1705. 170 <= D <1806. 180 <= D <1907. 190 <= D <2008. 200 <= D <2109. 210 <= D

Page 5: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 6

Forecasting

• looking at existing products, sales…– examine past data– find historical trends– extrapolate forward

• assumptions– past trends will continue– demand values a function of time

Page 6: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 7

Demand Data

• typically look at:– shipments– past customer orders

• is this the same as demand?

Page 7: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 9

Today’s lecture

• Shortage Costs• Forecasting

– unweighted models• constant & linear demand models• measuring error• least squares

– weighted model– non-trendbased forecasting

Page 8: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 10

Short term forecasting

• constant demand model• demand in period t, (Dt) =

– mean expected demand – + “random error” term t (0, 2)

Page 9: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 11

demand in period t estimated as constant mean + “random error” term:Dt = + t

Time (t)

1

1 2 3 10

Constant mean demand

Page 10: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 12

slope, m

y

x

b

Linear Demand Model

y = mx + b + y = mx + b

Page 11: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 13

Today’s lecture

• Shortage Costs• Forecasting

– unweighted models• constant & linear demand models• measuring error• least squares

– weighted model– non-trendbased

Page 12: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 14

slope, m

y

xb

•prediction - actual = error (residual)•if residuals all zero

•model is “perfect”•you faked the data•or your model has too many DOFs

• If model captures all significant information•residuals appear as “random noise” •(i.e. no predictable form)

. . . . . . . . .+

-

resi

dual

s

Goodness of Fity = mx + b +

Page 13: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 15

•Determine “average forecast error” measured over some historical set of data points, T:

e et

t1

T

T

We’d like this to be zero!

Model errors

Page 14: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 16

Demand (order size)

Frequency

+-

Averageorder size

Predicted average demand

bias

• Bias indicates model has some “dc level” offseterror in estimation

• usually easy to correct (-dc!)

Bias

Page 15: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 17

• zero “on average” not sufficient

• need low magnitude of forecast errore.g. low mean squared error (MSE)

MSE et e 2

t1

T

T 1

Model errors

Page 16: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 18

Today’s lecture

• Shortage Costs• Forecasting

– unweighted models• constant & linear demand models• measuring error• least squares

– weighted model– non-trendbased forecasting

Page 17: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 19

Least squares fits

• Excel will do least squares fits:– linear– log– exponential– power– polynomial

• choose “order” e.g. quadratic, cubic, etc.

Page 18: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 20

Excel least squares fits

• To compare least squares fits– compare R^2 values Excel calculates– higher (closer to 1) is a better fit

Better fit may not be better model!

• To calculate errors– Choose option “display equation on chart”– program equation in spreadsheet for

predictions of data points– calculate difference from actual value

Page 19: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 21

Which least squares fit is best model?

Least Squares Fits

7,600

7,800

8,000

8,200

8,400

8,600

8,800

9,000

1 2 3 4 5 6 7 8 9 10 11 12

Period

Dem

and Demand

Poly. (Demand)Expon. (Demand)Linear (Demand)

1. Polynomial2. Exponential3. Linear

Page 20: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 22

Announcements

• OH mods• HW due today 5pm,

– 3rd floor south side, homework box as indicated• No SID on HW• Include nick-name if any (in quotes)• Collaboration policy

Page 21: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 23

Your demand forecast for time period 116?

Period 0 30 50 70 90 115

120

160

80

Dem

and

1. D <802. 80 <= D <1203. 120 <= D <1504. 150 <= D <1705. 170 <= D <1806. 180 <= D <1907. 190 <= D <2008. 200 <= D <2109. 210 <= D

Page 22: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 24

Your demand forecast for time period 118?

Period 0 30 50 70 90 115

120

160

80

Dem

and

1. D <802. 80 <= D <1203. 120 <= D <1504. 150 <= D <1705. 170 <= D <1806. 180 <= D <1907. 190 <= D <2008. 200 <= D <2109. 210 <= D

Page 23: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 28

Today’s lecture

• Shortage Costs• Forecasting

– unweighted models– weighted model

• exponential smoothing– non-trendbased forecasting

Page 24: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 29

Simple exponential smoothing

• use weighted average of all past data• weight so importance of older data decays

is weighting factor• proportion of weight for most recent data

• estimate St (for future periods given data through period t):St = Dt + (1 - )St-1 (text eqn 3.3)

Page 25: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 30

Simple exponential smoothing

• St = Dt + (1 - )St-1

• St = Dt + (1 - )[Dt-1 + (1- ) St-2]• St = Dt + (1 - )Dt-1 + (1- )2 [Dt-2 + (1 - )St-3]• St = Dt + (1 - )Dt-1 + (1- )2Dt-2 + (1 - )3[ Dt-3+ (1 -

) St-4]

Page 26: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 31

Simple exponential smoothing

• St = Dt + (1 - )St-1

• St = Dt + (1 - )[Dt-1 + (1- ) St-2]• St = Dt + (1 - )Dt-1 + (1- )2 [Dt-2 + (1 - )St-3]• St = Dt + (1 - )Dt-1 + (1- )2Dt-2 + (1 - )3[ Dt-3+ (1 -

) St-4]

…• St = Dt + (1 - )Dt-1 + (1- )2Dt-2 + … + (1 - )t-1D1+ (1 - )tS0

Page 27: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 32

Simple exponential smoothing

• St = Dt + (1 - )St-1

• St = Dt + (1 - )[Dt-1 + (1- ) St-2]• St = Dt + (1 - )Dt-1 + (1- )2 [Dt-2 + (1 - )St-3]• St = Dt + (1 - )Dt-1 + (1- )2Dt-2 + (1 - )3[ Dt-3+ (1 -

) St-4]

…St (1)k

k 0

Dtk

Page 28: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 33

Exponential smoothing

• for 0< < 1, sum of all weight terms is 1• 0.001 < ≤ 0.3 typically • higher the faith in recent data, higher

St (1)k

k 0

Dtk

Page 29: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 34

Exponential smoothing

• how to get initial mean demand S0 from before we had data?– average all your data (assume constant mean process)

• first “prediction” = – S1 = D1 + (1 - )S0

• recurse to find St

• use as prediction for future periods– update as more data arrives

i

t

iD

tS

1

01

Page 30: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 35

Exponential Smoothing Example.

Page 31: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 38

Today’s lecture

• Shortage Costs• Forecasting

– unweighted models– weighted model– non-trendbased forecasting

Page 32: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 39

Market surveys

• random survey of potential customers– how likely to buy?

• survey existing customers– when will buy again?

Page 33: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 41

Delphi method

• ask the experts!– collect written forecasts from multiple “experts”

• including justifications

– compile all (anonymous) and redistribute• repeat

– anonymity reduces undue influences– caveats

• groupthink still possible• or may not converge at all• watch wording of questions

Page 34: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 42

Uses of Demand Forecasts

• Production planning– assembly line

• need for setting cycle time

– batch production• need for setting batch size

– EOQ formula

• when to add/close/upgrade production facilities• when to develop new products

– product life cycle

Page 35: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

ME 101 lecture 4 44© 2003‐2012, McMains, 

Dornfeld

New Product Life Cycle.

Page 36: Mechanical Engineering 101 - University of California, Berkeleycourses.me.berkeley.edu/ME101/2012_me101_lecture_04.pdf · 2012-09-04 · ME 101 lecture 4 6 Forecasting • looking

© 2003‐2012, McMains, Dornfeld ME 101 lecture 4 45

Homework 2, due next Tues. 5pm

• read Askin, pp.19‐35, 50‐56• HW (Askin unless otherwise specified). 

Always show your work, including formulas used.• E.g. print Excel spread‐sheets 2x, once with values and once with formulas used in 

your calculations, or turn in Matlab code• graph everything for forecasting, including plotting residuals to evaluate model 

– 2.12

– 2.22 (“sketch” means on a graph, with quantities and labels on axes.)Plus: Assume that batch size was set using EOQ. If the annual holding cost for the 

product is $8/unit, what must the setup cost have been?

– 3.5• do it twice, the 2nd time reversing the order of the data

– 3.8