Вы находитесь на странице: 1из 52

Chapter 3

Introduction to Optimization Modeling

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


3.2 Introduction to Optimization
 Common elements of all optimization problems
– Decision Variables - the variables whose values the
decision maker is allowed to choose.
– Objective Function - value that is to be optimized –
maximized or minimized
– Constraints that must be satisfied

 Excel terminology for optimization


– Decision variables = changing cells
– Objective = target cell
– Constraints impose restrictions on the values in the
changing cells.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 A common form for a constraint is nonnegativity

 Nonnegativity constraints imply that changing cells


must contain nonnegative values.

 Two steps in solving an optimization problem.


– Model development – decide what the decision variables
are, what the objective is, which constraints are required and
how everything fits together
– Optimize – systematically choose the values of the decision
variables that make the objective as large or small as
possible and cause all of the constraints to be satisfied.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 A feasible solution is any set of values of the
decision variables that satisfies all of the constraints.

 The set of all feasible solutions is called the feasible


region.

 An infeasible solution is a solution where at least


one constraint is not satisfied.

 The optimal solution is the feasible solution that


optimizes the objective.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 An algorithm is basically a “plan of attack”. It is a
prescription for carrying out the steps required to
achieve some goal.

 The simplex method is an algorithm that is suitable


for linear models.

 Excel’s Solver tool finds the best feasible solution


with the most suitable algorithm.

 There is really a third step in the optimization


process: sensitivity analysis. This step allows us to
ask a number of what-if questions about the
completed model.
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Example 3.1 – Two Variable Model
 Maggie will allow herself no more then 450 calories
and 25 grams of fat in her daily desserts. She
requires at least 120 grams of desserts a day. Each
dessert also has a “taste index”.

 What should her daily dessert plan be to stay within


her constraints and maximizes the total taste index of
her dessert?

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Summary of given data
Serving of Serving of
snack bar ice cream Limits
Calories 120 160 450 per day

Fat 5 grams 10 grams 25 grams per


day
Weight 37 grams 65 grams At least 120
grams/day
Taste per gram 85 95 Maximize
total taste

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Formulation
 Decision variables
X1 = Daily servings of snack bar
X2 = Daily servings of ice cream

 Objective function
– Maximize total taste index
Max Z = 37*(85)X1 + 65(90)X2

 Constraints
– Calories consumed per day ≤ 450
– Fat consumed per day ≤ 25 grams
– Total dessert consumed ≥ 120 grams

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Constraints
 Calories consumed per day ≤ 450
120X1 + 160X2 ≤ 450

 Fat consumed per day ≤ 25 grams


5X1 + 10X2 ≤ 25

 Total dessert consumed ≥ 120 grams


37X1 + 65X2 ≥ 120

 Non-negativity constraints
X1, X2 ≥ 0

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Complete model

Maximize Z = 37(85)x1 +65(95)x2 Total taste index

Subject to:
120x1+160x2 ≤ 450 Calories
5x1+10x2 ≤ 25 Fat
37x1+65x2 ≥ 120 Total grams
x1,x2 ≥ 0

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.1(cont’d) - Graphical Model
 When there are only two decision variables the
problem can be solved graphically.

 To graph each constraint, consider the associate


equality (120x1+160x2=450) and find where the
associated line crosses the axes.

 Graph the constraints (see following slides)

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Graphical
x2 solution

4—

120x1 + 160x2 = 450 (Calories)


3— x1 = 0, x2 = 450/160 = 2.81
x2 = 0, x1 = 450/120 = 3.75
Slope = -120/160 = -0.75
2—

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4—
5x1 + 10x2 = 25 (Fat)
x1 = 0, x2 = 25/10 = 2.5
3—
x2 = 0, x1 = 25/5 = 5
Slope = -5/10 = -0.5
2—

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4—
37x1 + 65x2 = 120 (Grams)
x1 = 0, x2 = 120/65 = 1.85
3—
x2 = 0, x1 = 120/37 = 3.24
Slope = -37/65 = -0.57
2—

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4—

3—

Feasible region
2—

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4—
Z = 3145x1 + 6175x2 =9435
x1 = 0, x2 = 9435/3145 = 1.53
3—
x2 = 0, x1 = 9435/3145 = 3

2— Optimal Point

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4— Z = 3145x1 + 6175x2
Calories constraint: 120x1+160x2<=450
Slope = -3145/6175 = -0.509
slope= -0.75

3—
Slope for Z (-.509) is between
the slopes of these two lines.
So, intersecting point is optimal.

2—
Calories constraint: 5x1+10x2<=25
slope = -0.5

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution
Optimal solution is the intersection of:
4—
120x1+160x2= 450 Line 1
5x1+10x2= 25 Line 2
Line 2 x 24: 120x1 + 240x2 = 600
3—
Subtract Line 1 from Modified line 2:
80x2 = 150, x2 = 150/80 = 1.875
Plug in x2 = 1.875 and solve for x1
2—
5x1 + 10(1.875) = 25, or x1 = 6.25/5 = 1.25

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Graphical
x2 solution

4— Optimal solution:
x1 = 1.25, x2 = 1.875

