McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8...

82
© The McGraw-Hill Companies, Inc., 2008 8.1 McGraw-Hill/Irwin Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming (Section 8.1) 8.2–8.15 NLP with Decreasing Marginal Returns: Wyndor (Section 8.2)8.16–8.20 NLP with Decreasing Marginal Returns: Portfolio Selection (Section 8.2) 8.21–8.25 Separable Programming (Section 8.3) 8.26–8.38 Difficult Nonlinear Programming Problems (Section 8.4) 8.39–8.40 Evolutionary Solver and Genetic Algorithms (Section 8.5)8.41–8.54 Nonlinear and Separable Programming (UW Lecture) 8.55–8.70 These slides are based upon a lecture from the MBA elective course “Modeling with Spreadsheets” at the University of Washington (as taught by one of the authors). Evolutionary Solver (UW Lecture) 8.71–8.82 These slides are based upon a lecture from the MBA elective course “Modeling with Spreadsheets” at the University of Washington (as taught by one of the authors).

Transcript of McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8...

Page 1: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.1McGraw-Hill/Irwin

Table of ContentsChapter 8 (Nonlinear Programming)

The Challenges of Nonlinear Programming (Section 8.1) 8.2–8.15NLP with Decreasing Marginal Returns: Wyndor (Section 8.2) 8.16–8.20NLP with Decreasing Marginal Returns: Portfolio Selection (Section 8.2) 8.21–8.25Separable Programming (Section 8.3) 8.26–8.38Difficult Nonlinear Programming Problems (Section 8.4) 8.39–8.40Evolutionary Solver and Genetic Algorithms (Section 8.5) 8.41–8.54

Nonlinear and Separable Programming (UW Lecture) 8.55–8.70These slides are based upon a lecture from the MBA elective course “Modeling with Spreadsheets” at the University of Washington (as taught by one of the authors).

Evolutionary Solver (UW Lecture) 8.71–8.82These slides are based upon a lecture from the MBA elective course “Modeling with Spreadsheets” at the University of Washington (as taught by one of the authors).

Page 2: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.2McGraw-Hill/Irwin

Examples of Linear and Nonlinear Formulas

Linear Formulas Nonlinear Formulas

SUMPRODUCT(D4:D6, C4:C6)[(D1 + D2) / D3] * C4IF(D2 >= 2, 2*C3, 3*C4)SUMIF(D1:D6, 4, C1:C6)SUM(D4:D6)2*C1 + 3*C4 + C6C1 + C2 + C3

SUMPRODUCT(C4:C6, C1:C3)[(C1 + C2) / C3] * D4IF(C2 >= 2, 2*C3, 3*C4)SUMIF(C1:C6, 4, D1:D6)ROUND(C1)MAX(C1, 0)MIN(C1, C2)ABS(C1)SQRT(C1)C1 * C2C1 / C2C1 ^2

Data cells are located in D1:D6 and changing cells are in C1:C6.

Page 3: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.3McGraw-Hill/Irwin

The Challenges of Nonlinear Programming

• Nonlinear programming is used to model nonproportional relationships between activity levels and the overall measure of performance, whereas linear programming assumes a proportional relationship.

• Constructing the nonlinear formula(s) needed for a nonlinear programming model is considerably more difficult than developing the linear formulas used in linear programming.

• Solving a nonlinear programming model is often much more difficult (if it is possible at all) than solving a linear programming model.

Page 4: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.4McGraw-Hill/Irwin

The Challenge of Nonproportional Relationships

• Proportionality Assumption of Linear Programming: The contribution of each activity to the value of the objective function is proportional to the level of the activity. In other words, the term in the objective function involving this activity consists of a coefficient times the decision variable.

• Nonlinear programming problems arise when any activity has a nonproportional relationship where the contribution of the activity to the measure of performance is not proportional to the level of the activity.

Page 5: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.5McGraw-Hill/Irwin

Profit Graphs for Wyndor Glass Co.(Proportional Relationship)

Production rate for doors Production rate for windows

Weekly Profit ($)

Weekly Profit ($)

300

600

900

1200

500

1000

1500

2000

2500

3000

0 0 2 4 62 4 D W

Page 6: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.6McGraw-Hill/Irwin

Profit Graphs with Nonproportional Relationships

Decreasing Marginal ReturnsPiecewise Linear with

Decreasing Marginal Returns

Page 7: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.7McGraw-Hill/Irwin

Profit Graphs with Nonproportional Relationships

Decreasing Marginal ReturnsExcept for Discontinuities Increasing Marginal Returns

Page 8: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.8McGraw-Hill/Irwin

Constructing a Nonlinear Formula

12345678

A B C

Constructing a Nonlinear Formula

Level of Activity Profit2 $164 $245 $287 $3010 $33

Profit vs. Level of Activity

$0

$5

$10

$15

$20

$25

$30

$35

0 2 4 6 8 10

Level of Activity (x)

Pro

fit

Page 9: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.9McGraw-Hill/Irwin

Format Trendline Dialogue Box

Page 10: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.10McGraw-Hill/Irwin

The Trendline (Quadratic Equation)

12345678

A B C

Constructing a Nonlinear Formula

Level of Activity Profit2 $164 $245 $287 $3010 $33

Profit vs. Level of Activity

y = -0.3002x2 + 5.661x + 6.1477

$0

$5

$10

$15

$20

$25

$30

$35

0 2 4 6 8 10

Level of Activity (x)

Pro

fit

Page 11: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.11McGraw-Hill/Irwin

Solving Nonlinear Programming Models

Consider the following model in algebraic form:

Maximize Profit = 0.5x5 – 6x4 + 24.5x3 – 39x2 + 20x

subject to

x ≤ 5

x ≥ 0

Page 12: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.12McGraw-Hill/Irwin

Solver Solution Starting with x = 0

1

2345

67

A B C D E

A Simple NLP

Maximumx = 0.371 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $3.19

