chapter 3: the art of modeling with spreadsheets · dr. samia rouibah ٢ introduction to management...

21
١ Dr. Samia Rouibah Introduction to Management Science Spreadsheets Modeling Chapter 3: The Art of Modeling with Spreadsheets Chapter 4: Linear Programming Chapter 5: What-If Analysis for LP

Upload: dangdiep

Post on 01-Aug-2018

220 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١Dr. Samia Rouibah Introduction to Management Science

Spreadsheets Modeling

Chapter 3: The Art of Modeling with Spreadsheets

Chapter 4: Linear Programming

Chapter 5: What-If Analysis for LP

Page 2: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٢Dr. Samia Rouibah Introduction to Management Science

Table of ContentsChapter 3 (The Art of Modeling with Spreadsheets)

The Everglade Golden Years Co. Cash Flow Problem (Section 3.1) 3.2–3.3

The Process of Modeling with Spreadsheets (Section 3.2) 3.3–3.11

Guidelines for Building “Good” Spreadsheet Models (Section 3.3) 3.12–3.16

Debugging a Spreadsheet Model (Section 3.4) 3.16–3.20

Page 3: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٣Dr. Samia Rouibah Introduction to Management Science

The Everglade Cash Flow Problem

102012

–22011

72010

–42009

32008

62007

32006

–42005

–22004

–82003

Projected Net Cash Flow(millions of dollars)

Year

Page 4: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٤Dr. Samia Rouibah Introduction to Management Science

The Everglade Cash Flow Problem

• Their short-term cash flow requirements cannot be met without borrowing.

• A long-term (10 year) loan can be taken with an interest rate of 7%

• A series of short-term loans (1 year) can be taken with a projected interest rate of 10%

Question: Which loan (or combination of loans) should be taken, and in what amounts, in order to maximize their cash-balance position after 10 years?

Page 5: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٥Dr. Samia Rouibah Introduction to Management Science

The Process of Modeling(developed in the following)

Plan

Build

Test

Analyze

Visualize where you want to finish Do some calculations by hand Sketch out a spreadsheet

Start with a small-scale model

Try different trial solutions to check the logic

Evaluate proposed solutions and/oroptimize with Solver

Expand the model to full scale

If the solution reveals inadequacies in the model, return to Plan or Build

Page 6: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٦Dr. Samia Rouibah Introduction to Management Science

Plan: Visualize Where You Want to Finish

• A common stumbling block in the modeling process occurs right at the beginning—”How do I get started?”

• At this point it can be useful to ask the question—”Where do I want to end up?”

– What information do I need to provide in a report?– What should the “answer” look like?– What kinds of numbers need to be included in the recommendation?

• What information is needed in the Everglade Cash Flow problem?

Page 7: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٧Dr. Samia Rouibah Introduction to Management Science

Plan: Do Some Calculations by Hand

• Another common stumbling block arises when trying to enter a formula in one of the output cells.

• At this point, it can be useful to do some calculations by hand.– Just pick some numbers for the changing cells and determine what the results

should be.

• Suppose Everglade takes out a $6 million long-term loan and then adds short-term loans of $2 million in 2003 and $5 million in 2004.

– How much cash will they have left at the end of 2003?– How much cash will they have left at the end of 2004?

Page 8: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٨Dr. Samia Rouibah Introduction to Management Science

Plan: Sketch Out a Spreadsheet

LT RateST Rate

Start BalanceMinimum Cash

Cash LT ST LT ST LT ST Ending MinimumFlow Loan Loan Interest Interest Payback Payback Balance Balance

20032004

:

>=:

20122013

Page 9: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٩Dr. Samia Rouibah Introduction to Management Science

Build: Start with a Small Version

• If the model is complicated, start with a small, readily manageable version of the model.

• First make sure you’ve got the logic of the model worked out correctly for the small version. Only then expand it to full size.

3456789

101112

B C D E F G H I J K LLT Rate 7%ST Rate 10%

Start Balance 1 (all cash figures in millions of dollars)MinimumCash 0.5