3— Z = 3145(1.25) + 6175(1.875) = 15509.375

2—

1—

0 | | | | |
x1
1 2 3 4 5
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Ex. 3.1(cont’d) - Spreadsheet Model
 Common elements in all LP spreadsheet models are:
– Inputs – all numeric data given in the statement of the
problem (Blue border)
– Changing cells – the values in these cells can be changed
to optimize the objective (Red border)
– Target(objective) cell – contains the value of the objective
(Double line black boarder)
– Constraints – specified in the Solver dialog box
– Nonnegativity – check an option in a Solver dialog box to
indicate nonnegative changing cells

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.1(cont’d) - Spreadsheet Model
 Three stages of the complete solution:
– Model development stage – enter all inputs, trial values for
the changing cells, and formulas relating these in
spreadsheet
– Invoke Solver – designate the objective cell, changing cells,
the constraints and selected options, and tell Solver to find
the optimal solution.
– Sensitivity analysis – see how the optimal solution changes
as the selected inputs vary

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.1(cont’d) - Spreadsheet Model
 Solver dialog box for this model.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.1(cont’d) - Spreadsheet Model
 Optimal Solution for the Dessert Model

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.1(cont’d) - Spreadsheet Model
 In this solution the calorie and fat constraints have
been met exactly, thus they are binding. The
constraint on grams in nonbinding, the positive
difference in grams is called slack.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


3.4 Sensitivity Analysis
 Often it is useful to perform sensitivity analysis to
see how (or if) the optimal solution changes as one
or more inputs change.

 The Solve dialog box offers you the option to obtain


a sensitivity report.

 Solver’s sensitivity report performs two types of


sensitivity analysis:
1. on the coefficients of the objectives, the c’s, and
2. on the right hand sides of the constraints, the b’s.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 The sensitivity report has two sections corresponding
to the two types of analysis. Example 3.1’s sensitivity
report.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 The reduced cost for any decision not currently in
the optimal solution indicates how much better that
coefficient must be before that variable will enter at a
positive level.

 The term shadow price is an economic term. It


indicates the change in the optimal value of the
objective function when the right-hand side of some
constraint changes by a given amount.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 The SolverTable Add-in allows us to ask sensitivity
questions about any of the input variables.

 SolverTable’s can be used in two ways:


– One-way table – single input cell and any number of output
cells
– Two-way table – two input cells and one or more outputs

 The results are easily interpreted.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 For the dessert model, check how sensitive the
optimal dessert plan and total taste index are to
(1) changes in the number of calories
(2) the number of daily dessert calories allowed.

 The solution to question (1) can be solved by


selecting the Data/SolverTable menu item and select
a one-way table in the first dialog box. The second
dialog box should be completed as shown on the
next slide.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 The second question asks us to vary two inputs
simultaneously. This requires a two-way SolverTable.
Select the two-way option in the first SolverTable
dialog box to get the two-way table dialog box.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
3.5 Properties of Linear Models
 Linear programming is an important subset of a
larger class of models called mathematical
programming models.

 Three important properties that LP models possess


– Proportionality
• If a level of any activity is multiplied by a constant factor, the
contribution of this activity to the objective, or to any of the
constraints in which the activity is involved, is multiplied by the
same factor.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


– Additivity
• This property implies that the sum of the contributions from the
various activities to a particular constraint equals the total
contribution to that constraint.
– Divisibility
• This property means that both integer and noninteger levels of
the activities are allowed.

 How can you recognize whether a model satisfies


proportionality and additivity?

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 Not easy to recognize in a spreadsheet model
because the logic of the model can be embedded in
a series of cell formulas.

 Often it is easier to recognize when a model is not


linear. Two situations that lead to nonlinear models
are when
1. there are products or quotients of expressions involving
changing cells, and
2. there are nonlinear functions, such as squares, square
roots, or logarithms, of changing cells.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 Real-life problems are almost never exactly linear.
However, a linear approximation often yields very
useful results.

 In terms of Solver, if the model is linear the Assume


Linear Model box must be checked in the Solver
Options dialog box.

 Check the Assume Linear Model box even if the


divisibility property is violated.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 If the Solver returns a message that “the condition for
Assume Linear Model are not satisfied” it
– can indicate a logical error in your formulation.
– can also indicate that Solver erroneously thinks the linearity
conditions are not satisfied.

 Try not checking the Assume Linear model box and


see if that works. In any case it always helps to have
a well-scaled model.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


3.6 Infeasibility and Unboundedness
 It is possible that there are no feasible solutions to a
model. There are generally two possible reasons for
this:
1. There is a mistake in the model (an input entered
incorrectly) or
2. the problem has been so constrained that there are no
solutions left.

 In general, there is no foolproof way to find the


problem when a “no feasible solution” message
appears.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 A second type of problem is unboundedness.

 Unboundedness is that the model can be made as


large as possible. If this occurs it is likely that a wrong
input has been entered or forgotten some constraints.

 Infeasibility and unboundedness are quite different. It


is possible for a model to have no feasible solution
but no realistic model can have an unbounded
solution.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Example 3.2 – Product Mix Model
 The product mix problem is basically to select the