Page 13: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.13McGraw-Hill/Irwin

Solver Solution Starting with x = 3

1

2345

67

A B C D E

A Simple NLP

Maximumx = 3.126 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $6.13

Page 14: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.14McGraw-Hill/Irwin

Solver Solution Starting with x = 4.7

1

2345

67

A B C D E

A Simple NLP

Maximumx = 5.000 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $0.00

Page 15: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.15McGraw-Hill/Irwin

The Profit Graph

Profit ($)

x

Page 16: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.16McGraw-Hill/Irwin

Original Wyndor Glass Co. Spreadsheet

123456789101112

A B C D E F G

Wyndor Glass Co. Product-Mix Problem

Doors WindowsUnit Profit $300 $500

Hours HoursUsed Available

Plant 1 1 0 2 <= 4Plant 2 0 2 12 <= 12Plant 3 3 2 18 <= 18

Doors Windows Total ProfitUnits Produced 2 6 $3,600

Hours Used Per Unit Produced

Page 17: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.17McGraw-Hill/Irwin

Wyndor Glass with Marketing Costs

• Market research indicates that Wyndor could sell small numbers of doors and windows with no advertising. However, extensive advertising would be required to sell all that could be produced.

• A curve-fitting procedure was used to estimate the weekly marketing costs required to sustain a production rate of D doors and W windows:

– Marketing cost for doors = $25D2

– Marketing costs for windows = ($662/3)W2

• The gross profit per door sold is about $375, and the gross profit per window is about $700. Therefore, the net profits are as follows:

– Net profit for doors = $375D – $25D2

Net profit for windows = $700W – ($662/3)W2

• Thus, the revised objective function is Maximize Profit = $375D – 25D2 + $700W –($662/3)W2

Question: Considering the nonlinear marketing costs, how many doors and windows should Wyndor produce?

Page 18: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.18McGraw-Hill/Irwin

Profit Graphs for Doors and Windows

Weekly profit ($)

Weekly profit ($)

0 2 4 D

200

400

600

800

1,000

1,200

0 2 4 6 W

200

400

600

800

1,000

1,200

1,400

1,600

1,800

Production rate for doors Production rate for windows

Page 19: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.19McGraw-Hill/Irwin

Spreadsheet Formulation

12345678910111213141516

A B C D E F G H

Wyndor Problem With Nonlinear Marketing Costs

Doors WindowsUnit Profit (Gross) $375 $700

Hours HoursUsed Available

Plant 1 1 0 3.214 <= 4Plant 2 0 2 8.357 <= 12Plant 3 3 2 18 <= 18

Doors WindowsUnits Produced 3.214 4.179 Gross Profit from Sales $4,130

Marketing Cost $258 $1,164 Total Marketing Cost $1,422

Total Profit $2,708

Hours Used Per Unit Produced

Page 20: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.20McGraw-Hill/Irwin

Graphical Display of Nonlinear Formulation

0 1 2 3 4 5 D

1

2

3

4

6

5

W

Feasible region

3 14

5 28(3 , 4 ) = optimal solution

Profit = $2,800

Profit = $2,708

Profit = $2,600

Profit = $2,500

Production rate for doors

Production rate for windows

Page 21: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.21McGraw-Hill/Irwin

Portfolio Selection

• It is now common practice for professional managers of large stock portfolios to use computer models based on nonlinear programming to guide them.

• Investors are concerned about both the expected return and the risk.

• One way of formulating their approach is as a nonlinear version of a cost-benefit trade-off problem:

– Minimize Risksubject to Expected return ≥ Minimum acceptable level

• Consider a portfolio with 3 stocks.

Question: What is the portfolio that will minimize the risk subject to achieving at least an 18% expected return?

Page 22: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.22McGraw-Hill/Irwin

Data for Stocks

StockExpectedReturn

Risk(StandardDeviation)

Pairof

Stocks

Joint Riskper Stock

(Covariance)

1 21% 25% 1 and 2 0.040

2 30 45 1 and 3 –0.005

3 8 5 2 and 3 –0.010

Page 23: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.23McGraw-Hill/Irwin

Algebraic Formulation

Minimize Risk = (0.25S1)2+(0.45S2)2+(0.05S3)2+2(0.04)S1S2+2(–0.005)S1S3+2(–0.01)S2S3

subject to

(21%)S1 + (30%)S2 + (8%)S3 ≥ 18%

S1 + S2 + S3 = 100%

and

S1 ≥ 0, S2 ≥ 0, S3 ≥ 0.

Page 24: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.24McGraw-Hill/Irwin

Spreadsheet Model

1234567891011121314151617181920212223

A B C D E F G H

Portfolio Selection Problem (Nonlinear Programming)

Stock 1 Stock 2 Stock 3Expected Return 21% 30% 8%

Risk (Stand. Dev.) 25% 45% 5%

Joint Risk (Covar.) Stock 1 Stock 2 Stock 3Stock 1 0.040 -0.005Stock 2 -0.010Stock 3

Stock 1 Stock 2 Stock 3 TotalPortfolio 40.2% 21.7% 38.1% 100% = 100%

MinimumExpected

Portfolio ReturnExpected Return 18.0% >= 18.0%

Risk (Variance) 0.0238

Risk (Stand. Dev.) 15.4%

Page 25: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.25McGraw-Hill/Irwin

Using Solver Table to Examine Trade-OffsBetween Expected Return and Risk

252627282930313233343536373839

B C D E F GRisk Expected

Min Return Stock 1 Stock 2 Stock 3 (St. Dev.) Return40.2% 21.7% 38.1% 15.4% 18.0%