Cash LT ST LT ST LT ST Ending MinimumYear Flow Loan Loan Interest Interest Payback Payback Balance Balance2003 -8 6 2 1.00 >= 0.502004 -2 5 -0.42 -0.20 -2.00 1.38 >= 0.50

9101112

F G H I J K LLT ST LT ST Ending Minimum

Interest Interest Payback Payback Balance Balance=StartBalance+SUM(C11:I11) >= =MinimumCash

=-LTRate*LTLoan =-STRate*E11 =-E11 =J11+SUM(C12:I12) >= =MinimumCash

Page 10: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٠Dr. Samia Rouibah Introduction to Management Science

Test: Test the Small Version of the Model

• Test the small model thoroughly.

• Try values in the changing cells for which you know the answers (at least approximately).

– Examples:• All zeroes• All ones• Very large numbers• Numbers for which you’ve done hand calculations

• Expand the model to full size (copying formulas to the later years).

• Test the large model in a similar way.

Page 11: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١١Dr. Samia Rouibah Introduction to Management Science

Analyze: Analyze the Model (Before Solver)

3456789

101112131415161718192021

B C D E F G H I J K LLT Rate 7%ST Rate 10%

Start Balance 1 (all cash figures in millions of dollars)Minimum Cash 0.5

Cash LT ST LT ST LT ST Ending MinimumYear Flow Loan Loan Interest Interest Payback Payback Balance Balance2003 -8 6 2 1.00 >= 0.502004 -2 5 -0.42 -0.20 -2 1.38 >= 0.502005 -4 0 -0.42 -0.50 -5 -8.54 >= 0.502006 3 0 -0.42 0 0 -5.96 >= 0.502007 6 0 -0.42 0 0 -0.38 >= 0.502008 3 0 -0.42 0 0 2.20 >= 0.502009 -4 0 -0.42 0 0 -2.22 >= 0.502010 7 0 -0.42 0 0 4.36 >= 0.502011 -2 0 -0.42 0 0 1.94 >= 0.502012 10 0 -0.42 0 0 11.52 >= 0.502013 -0.42 0 -6 0 5.10 >= 0.50

Page 12: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٢Dr. Samia Rouibah Introduction to Management Science

Analyze: Analyze the Model (After Solver)

3456789

101112131415161718192021

B C D E F G H I J K LLT Rate 7%ST Rate 10%

Start Balance 1 (all cash figures in millions of dollars)Minimum Cash 0.5

Cash LT ST LT ST LT ST Ending MinimumYear Flow Loan Loan Interest Interest Payback Payback Balance Balance2003 -8 6.65 0.85 0.50 >= 0.502004 -2 3.40 -0.47 -0.09 -0.85 0.50 >= 0.502005 -4 8.21 -0.47 -0.34 -3.40 0.50 >= 0.502006 3 6.49 -0.47 -0.82 -8.21 0.50 >= 0.502007 6 1.61 -0.47 -0.65 -6.49 0.50 >= 0.502008 3 0 -0.47 -0.16 -1.61 1.27 >= 0.502009 -4 3.70 -0.47 0 0 0.50 >= 0.502010 7 0 -0.47 -0.37 -3.70 2.97 >= 0.502011 -2 0 -0.47 0 0 0.50 >= 0.502012 10 0 -0.47 0 0 10.03 >= 0.502013 -0.47 0 -6.65 0 2.92 >= 0.50

Page 13: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٣Dr. Samia Rouibah Introduction to Management Science

Guidelines for Building“Good” Spreadsheet Models

• Enter the Data First– Any spreadsheet model is driven by the data– It is easier (and usually better) to build the model around the data

• Organize and Clearly Identify the Data– Relevant data should be grouped (e.g. in tabular form)– All data should be labeled– Units should be identified

• Enter Each Piece of Data into One Cell Only– Refer to the original data as needed– This makes the model much easier to modify (only need to change data in one

place)

Page 14: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٤Dr. Samia Rouibah Introduction to Management Science

Guidelines for Building“Good” Spreadsheet Models