optimal mix of products to produce to maximize profit.

 The Monet company produces four types of picture


frames. The four types differ with respect to size,
shape and materials used.

 Each frame requires a certain amount of skilled labor,


metal and glass. They also all have different selling
prices.

 Monet can produce in the coming week but they do


not want any inventory at the end of the week.

 What should the company do to maximize its profit


for this week?
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Ex. 3.2(cont’d) - Algebraic Model
Maximize 6x1 + 2x2 + 4x3 + 3x4 (profit objective)

Subject to 2x1 + x2 + 3x3 + 2x4  4000 (labor constraint)

4x1 + 2x2 + x3 + 2x4  10,000 (glass constraint)

x1  1000 (frame 1 sales constraints)

x2  2000 (frame 2 sales constraints)

x3  500 (frame 3 sales constraints)

x4  1000 (frame 4 sales constraints)

x1, x2, x3, x4  0 (nonnegativity constraint)

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.2(cont’d) - Spreadsheet Model
 To develop the spreadsheet model follow these
steps:
– Inputs - Enter the various inputs in the shaded ranges. Enter
only numbers, not formulas in the input cells.
– Range names – Name the ranges as indicated.
– Changing cells - Enter any four values in the range named
Produced.
– Resources used - Enter the formula
=SUMPRODUCT (B9:E9,Produced) in cell B21
and copy it to the rest of the Used range.
– Revenues, costs, and profits – Enter the formulas to
calculate these values.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 The optimal solution for the product mix model is
shown on the next slide.

 The sensitivity analysis allows us to experiment with


different inputs to this problem. Simply change the
inputs and then rerun Solver.

 Use SolverTable to perform a more systematic


sensitivity analysis on one or more input variables.

 Additional insight can be gained from Solver’s


sensitivity report.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Example 3.3 – Another Product Mix
Model
 Pigskin company must decide how many footballs to
produce each month. It has decided to us a 6-month
planning horizon.

 Pigskin wants to determine the production schedule


that minimizes the total production and holding costs.

 By modeling this type of problem, one needs to be


very specific about the timing events.

 By modifying the timing assumptions in this type of


model, one can get alternative – and equally realistic
– models with very different solutions.
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Ex. 3.3(cont’d) - Algebraic Model
 The decision variables are the production quantities
for the 6 months (P1 through P6). I1 through I6 is the
corresponding end-of-month inventories.

 The obvious constraints are on the production and


inventory storage capacities for each month, j.

 In addition, "balance” constraints that relate to P’s


and I’s are needed. The balance equation for the
month j is Ij-1 + Pj = Dj + Ij.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.3(cont’d) - Algebraic Model
 By putting all variables (P’s and I’s) on the left and all
known values on the right (a standard LP
convention), these balance constraints become
P1 – I1 = 100-50
I1 + P2 – I2 = 150
I2 + P3 – I3 = 300
I3 + P4 – I4 = 350
I4 + P5 – I5 = 250
I5 + P6 – I6 = 100

 The goal is to minimize the sum of production and


holding costs. It is the sum of unit production costs
multiplied by P’s, plus until holding costs multiplied by
I’s.
Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc
Ex. 3.3(cont’d) - Spreadsheet Model
 The difference between this model from the product
mix model is that some of the constraints are built
into the spreadsheet itself by means of the formulas.

 The only changing cells are production quantities.

 The decision variables in an algebraic model are not


necessarily the same as the changing cells in an
equivalent spreadsheet model.

 To develop the spreadsheet model:


– Inputs - Enter the inputs in the shaded ranges.
– Name ranges – Name ranges indicated.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.3(cont’d) - Spreadsheet Model
– Production quantities - Enter any values in the range
Produced as the production quantities. As always, you can
enter values that you believe are good, maybe even optimal.
– On-hand inventory - Enter the formula =B4 + B12 in cell
B16. This calculates the first month on-hand inventory after
production. Then enter the “typical” formula =B20 + C12 for
on-hand inventory after production in month 2 in cell C16
and copy it across row 16.
– Ending inventories - Enter the formula =B16 – B18 for
ending inventory in cell B20 and copy it across row 20.
– Production and holding costs - Enter the formula calculate
the monthly holding costs. Finally, calculate the cost totals in
column H by summing with the SUM function.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.3(cont’d) - Spreadsheet Model
 The optimal solution from Solver.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


Ex. 3.3(cont’d) - Spreadsheet Model
 SolverTable can be used to perform a number of
interesting sensitivity analyses.

 In multiperiod models, the company has to make


forecasts about the future, such as the level of
demand. The length of the planning horizon is usually
the length of time for which the company can make
reasonably accurate forecasts.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


3.10 Decision Support System
 Many people who are not experts need to use
models.

 It is useful to provide these users with a decision


support system (DSS) that can help them solve
problems without having to worry about technical
details.

 The users sees a “front end” and a “back end”.


– The front end allows them to select input values.
– The back end then produces a report that explains the
optimal policy in nontechnical terms.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 A “front-end” for a problem similar to the Pigskin
model.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc


 A “back-end” for a problem similar to the Pigskin
model.

Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc

Вам также может понравиться