8% 7.1% 3.7% 89.1% 3.9% 9.7%10% 8.1% 4.3% 87.6% 3.9% 10.0%12% 16.2% 8.6% 75.2% 5.6% 12.0%14% 24.2% 13.0% 62.8% 8.6% 14.0%16% 32.2% 17.3% 50.5% 12.0% 16.0%18% 40.2% 21.7% 38.1% 15.4% 18.0%20% 48.2% 26.1% 25.7% 18.9% 20.0%22% 56.2% 30.4% 13.4% 22.5% 22.0%24% 64.2% 34.8% 1.0% 26.1% 24.0%26% 44.4% 55.6% 0.0% 30.8% 26.0%28% 22.2% 77.8% 0.0% 37.3% 28.0%30% 0.0% 100.0% 0.0% 45.0% 30.0%

Page 26: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.26McGraw-Hill/Irwin

Wyndor Glass When Overtime is Needed

• Wyndor Glass has accepted a special order for hand-crafted goods to be made in plants 1 and 2 throughout the next four months.

• Filling this order will require borrowing certain employees from the work crews of regular products.

• The remaining workers will need to work overtime to utilize the full production capacity of each plant’s machinery for the regular products.

• The original constraints of Hours Used ≤ Hours Available are still valid. However, the objective function will need to be modified because of the additional cost of using overtime work.

• In particular, because of the additional cost, the profit per unit will be reduced for those units that require overtime.

Question: Considering overtime costs, how many doors and windows should Wyndor produce?

Page 27: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.27McGraw-Hill/Irwin

Data for Wyndor When Overtime is Needed

    Maximum Weekly Production      Profit per Unit Produced

ProductRegular

Time Overtime TotalRegular

Time Overtime

Doors 3 1 4 $300 $200

Windows 3 3 6 500 100

(and 3D + 2W ≤ 18)

Page 28: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.28McGraw-Hill/Irwin

Profit Graphs for Doors and Windows

900

1,100

Weekly profit ($)

3 40Production rate for doors

0 3 6Production rate for windows

1,500

1,800

Weekly profit ($)

D W

Page 29: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.29McGraw-Hill/Irwin

The Separable Programming Technique

• For each activity that violates the proportionality assumption, separate its profit graph into parts, with a line segment in each part.

• Then, instead of using a single decision variable to represent the level of each such activity, introduce a separate new decision variable for each line segment on that activity’s profit graph.

• Since the proportionality assumption holds for these new decision variables, formulate a linear programming model in terms of these variables.

• For the Wyndor problem, these new decision variables are– DR = Number of doors produced per week on regular time

– DO = Number of doors produced per week on overtime

– WR = Number of windows produced per week on regular timeWO = Number of windows produced per week on overtime

Page 30: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.30McGraw-Hill/Irwin

Separable Programming Spreadsheet Model

123456789101112131415161718

A B C D E F G

Wyndor Problem with Overtime (Separable Programming)

Unit Profit Doors WindowsRegular $300 $500

Overtime $200 $100Hours HoursUsed Available

Plant 1 1 0 4 <= 4Plant 2 0 2 6 <= 12Plant 3 3 2 18 <= 18

Doors Windows Doors WindowsRegular 3 3 <= 3 3

Overtime 1 0 <= 1 3Total Produced 4 3

Total Profit $2,600

Hours Used Per Unit Produced

MaximumUnits Produced

Page 31: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.31McGraw-Hill/Irwin

Separable Programming with Smooth Profit Graphs

Level of activity

Profit

Profit graph

Approximation

Page 32: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.32McGraw-Hill/Irwin

Advantages of Separable Programming

• The Excel Solver can readily solve nonlinear problems that have decreasing marginal returns, with the advantage that no approximation is needed.

• However, the separable programming approach also has certain advantages:

– Converting the problem into a linear programming problem tends to make it quicker to solve, which can be very helpful for large problems.

– A linear programming formulation makes available Solver’s Sensitivity Report.

– Separable programming only requires estimating the profit from each activity at a few points. Therefore, it is not necessary to use a curve fitting method to estimate the formula for the profit graph.

Page 33: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.33McGraw-Hill/Irwin

Wyndor Problem with Both Overtime Costs andNonlinear Marketing Costs

• The previous spreadsheet model does not include nonlinear marketing costs.

• Recall that the curve-fitting procedure was used to estimate the weekly marketing costs required to sustain a production rate of D doors and W windows:

– Marketing cost for doors = $25D2

– Marketing costs for windows = ($662/3)W2

Question: Considering both overtime costs and nonlinear marketing costs, how many doors and windows should Wyndor produce?

Page 34: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.34McGraw-Hill/Irwin

Data for Wyndor with Overtime Costs andNonlinear Marketing Costs

  Maximum Weekly Production              Gross Unit Profit           

ProductRegular

Time Overtime TotalRegular

Time OvertimeMarketing

Costs

Doors 3 1 4 $375 $275 $25D2

Windows 3 3 6 700 300 662/3W2

Page 35: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.35McGraw-Hill/Irwin

Weekly Profit from Producing Doors

DGrossProfit

MarketingCosts Profit

IncrementalProfit

0 $0 $0 $0 —

1 375 25 350 350

2 750 100 650 300

3 1,125 225 900 250

4 1,400 400 1,000 100

Page 36: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.36McGraw-Hill/Irwin

Weekly Profit from Producing Windows

WGrossProfit

MarketingCosts Profit

IncrementalProfit

0 $0 $0 $0 —

1 700 662/3 6331/3 6331/3

2 1,400 2662/3 1,1331/3 500

3 2,100 600 1,500 3662/3

4 2,400 1,0662/3 1,3331/3 –1662/3

5 2,700 1,6662/3 1,0331/3 –300

6 3,000 2,400 600 –4331/3

Page 37: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.37McGraw-Hill/Irwin

Separable Programming Spreadsheet Model

1234567891011121314151617181920212223

A B C D E F G

Wyndor with Overtime and Marketing Costs (Separable)

Unit Profit Doors WindowsRegular (0-1) $350.00 $633.33Regular (1-2) $300.00 $500.00Regular (2-3) $250.00 $367.67

Overtime $100.00 -$300.00

Hours HoursUsed Available