• Separate Data from Formulas– Avoid putting numbers directly in formulas– Put numbers in data cells and refer to them as needed– This makes all data visible and easier to modify

• Keep It Simple– Avoid “power functions” of Excel if possible– Break out complicated formulas into subtotals

• Use Range Names– Refer to data cells and blocks of cells using Excel’s range name feature– Range names make formulas and the Solver model much easier to read– Care must be taken not to overuse range names and to make sure they remain

correctly defined.

Page 15: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٥Dr. Samia Rouibah Introduction to Management Science

Guidelines for Building“Good” Spreadsheet Models

• Use Relative and Absolute References to Simplify Copying Formulas– Whenever multiple related formulas will be needed, try to enter the formula just

once, and then use Excel’s fill commands to replicate the formula.– This makes the model easer to build and also reduces typos.

• Use Borders, Shading, and Colors to Distinguish Cell Types– For example:

• Data cells in blue (no border)• Changing cells in yellow (regular border)• Target cell in orange (heavy border)

• Show Entire Model on Spreadsheet– All data should be visible.– All constraints should be on the spreadsheet (not buried in Solver), preferably in

three consecutive cells.

Page 16: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٦Dr. Samia Rouibah Introduction to Management Science

Three Tests for a “Good” Spreadsheet Model

• You should be able to immediately identify the data cells, changing cells, and target cell.

• All elements of the model should be visible on the spreadsheet (including allconstraints). You should not have to look in the Solver dialogue box to figure out the model.

• Each equation should be simple enough that you can tell what the equation is in each output cell without looking.

Page 17: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٧Dr. Samia Rouibah Introduction to Management Science

A Poor Spreadsheet Model

3456789

101112131415

B C D ELT ST Ending

Year Loan Loan Balance2003 6.65 0.85 0.502004 3.40 0.502005 8.21 0.502006 6.49 0.502007 1.61 0.502008 0 1.272009 3.70 0.502010 0 2.972011 0 0.502012 0 10.032013 2.92

3456789

101112131415

EEndingBalance

=1-8+C5+D5=E5-2+D6-$C$5*(0.07)-D5*(1.1)=E6-4+D7-$C$5*(0.07)-D6*(1.1)=E7+3+D8-$C$5*(0.07)-D7*(1.1)=E8+6+D9-$C$5*(0.07)-D8*(1.1)=E9+3+D10-$C$5*(0.07)-D9*(1.1)=E10-4+D11-$C$5*(0.07)-D10*(1.1)=E11+7+D12-$C$5*(0.07)-D11*(1.1)=E12-2+D13-$C$5*(0.07)-D12*(1.1)=E13+10+D14-$C$5*(0.07)-D13*(1.1)=E14+D15-$C$5*(1.07)-D14*(1.1)

Page 18: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٨Dr. Samia Rouibah Introduction to Management Science

Debugging a Spreadsheet Model: The Toggle

3456789

101112131415161718192021

B C D E F G H I J K LLT Rate 0.07ST Rate 0.1

Start Balance 1 gures in millions Minimum Cash 0.5

Cash LT ST LT ST LT ST Ending MinimumFlow Loan Loan Interest Interest Payback Payback Balance Balance

2003 -8 6.649459000.8505409978 =StartBalance+SUM(C11:I11) >= =MinimumCash2004 -2 3.4010572277=-LTRate*LTLoan =-STRate*E11 =-E11 =J11+SUM(C12:I12) >= =MinimumCash2005 -4 8.2066250806=-LTRate*LTLoan =-STRate*E12 =-E12 =J12+SUM(C13:I13) >= =MinimumCash2006 3 6.4927497189=-LTRate*LTLoan =-STRate*E13 =-E13 =J13+SUM(C14:I14) >= =MinimumCash2007 6 1.6074868209=-LTRate*LTLoan =-STRate*E14 =-E14 =J14+SUM(C15:I15) >= =MinimumCash2008 3 0 =-LTRate*LTLoan =-STRate*E15 =-E15 =J15+SUM(C16:I16) >= =MinimumCash2009 -4 3.6991597633=-LTRate*LTLoan =-STRate*E16 =-E16 =J16+SUM(C17:I17) >= =MinimumCash2010 7 0 =-LTRate*LTLoan =-STRate*E17 =-E17 =J17+SUM(C18:I18) >= =MinimumCash2011 -2 0 =-LTRate*LTLoan =-STRate*E18 =-E18 =J18+SUM(C19:I19) >= =MinimumCash2012 10 0 =-LTRate*LTLoan =-STRate*E19 =-E19 =J19+SUM(C20:I20) >= =MinimumCash2013 =-LTRate*LTLoan =-STRate*E20 =-LTLoan =-E20 =J20+SUM(C21:I21) >= =MinimumCash

