Upload
matthew-douglas
View
215
Download
0
Embed Size (px)
Citation preview
© The McGraw-Hill Companies, Inc., 200310.1McGraw-Hill/Irwin
Table of ContentsChapter 10 (Nonlinear Programming)
The Challenges of Nonlinear Programming (Section 10.1) 10.2–10.16NLP with Decreasing Marginal Returns: Wyndor (Section 10.2) 10.17–10.21NLP with Decreasing Marginal Returns: Portfolio Selection (Section 10.2) 10.22–10.26Separable Programming (Section 10.3) 10.27–10.39Difficult Nonlinear Programming Problems (Section 10.4) 10.40–10.41Evolutionary Solver and Genetic Algorithms (Section 10.5) 10.42–10.50
Nonlinear and Separable Programming (UW Lecture) 10.51–10.66These 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) 10.67–10.78These 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).
© The McGraw-Hill Companies, Inc., 200310.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.
© The McGraw-Hill Companies, Inc., 200310.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.
© The McGraw-Hill Companies, Inc., 200310.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.
© The McGraw-Hill Companies, Inc., 200310.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
© The McGraw-Hill Companies, Inc., 200310.6McGraw-Hill/Irwin
Profit Graphs with Nonproportional Relationships
Decreasing Marginal ReturnsPiecewise Linear with
Decreasing Marginal Returns
© The McGraw-Hill Companies, Inc., 200310.7McGraw-Hill/Irwin
Profit Graphs with Nonproportional Relationships
Decreasing Marginal ReturnsExcept for Discontinuities Increasing Marginal Returns
© The McGraw-Hill Companies, Inc., 200310.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
© The McGraw-Hill Companies, Inc., 200310.9McGraw-Hill/Irwin
Add Trendline Dialogue Box
© The McGraw-Hill Companies, Inc., 200310.10McGraw-Hill/Irwin
Add Trendline Options
© The McGraw-Hill Companies, Inc., 200310.11McGraw-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
© The McGraw-Hill Companies, Inc., 200310.12McGraw-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
© The McGraw-Hill Companies, Inc., 200310.13McGraw-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
© The McGraw-Hill Companies, Inc., 200310.14McGraw-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
© The McGraw-Hill Companies, Inc., 200310.15McGraw-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
© The McGraw-Hill Companies, Inc., 200310.16McGraw-Hill/Irwin
The Profit Graph
Profit ($)
x
© The McGraw-Hill Companies, Inc., 200310.17McGraw-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
© The McGraw-Hill Companies, Inc., 200310.18McGraw-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?
© The McGraw-Hill Companies, Inc., 200310.19McGraw-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
© The McGraw-Hill Companies, Inc., 200310.20McGraw-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
© The McGraw-Hill Companies, Inc., 200310.21McGraw-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
© The McGraw-Hill Companies, Inc., 200310.22McGraw-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?
© The McGraw-Hill Companies, Inc., 200310.23McGraw-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
© The McGraw-Hill Companies, Inc., 200310.24McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.25McGraw-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%
© The McGraw-Hill Companies, Inc., 200310.26McGraw-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%
© The McGraw-Hill Companies, Inc., 200310.27McGraw-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?
© The McGraw-Hill Companies, Inc., 200310.28McGraw-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)
© The McGraw-Hill Companies, Inc., 200310.29McGraw-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
© The McGraw-Hill Companies, Inc., 200310.30McGraw-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
© The McGraw-Hill Companies, Inc., 200310.31McGraw-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
© The McGraw-Hill Companies, Inc., 200310.32McGraw-Hill/Irwin
Separable Programming with Smooth Profit Graphs
Level of activity
Profit
Profit graph
Approximation
© The McGraw-Hill Companies, Inc., 200310.33McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.34McGraw-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?
© The McGraw-Hill Companies, Inc., 200310.35McGraw-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
© The McGraw-Hill Companies, Inc., 200310.36McGraw-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
© The McGraw-Hill Companies, Inc., 200310.37McGraw-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
© The McGraw-Hill Companies, Inc., 200310.38McGraw-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
© The McGraw-Hill Companies, Inc., 200310.39McGraw-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
© The McGraw-Hill Companies, Inc., 200310.40McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.41McGraw-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
© The McGraw-Hill Companies, Inc., 200310.42McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.43McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.44McGraw-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):
– America Online (AOL)
– Boeing (BA)
– Ford (F)
– 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?
© The McGraw-Hill Companies, Inc., 200310.45McGraw-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 AOL BA F PG MCD Return Market? (NYSE)Q4 2001 -3.02% 16.35% -8.54% 8.77% -1.64% 2.38% No 8.45%Q3 2001 -37.55% -39.56% -28.49% 14.71% 0.30% -18.12% No -12.53%Q2 2001 32.00% 0.07% -11.80% 2.54% 1.92% 4.95% Yes 4.38%Q1 2001 15.37% -15.34% 21.28% -19.80% -21.91% -4.08% Yes -9.32%Q4 2000 -35.14% 2.55% -7.00% 17.07% 13.37% -1.83% No -0.93%Q3 2000 1.46% 54.71% 3.66% 18.06% -8.35% 13.91% Yes 3.31%Q2 2000 -21.37% 10.98% -6.39% 0.00% -11.87% -5.73% No -0.91%Q1 2000 -11.36% -8.44% -13.83% -48.20% -7.29% -17.82% No -0.40%Q4 1999 45.82% -2.48% 6.10% 16.87% -6.79% 11.90% Yes 9.70%Q3 1999 -5.40% -2.83% -10.96% 6.38% 5.17% -1.53% Yes -8.54%Q2 1999 -25.17% 29.83% -0.44% -10.02% -9.24% -3.01% No 7.38%Q1 1999 89.52% 4.21% -3.41% 7.26% 17.98% 23.11% Yes 1.31%Q4 1998 177.96% -4.92% 24.87% 28.38% 28.69% 51.00% Yes 18.11%Q3 1998 6.18% -23.00% -20.34% -21.89% -13.50% -14.51% No -12.83%Q2 1998 53.89% -14.51% -8.94% 7.93% 15.00% 10.67% Yes 1.04%Q1 1998 50.96% 6.51% 33.46% 5.72% 25.65% 24.46% Yes 12.05%Q4 1997 19.96% -10.10% 7.62% 15.57% 0.26% 6.66% Yes 2.81%Q3 1997 35.61% 2.59% 18.75% -2.21% -1.42% 10.66% Yes 7.42%Q2 1997 30.90% 7.60% 21.12% 23.09% 2.25% 16.99% Yes 16.14%Q1 1997 27.82% -7.39% -2.71% 6.62% 4.13% 5.69% Yes 1.59%Q4 1996 -6.34% 12.70% 3.20% 10.39% -4.22% 3.15% No 6.80%Q3 1996 -18.86% 8.46% -3.47% 7.59% 1.34% -0.99% No 2.26%Q2 1996 -21.87% 0.58% -5.82% 6.93% -2.60% -4.56% No 3.54%Q1 1996 49.33% 10.53% 19.05% 2.11% 6.37% 17.48% Yes 5.28%
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
14
© The McGraw-Hill Companies, Inc., 200310.46McGraw-Hill/Irwin
Premium Solver Dialogue Box
© The McGraw-Hill Companies, Inc., 200310.47McGraw-Hill/Irwin
Solver Options Dialogue Box
© The McGraw-Hill Companies, Inc., 200310.48McGraw-Hill/Irwin
Limit Options Dialogue Box
© The McGraw-Hill Companies, Inc., 200310.49McGraw-Hill/Irwin
Evolutionary Solver Spreadsheet Solution
123456789101112131415161718192021222324252627282930313233343536
A B C D E F G H I J K
Beating the Market (Evolutionary Solver)Beat Market
Quarter Year AOL BA F PG MCD Return Market? (NYSE)Q4 2001 -3.02% 16.35% -8.54% 8.77% -1.64% 10.20% Yes 8.45%Q3 2001 -37.55% -39.56% -28.49% 14.71% 0.30% -24.12% No -12.53%Q2 2001 32.00% 0.07% -11.80% 2.54% 1.92% 7.02% Yes 4.38%Q1 2001 15.37% -15.34% 21.28% -19.80% -21.91% -10.53% No -9.32%Q4 2000 -35.14% 2.55% -7.00% 17.07% 13.37% -0.86% Yes -0.93%Q3 2000 1.46% 54.71% 3.66% 18.06% -8.35% 33.43% Yes 3.31%Q2 2000 -21.37% 10.98% -6.39% 0.00% -11.87% 1.31% Yes -0.91%Q1 2000 -11.36% -8.44% -13.83% -48.20% -7.29% -19.56% No -0.40%Q4 1999 45.82% -2.48% 6.10% 16.87% -6.79% 12.11% Yes 9.70%Q3 1999 -5.40% -2.83% -10.96% 6.38% 5.17% -0.78% Yes -8.54%Q2 1999 -25.17% 29.83% -0.44% -10.02% -9.24% 7.76% Yes 7.38%Q1 1999 89.52% 4.21% -3.41% 7.26% 17.98% 22.03% Yes 1.31%Q4 1998 177.96% -4.92% 24.87% 28.38% 28.69% 40.51% Yes 18.11%Q3 1998 6.18% -23.00% -20.34% -21.89% -13.50% -16.81% No -12.83%Q2 1998 53.89% -14.51% -8.94% 7.93% 15.00% 5.39% Yes 1.04%Q1 1998 50.96% 6.51% 33.46% 5.72% 25.65% 15.40% Yes 12.05%Q4 1997 19.96% -10.10% 7.62% 15.57% 0.26% 2.82% Yes 2.81%Q3 1997 35.61% 2.59% 18.75% -2.21% -1.42% 7.78% Yes 7.42%Q2 1997 30.90% 7.60% 21.12% 23.09% 2.25% 16.24% Yes 16.14%Q1 1997 27.82% -7.39% -2.71% 6.62% 4.13% 3.45% Yes 1.59%Q4 1996 -6.34% 12.70% 3.20% 10.39% -4.22% 8.06% Yes 6.80%Q3 1996 -18.86% 8.46% -3.47% 7.59% 1.34% 2.72% Yes 2.26%Q2 1996 -21.87% 0.58% -5.82% 6.93% -2.60% -2.22% No 3.54%Q1 1996 49.33% 10.53% 19.05% 2.11% 6.37% 15.88% Yes 5.28%
0% 0% 0% 0% 0%<= <= <= <= <= Sum
Portfolio 19.7% 52.0% 0.2% 26.6% 1.6% 100% = 100%<= <= <= <= <=
100% 100% 100% 100% 100%Number of QuartersBeating the Market
19
© The McGraw-Hill Companies, Inc., 200310.50McGraw-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).
© The McGraw-Hill Companies, Inc., 200310.51McGraw-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
© The McGraw-Hill Companies, Inc., 200310.52McGraw-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
© The McGraw-Hill Companies, Inc., 200310.53McGraw-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
© The McGraw-Hill Companies, Inc., 200310.54McGraw-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
© The McGraw-Hill Companies, Inc., 200310.55McGraw-Hill/Irwin
The Profit Graph
Profit ($)
x
© The McGraw-Hill Companies, Inc., 200310.56McGraw-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
© The McGraw-Hill Companies, Inc., 200310.57McGraw-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
© The McGraw-Hill Companies, Inc., 200310.58McGraw-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?
© The McGraw-Hill Companies, Inc., 200310.59McGraw-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
© The McGraw-Hill Companies, Inc., 200310.60McGraw-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
© The McGraw-Hill Companies, Inc., 200310.61McGraw-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
© The McGraw-Hill Companies, Inc., 200310.62McGraw-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
© The McGraw-Hill Companies, Inc., 200310.63McGraw-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
© The McGraw-Hill Companies, Inc., 200310.64McGraw-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
© The McGraw-Hill Companies, Inc., 200310.65McGraw-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
© The McGraw-Hill Companies, Inc., 200310.66McGraw-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
© The McGraw-Hill Companies, Inc., 200310.67McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.68McGraw-Hill/Irwin
Premium Solver
• Included on the textbook CD is the “Premium Solver”. After installing, a new button (“Premium”) is added to Solver.
© The McGraw-Hill Companies, Inc., 200310.69McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.70McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.71McGraw-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
© The McGraw-Hill Companies, Inc., 200310.72McGraw-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
© The McGraw-Hill Companies, Inc., 200310.73McGraw-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
© The McGraw-Hill Companies, Inc., 200310.74McGraw-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
© The McGraw-Hill Companies, Inc., 200310.75McGraw-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
© The McGraw-Hill Companies, Inc., 200310.76McGraw-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
© The McGraw-Hill Companies, Inc., 200310.77McGraw-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.
© The McGraw-Hill Companies, Inc., 200310.78McGraw-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.