Plant 1 1 0 4 <= 4Plant 2 0 2 6 <= 12Plant 3 3 2 18 <= 18

Doors Windows Doors WindowsRegular (0-1) 1 1 <= 1 1Regular (1-2) 1 1 <= 1 1Regular (2-3) 1 1 <= 1 1

Overtime 1 0 <= 1 3Total Produced 4 3

Total Profit $2,501

Hours Used Per Unit Produced

MaximumUnits Produced

Page 38: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.38McGraw-Hill/Irwin

Nonlinear Programming Spreadsheet Model

1234567891011121314151617181920

A B C D E F G H

Wyndor With Overtime and Marketing Costs (Nonlinear Programming)

Unit Profit (Gross) Doors WindowsRegular $375 $700Overtime $275 $300

Hours HoursUsed Available

Plant 1 1 0 4 <= 4Plant 2 0 2 6 <= 12Plant 3 3 2 18 <= 18

Units Produced Doors Windows Doors WindowsRegular 3 3 <= 3 3Overtime 1 0 <= 1 3

Total Produced 4 3Gross Profit from Sales $3,500

Marketing Cost $400 $600 Total Marketing Cost $1,000Total Profit $2,500

Hours Used Per Unit Produced

Maximum

Page 39: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.39McGraw-Hill/Irwin

Difficult Nonlinear Programming Problems

• Even if a model has a nonlinear objective function, so long as the model has certain properties (e.g., linear constraints, decreasing marginal returns), the Solver can easily find an optimal solution.

• In some cases separable programming can be used to model a nonlinear problem in such a way that linear programming can be used.

• However, if a problem has increasing marginal returns, or nonlinear functions in the constraints, or disconnected profit graphs, finding a solution is often much more difficult.

– such problems may have many local optima

– Solver can get stuck at local optima, rather than finding the global optimum

• One approach with such problems is to solve the problem many times, each time starting with a different initial solution.

– Solver Table can be used to do this process more systematically when there are only one or two variables.

Page 40: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.40McGraw-Hill/Irwin

Using Solver Table to Try Different Starting Points

1

2345

6789101112

A B C D E F G H I

Using Solver Table to Try Different Starting Points

Maximum Startingx = 0.371 <= 5 Point Solution

x x * ProfitProfit = 0.5x5-6x4+24.5x3-39x2+20x 0.371 $3.19

= $3.19 0 0.371 $3.191 0.371 $3.192 3.126 $6.133 3.126 $6.134 3.126 $6.135 5.000 $0.00

Page 41: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.41McGraw-Hill/Irwin

Evolutionary Solver and Genetic Algorithms

• Evolutionary Solver uses an entirely different approach than the standard Solver to search for an optimal solution for a model.

• The philosophy of Evolutionary Solver is based on genetics, evolution and the survival of the fittest. Hence, this type of algorithm is sometimes called a genetic algorithm.

• The standard Solver starts with a single solution, and then moves in directions that will improve this solution. Evolutionary Solver begins by randomly generating a whole population of solutions.

• After generating the population, Evolutionary Solver creates a new generation by pairing off solutions in the population to create “offspring”, combining some elements from each parent.

Page 42: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.42McGraw-Hill/Irwin

Evolutionary Solver and Genetic Algorithms

• Among solutions in the population, some will be good (or “fit”) and some will be bad (or “unfit”), as measured by evaluating the objective function. Borrowing from the principles of evolution and survival of the fittest, the “fit” members are allowed to reproduce more frequently than the unfit members.

• Another key feature is mutation. Like gene mutation in biology, Evolutionary Solver will occasionally make a random change in a member of the population. This helps the algorithm get unstuck if it is getting trapped near a local optimum.

• Evolutionary Solver keeps creating new generations of solutions until there have been no improvements for several consecutive generations.

Page 43: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.43McGraw-Hill/Irwin

Selecting a Portfolio to Beat the Market

• A common goal of portfolio managers is to beat the market.

• If we assume that past performance is somewhat of an indicator of the future, then picking a portfolio that beat the market most often in the past might yield a portfolio that will more than likely beat the market in the future.

• Consider a portfolio of five large stocks traded on the New York Stock Exchange (NYSE):

– Disney (DIS)

– Boeing (BA)

– General Electric (GE)

– Procter & Gamble (PG)

– McDonald’s (MCD)

Question: What mix of these five stocks will yield a portfolio that is likely to beat the market in the future?

Page 44: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.44McGraw-Hill/Irwin

Spreadsheet Model

123456789101112131415161718192021222324252627282930313233343536

A B C D E F G H I J K

Beating the Market (Evolutionary Solver)Beat Market