Pressing control-~ toggles back-and-forth between showing values and showing formulas in the spreadsheet.

Page 19: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

١٩Dr. Samia Rouibah Introduction to Management Science

Debugging with the Auditing Toolbar

The button third from the left can be used to trace the dependents of a cell, that is, those cells with formulas that refer to this cell.

The leftmost button can be used to trace the precedents of a cell, that is, those cells that appear within the formula for this cell.

Page 20: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٢٠Dr. Samia Rouibah Introduction to Management Science

Dependents of the LT Loan Cell

123456789

101112131415161718192021

A B C D E F G H I J K L

Everglade Cash Flow Management Problem

LT Rate 7%ST Rate 10%

Start Balance 1 (all cash figures in millions of dollars)Minimum Cash 0.5

Cash LT ST LT ST LT ST Ending MinimumYear Flow Loan Loan Interest Interest Payback Payback Balance Balance2003 -8 6.649 0.851 0.500 >= 0.52004 -2 3.401 -0.465 -0.085 -0.851 0.500 >= 0.52005 -4 8.207 -0.465 -0.340 -3.401 0.500 >= 0.52006 3 6.493 -0.465 -0.821 -8.207 0.500 >= 0.52007 6 1.607 -0.465 -0.649 -6.493 0.500 >= 0.52008 3 0.000 -0.465 -0.161 -1.607 1.266 >= 0.52009 -4 3.699 -0.465 0.000 0.000 0.500 >= 0.52010 7 0.000 -0.465 -0.370 -3.699 2.965 >= 0.52011 -2 0.000 -0.465 0.000 0.000 0.500 >= 0.52012 10 0.000 -0.465 0.000 0.000 10.035 >= 0.52013 -0.465 0.000 -6.649 0.000 2.920 >= 0.5

Page 21: Chapter 3: The Art of Modeling with Spreadsheets · Dr. Samia Rouibah ٢ Introduction to Management Science Table of Contents Chapter 3 (The Art of Modeling with Spreadsheets) The

٢١Dr. Samia Rouibah Introduction to Management Science

Precedents of the ST Interest (2004) Cell

123456789

101112131415161718192021

A B C D E F G H I J K L

Everglade Cash Flow Management Problem

LT Rate 7%ST Rate 10%

Start Balance 1 (all cash figures in millions of dollars)Minimum Cash 0.5

Cash LT ST LT ST LT ST Ending MinimumYear Flow Loan Loan Interest Interest Payback Payback Balance Balance2003 -8 6.649 0.851 0.500 >= 0.52004 -2 3.401 -0.465 -0.085 -0.851 0.500 >= 0.52005 -4 8.207 -0.465 -0.340 -3.401 0.500 >= 0.52006 3 6.493 -0.465 -0.821 -8.207 0.500 >= 0.52007 6 1.607 -0.465 -0.649 -6.493 0.500 >= 0.52008 3 0.000 -0.465 -0.161 -1.607 1.266 >= 0.52009 -4 3.699 -0.465 0.000 0.000 0.500 >= 0.52010 7 0.000 -0.465 -0.370 -3.699 2.965 >= 0.52011 -2 0.000 -0.465 0.000 0.000 0.500 >= 0.52012 10 0.000 -0.465 0.000 0.000 10.035 >= 0.52013 -0.465 0.000 -6.649 0.000 2.920 >= 0.5