Quarter Year DIS BA GE PG MCD Return Market? (NYSE)Q4 2005 0.38% 3.77% 4.85% -2.15% 2.74% 1.92% Yes 1.59%Q3 2005 -4.17% 3.34% -2.21% 13.29% 20.71% 6.19% Yes 5.75%Q2 2005 -12.35% 13.36% -3.31% 0.04% -10.88% -2.63% No 0.70%Q1 2005 3.34% 13.45% -0.57% -3.33% -2.90% 2.00% Yes -1.14%Q4 2004 24.37% 0.67% 9.32% 2.26% 16.50% 10.62% Yes 10.35%Q3 2004 -11.52% 1.45% 4.26% -0.13% 7.84% 0.38% Yes -0.50%Q2 2004 2.00% 24.99% 6.80% 4.31% -9.02% 5.81% Yes 0.06%Q1 2004 7.12% -2.17% -0.89% 5.49% 15.07% 4.93% Yes 2.09%Q4 2003 16.79% 23.28% 4.61% 8.12% 7.13% 11.99% No 14.53%Q3 2003 2.08% 0.55% 4.60% 4.64% 6.70% 3.71% Yes 2.52%Q2 2003 16.09% 37.76% 13.17% 0.60% 52.55% 24.03% Yes 16.38%Q1 2003 4.36% -23.61% 5.59% 4.11% -10.05% -3.92% Yes -5.40%Q4 2002 9.02% -2.84% -0.49% -3.42% -7.70% -1.09% No 6.16%Q3 2002 -19.86% -23.80% -14.56% 0.61% -37.92% -19.11% No -16.44%Q2 2002 -18.15% -6.39% -21.84% 0.32% 2.51% -8.71% Yes -11.22%Q1 2002 11.42% 24.95% -6.24% 14.39% 4.85% 9.87% Yes 1.80%Q4 2001 12.44% 16.34% 8.23% 9.29% -1.51% 8.96% Yes 8.45%Q3 2001 -35.55% -39.57% -23.50% 14.73% 0.28% -16.72% No -12.53%Q2 2001 1.03% 0.08% 17.06% 2.54% 1.91% 4.52% Yes 4.38%Q1 2001 -1.20% -15.34% -12.37% -19.82% -21.90% -14.13% No -9.32%Q4 2000 -23.81% 2.55% -16.81% 17.65% 13.37% -1.41% No -0.93%Q3 2000 -1.45% 54.71% 9.62% 18.77% -8.36% 14.66% Yes 3.13%Q2 2000 -5.91% 11.00% 2.16% 0.48% -11.87% -0.83% No -0.74%Q1 2000 41.04% -8.47% 0.87% -48.07% -7.29% -4.38% No -0.40%

0% 0% 0% 0% 0%<= <= <= <= <= Sum

Portfolio 20.0% 20.0% 20.0% 20.0% 20.0% 100% = 100%<= <= <= <= <=

100% 100% 100% 100% 100%Number of QuartersBeating the Market

15

Page 45: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.45McGraw-Hill/Irwin

Premium Solver Dialogue Box

Page 46: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.46McGraw-Hill/Irwin

Solver Options Dialogue Box

Page 47: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.47McGraw-Hill/Irwin

Limit Options Dialogue Box

Page 48: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.48McGraw-Hill/Irwin

Evolutionary Solver Spreadsheet Solution123456789101112131415161718192021222324252627282930313233343536

A B C D E F G H I J K

Beating the Market (Evolutionary Solver)Beat Market

Quarter Year DIS BA GE PG MCD Return Market? (NYSE)Q4 2005 0.38% 3.77% 4.85% -2.15% 2.74% 1.78% Yes 1.59%Q3 2005 -4.17% 3.34% -2.21% 13.29% 20.71% 7.26% Yes 5.75%Q2 2005 -12.35% 13.36% -3.31% 0.04% -10.88% 0.88% Yes 0.70%Q1 2005 3.34% 13.45% -0.57% -3.33% -2.90% 1.80% Yes -1.14%Q4 2004 24.37% 0.67% 9.32% 2.26% 16.50% 5.96% No 10.35%Q3 2004 -11.52% 1.45% 4.26% -0.13% 7.84% 2.05% Yes -0.50%Q2 2004 2.00% 24.99% 6.80% 4.31% -9.02% 8.46% Yes 0.06%Q1 2004 7.12% -2.17% -0.89% 5.49% 15.07% 3.13% Yes 2.09%Q4 2003 16.79% 23.28% 4.61% 8.12% 7.13% 11.11% No 14.53%Q3 2003 2.08% 0.55% 4.60% 4.64% 6.70% 3.79% Yes 2.52%Q2 2003 16.09% 37.76% 13.17% 0.60% 52.55% 19.73% Yes 16.38%Q1 2003 4.36% -23.61% 5.59% 4.11% -10.05% -4.12% Yes -5.40%Q4 2002 9.02% -2.84% -0.49% -3.42% -7.70% -2.71% No 6.16%Q3 2002 -19.86% -23.80% -14.56% 0.61% -37.92% -14.53% Yes -16.44%Q2 2002 -18.15% -6.39% -21.84% 0.32% 2.51% -7.27% Yes -11.22%Q1 2002 11.42% 24.95% -6.24% 14.39% 4.85% 10.51% Yes 1.80%Q4 2001 12.44% 16.34% 8.23% 9.29% -1.51% 9.57% Yes 8.45%Q3 2001 -35.55% -39.57% -23.50% 14.73% 0.28% -11.69% Yes -12.53%Q2 2001 1.03% 0.08% 17.06% 2.54% 1.91% 5.54% Yes 4.38%Q1 2001 -1.20% -15.34% -12.37% -19.82% -21.90% -16.55% No -9.32%Q4 2000 -23.81% 2.55% -16.81% 17.65% 13.37% 3.44% Yes -0.93%Q3 2000 -1.45% 54.71% 9.62% 18.77% -8.36% 21.62% Yes 3.13%Q2 2000 -5.91% 11.00% 2.16% 0.48% -11.87% 1.89% Yes -0.74%Q1 2000 41.04% -8.47% 0.87% -48.07% -7.29% -18.41% No -0.40%

0% 0% 0% 0% 0%<= <= <= <= <= Sum

Portfolio 2.6% 25.0% 25.7% 34.8% 12.0% 100% = 100%<= <= <= <= <=

100% 100% 100% 100% 100%Number of QuartersBeating the Market

19

Page 49: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.49McGraw-Hill/Irwin

Tour of American League Ballparks

• After completing her MBA from the UW in Seattle, Becky Thomas would like to tour the United States.

• She would like to see a major league baseball game in every American League city.

• She will then return to Seattle to start a job in the fall.

Question: What route will minimize Becky’s travel distance?

Page 50: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.50McGraw-Hill/Irwin

Tour of American League Ballparks

Seattle

Anaheim

Minnesota

Texas

Cleveland

Kansas City

ChicagoNew York

BostonToronto

Detroit

Oakland

Baltimore

Tampa Bay

Page 51: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.51McGraw-Hill/Irwin

Unsolved Spreadsheet Model forTour of American League Ballparks

1234567891011121314151617181920212223242526

A B C D E F G H I J K L M N O P Q

Tour of the American League Ballparks

Distance 1 2 3 4 5 6 7 8 9 10 11 12 13(miles) SEA ANA BAL BOS CHI CLE DET KC MIN NY OAK TB TEX TOR

SEA 0 1134 2708 3016 2052 2391 2327 1858 1653 2841 810 3077 2131 25641 ANA 1134 0 2647 3017 2048 2382 2288 1577 1857 2794 387 2490 1399 25232 BAL 2708 2647 0 427 717 358 514 1070 1113 199 2623 950 1357 4573 BOS 3016 3017 427 0 994 657 799 1435 1390 222 3128 1293 1753 6094 CHI 2052 2048 717 994 0 348 279 542 410 809 2173 1160 921 5155 CLE 2391 2382 358 657 348 0 172 819 758 471 2483 1108 1189 2966 DET 2327 2288 514 799 279 172 0 769 685 649 2399 1184 1156 2407 KC 1858 1577 1070 1435 542 819 769 0 443 1233 1861 1171 505 10068 MIN 1653 1857 1113 1390 410 758 685 443 0 1217 1979 1573 949 9069 NY 2841 2794 199 222 809 471 649 1233 1217 0 2930 1150 1559 516

10 OAK 810 387 2623 3128 2173 2483 2399 1861 1979 2930 0 2823 1752 262711 TB 3077 2490 950 1293 1160 1108 1184 1171 1573 1150 2823 0 1079 134812 TEX 2131 1399 1357 1753 921 1189 1156 505 949 1559 1752 1079 0 143513 TOR 2564 2523 457 609 515 296 240 1006 906 516 2627 1348 1435 0

Tour Start 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th EndRoute 1 2 3 4 5 6 7 8 9 10 11 12 13

City SEA ANA BAL BOS CHI CLE DET KC MIN NY OAK TB TEX TOR SEAMiles Traveled 1134 2647 427 994 348 172 769 443 1217 2930 2823 1079 1435 2564

Total Miles Traveled 18,982

2324

B C D E P QCity SEA =INDEX($C$6:$C$18,D22) =INDEX($C$6:$C$18,E22) =INDEX($C$6:$C$18,P22) SEA

Miles Traveled =INDEX(D6:D18,D22) =INDEX($E$6:$Q$18,D22,E22) =INDEX($E$6:$Q$18,O22,P22) =INDEX(D6:D18,P22)

26P Q

Total Miles Traveled =SUM(D24:Q24)

Page 52: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.52McGraw-Hill/Irwin

The alldifferent Constraint

The alldifferent constraint in Premium Solver constrains n changing cells to be unique integers from 1 to n.

Page 53: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.53McGraw-Hill/Irwin

Solved Spreadsheet Model forTour of American League Ballparks

1234567891011121314151617181920212223242526

A B C D E F G H I J K L M N O P Q

Tour of the American League Ballparks

Distance 1 2 3 4 5 6 7 8 9 10 11 12 13(miles) SEA ANA BAL BOS CHI CLE DET KC MIN NY OAK TB TEX TOR

SEA 0 1134 2708 3016 2052 2391 2327 1858 1653 2841 810 3077 2131 25641 ANA 1134 0 2647 3017 2048 2382 2288 1577 1857 2794 387 2490 1399 25232 BAL 2708 2647 0 427 717 358 514 1070 1113 199 2623 950 1357 4573 BOS 3016 3017 427 0 994 657 799 1435 1390 222 3128 1293 1753 6094 CHI 2052 2048 717 994 0 348 279 542 410 809 2173 1160 921 5155 CLE 2391 2382 358 657 348 0 172 819 758 471 2483 1108 1189 2966 DET 2327 2288 514 799 279 172 0 769 685 649 2399 1184 1156 2407 KC 1858 1577 1070 1435 542 819 769 0 443 1233 1861 1171 505 10068 MIN 1653 1857 1113 1390 410 758 685 443 0 1217 1979 1573 949 9069 NY 2841 2794 199 222 809 471 649 1233 1217 0 2930 1150 1559 516

10 OAK 810 387 2623 3128 2173 2483 2399 1861 1979 2930 0 2823 1752 262711 TB 3077 2490 950 1293 1160 1108 1184 1171 1573 1150 2823 0 1079 134812 TEX 2131 1399 1357 1753 921 1189 1156 505 949 1559 1752 1079 0 143513 TOR 2564 2523 457 609 515 296 240 1006 906 516 2627 1348 1435 0

Tour Start 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th EndRoute 10 1 12 11 2 9 3 13 5 6 4 7 8

City SEA OAK ANA TEX TB BAL NY BOS TOR CLE DET CHI KC MIN SEAMiles Traveled 810 387 1399 1079 950 199 222 609 296 172 279 542 443 1653

Total Miles Traveled 9,040

Page 54: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.54McGraw-Hill/Irwin

Advantages and Disadvantages of Evolutionary Solver

• Evolutionary Solver has two significant advantages over the standard Solver for solving difficult nonlinear programming problems:

– The complexity of the objective function does not matter. As long as the function can be evaluated for a given candidate solution (to determine the level of fitness), it does not matter if the function has kinks, discontinuities, or many local optima.

– By evaluating whole populations of candidate solutions, Evolutionary Solver keeps from getting trapped at a local optimum. Even if the whole population evolves toward a locally optimal solution, mutation allows the possibility of getting unstuck.

• However, Evolutionary Solver is not a panacea.– It can take much longer that standard Solver to find a final solution.

– Evolutionary Solver does not perform well on models that have many constraints.

– Evolutionary Solver is a random process. Running it again on the same model usually will yield a different solution.

– The best solution found is typically not optimal (although it may be very close).

Page 55: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.55McGraw-Hill/Irwin

Nonlinear Programming

Consider the following model for a nonlinear programming problem:

Maximize Profit = 0.5x5 – 6x4 + 24.5x3 – 39x2 + 20x

subject to

0 ≤ x ≤ 5

Page 56: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.56McGraw-Hill/Irwin

Solver Solution Starting with x = 0

1

2345

67

A B C D E

A Simple NLP

Maximumx = 0.371 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $3.19

Page 57: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.57McGraw-Hill/Irwin

Solver Solution Starting with x = 3

1

2345

67

A B C D E

A Simple NLP

Maximumx = 3.126 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $6.13

Page 58: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.58McGraw-Hill/Irwin

Solver Solution Starting with x = 4.7

1

2345

67

A B C D E

A Simple NLP

Maximumx = 5.000 <= 5

Profit = 0.5x5-6x4+24.5x3-39x2+20x

= $0.00

Page 59: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.59McGraw-Hill/Irwin

The Profit Graph

Profit ($)

x

Page 60: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.60McGraw-Hill/Irwin

Problems That Solver will Solver Correctly

• A maximization problem with linear constraints and a concave objective function.

A Concave Function

Line joining any two pointsis on or below the curve

Page 61: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.61McGraw-Hill/Irwin

Problems That Solver will Solver Correctly

• A minimization problem with linear constraints and a convex objective function.

A Convex Function

Line joining any two pointsis on or above the curve

Page 62: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.62McGraw-Hill/Irwin

Quality Furniture Corporation

• The Quality Furniture Corporation manufactures two products: benches and tables.

• They employ three carpenters. During the next week, 120 hours of labor are available at regular wages ($8 per hour).

• Up to 30 hours of overtime can be used at a wage rate of $12 per hour.

• Up to 30 hours of weekend time can be utilized at a wage rate of $16 per hour.

• 540 pounds of wood is available at a cost of $2 per pound.

• Each bench requires 3 labor hours and 12 pounds of wood. Each table requires 6 labor hours and 38 pounds of wood.

• Completed benches sell for $80 each, and tables sell for $200 each.

Question: How many benches and how many tables should be produced?

Page 63: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.63McGraw-Hill/Irwin

Outdoor Furniture Labor Costs

Labor Cost

Labor Hours30 60 90 120 150 180

$960

$1320

$1600

$8/hr Regular

$12/hr Overtime

$16/hr Weekend

Page 64: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.64McGraw-Hill/Irwin

Nonlinear Programming Spreadsheet

123456789101112131415161718192021222324

A B C D E F G

Quality Furniture Corporation (Nonlinear)

Benches TablesRevenue/Unit $85 $200

Total Used AvailableLabor 3 6 135 <= 180Wood 12 38 540 <= 540

Wood Cost/lb. $2

Labor Cost Hours(per hour) Available

Regular $8 120Overtime $12 30Sunday $16 30

Benches TablesProduction 45 0

Revenue $3,825.00Wood Cost $1,080.00Labor Cost $1,140.00

Profit $1,605.00

Usage per Unit Produced

Page 65: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.65McGraw-Hill/Irwin

Outdoor Furniture Labor Costs

Labor Cost

Labor Hours30 60 90 120 150 180

$960

$1320

$1600

$8/hr Regular

$12/hr Overtime

$16/hr Weekend

Page 66: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.66McGraw-Hill/Irwin

Separable Programming Spreadsheet

1234567891011121314151617181920212223242526272829

A B C D E F G

Quality Furniture Corporation (Separable)

Benches TablesRevenue/Unit $85 $200

Total Used AvailableLabor 3 6 135 <= 135Wood 12 38 540 <= 540

Wood Cost/lb. $2

Labor Cost Hours(per hour) Available

Regular $8 120Overtime $12 30Sunday $16 30

Benches TablesProduction 45 0

Labor UsedRegular Hours 120 <= 120

Overtime Hours 15 <= 30Weekend Hours 0 <= 30

Revenue $3,825.00Wood Cost $1,080.00Labor Cost $1,140.00

Profit $1,605.00

Usage per Unit Produced

Page 67: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.67McGraw-Hill/Irwin

Advertising Example

12345678910111213141516171819202122

A B C

Advertising Example (Nonlinear)

Parameters:Unit Variable Cost $48Unit Price $65Salesforce Salary $9,000Fixed Overhead $23,000Seasonality 1.2

Decision Variable:Advertising $122,949

Quarter Q1Units Sold 14994

Sales Revenue $974,610 Cost of Sales $719,712Gross Margin $254,898

Total Fixed Costs $154,949

Profit $99,949

Sales(35)(Seasonality Factor) Advertising+

Sales Force2

Page 68: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.68McGraw-Hill/Irwin

The Sales Function

Sales(35)(Seasonality Factor) Advertising+

Sales Force2

0

2000

4000

6000

8000

10000

12000

14000

16000

18000

20000

0 50000 100000 150000 200000

Advertising

Sal

es L

evel

Page 69: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.69McGraw-Hill/Irwin

Approximating a Nonlinear Function

1234567891011

A B C D

Approximating the Nonlinear Sales Function

Seasonality = 1.2Sales Force = 9000

Advertising Level Sales Level Slope$0 2,817

$50,000 9,805 0.1398$100,000 13,577 0.0754$150,000 16,509 0.0586$200,000 18,993 0.0497

Page 70: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.70McGraw-Hill/Irwin

Advertising Example Using Separable Programming

1234567891011121314151617181920212223242526

A B C D E F G

Advertising Example (Separable)

Parameters:Unit Variable Cost $48Unit Price $65Salesforce Salary $9,000Fixed Overhead $23,000Seasonality 1.2

Units Sold perAdvertising Dollar

Advertising ($0-$50,000) 0.1398 $50,000 <= $50,000Advertising ($50,000-$100,000) 0.0754 $50,000 <= $50,000Advertising ($100,000-$150,000) 0.0586 $0 <= $50,000Advertising ($150,000-) 0.0497 $0

$100,000 Total AdvertisingQuarter Q1

Units Sold 13577

Sales Revenue $882,505 Cost of Sales $651,696Gross Margin $230,809

Total Fixed Costs $132,000

Profit $98,809

Page 71: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.71McGraw-Hill/Irwin

Evolutionary Solver

• The standard Solver has difficulty with problems that are– highly nonlinear

– are not smooth (have “kinks” in the objective)

– have discontinuities (the objective jumps in value)

– have many local optima (many hills and valleys)

• Excel functions like IF, MAX, ABS, ROUND, etc., tend to cause one or more of these problems.

Page 72: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.72McGraw-Hill/Irwin

Premium Solver

• Included on the textbook CD is the “Premium Solver”. After installing, a new button (“Premium”) is added to Solver.

Page 73: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.73McGraw-Hill/Irwin

Premium Solver

• Clicking on the “Premium” button switches to Premium Solver, which gives the option of three different solvers.

– Standard GRG Nonlinear is equivalent to the regular Solver without choosing “Assume Linear Model”.

– Standard Simplex LP is equivalent to the regular Solver with choosing “Assume Linear Model”.

– Standard Evolutionary uses a genetic evolutionary algorithm that is only available with Premium Solver.

Page 74: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.74McGraw-Hill/Irwin

How Genetic Algorithms (Evolutionary Solver) Work

Genetic algorithms (such as Evolutionary Solver) use principles from the theory of evolution.

• The Population: a large set of random solutions is generated.

• Level of fitness: each member of the population (solution) is evaluated to determine its level of “fitness” (value of objective).

• Evolution: a new generation (set of solutions) is created as follows:– Reproduction: pairs reproduce and create new solutions that share some properties

of each.

– Survival of the Fittest: more “fit” solutions reproduce more frequently, less “fit” solutions are allowed to die out.

– Mutation: occasionaly random “mutations” are introduced.

Page 75: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.75McGraw-Hill/Irwin

Inventory Ordering Policy with Quantity Discounts

• Consider a manufacturer that orders a given part from a supplier.

• They require 10,000 parts per year.

• There is a cost associated with each order (due to processing, receiving costs, fixed shipping costs, etc.) of $20.

• The cost of holding a part in inventory is estimated at $4 per year.

• The supplier of this part offers quantity discounts on the purchasing cost of this part according to the following schedule.

Order Quantity Purchase Price (per unit)

1–99 $10.00

100–499 9.80

500–999 9.70

1,000–9,999 9.60

10,000+ 9.50

Page 76: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.76McGraw-Hill/Irwin

Total Annual Cost

• Recall from Operations Management class that the total annual cost (including puchasing, ordering, and holding costs) is

Total Annual Cost = Dp + (Q / 2)H + (D / Q)S

where

D = Annual demand

p = purchase cost

Q = order size

H = annual holding cost per unit

S = ordering cost

Page 77: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.77McGraw-Hill/Irwin

Spreadsheet Model

12345678910111213

A B C D E F G H I

Ordering Policy with Quantity Discounts

Min OrderQuantity Price

1 $10.00 1 Annual Cost100 $9.80 <= Purchasing $192,000500 $9.70 Order Quantity 1000 Ordering $400

1,000 $9.60 <= Holding $2,00010,000 $9.50 20,000 Total $194,400

Annual Demand 20,000 Price $9.60Ordering Cost $20

Annual Holding Cost $4

Page 78: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.78McGraw-Hill/Irwin

Attempts with Standard Solver

Various “solutions” provided by the standard Solver, depending on the starting point:

Starting Point (Q) Solution (Q*) Cost

1 1,000 $194,400

200 500 195,800

400 447 197,789

600 500 195,800

1,200 1,000 194,400

11,000 10,000 210,040

12,000 1,000 194,400

Page 79: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.79McGraw-Hill/Irwin

Cost Function with Quantity Discounts

$190,000

$195,000

$200,000

$205,000

$210,000

$215,000

$220,000

$225,000

$230,000

Cost

Order Quantity (logarithmic scale)

10 100 1000 10,000447 500

Page 80: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.80McGraw-Hill/Irwin

Solving with the Evolutionary Solver

12345678910111213

A B C D E F G H I

Ordering Policy with Quantity Discounts

Min OrderQuantity Price

1 $10.00 1 Annual Cost100 $9.80 <= Purchasing $192,000500 $9.70 Order Quantity 1000 Ordering $400

1,000 $9.60 <= Holding $2,00010,000 $9.50 20,000 Total $194,400

Annual Demand 20,000 Price $9.60Ordering Cost $20

Annual Holding Cost $4

Page 81: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.81McGraw-Hill/Irwin

Tips on Using Evolutionary Solver

• Bounding all of the variables greatly aids the Evolutionary Solver by decreasing the search space.

• The limit options should be increased (Max Time, Max Subproblems, and Max Feasible Sols) for challenging problems. Setting Tolerance to 0.0005 and Max Time Without Improvements to 30 will ensure the algorithm will stop if the Target Cell value has improved less than 0.05% in the last 30 seconds.

• Experiment with different populations sizes and mutation rates to see what works well. I have found that higher than default mutation rates can be helpful in problems with lots of local optima.

• The Evolutionary Solver can take a very long time, but it will usually find a good solution.

Page 82: McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 8.1 Table of Contents Chapter 8 (Nonlinear Programming) The Challenges of Nonlinear Programming.

© The McGraw-Hill Companies, Inc., 20088.82McGraw-Hill/Irwin

Tips on Using Evolutionary Solver

• There is no guarantee that Evolutionary Solver will find the best solution.

• The Evolutionary Solver performs well even with nasty objective functions, but is not very efficient at handling constraints.

• Much of the solution process is driven by random numbers that direct the search. Thus, two people running Evolutionary Solver on the same model may get different results.

• Once Evolutionary Solver has found a good solution, you can use GRG Nonlinear Solver (the nonlinear algorithm that is included with the Premium Solver software) to try to find a slightly better solution.