Lecture3 Printable

Lecture 3
Robert Zimmer
Room 6, 25 St James
Introduction to Optimization Modeling
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
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.
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
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.
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.
Example 3.1 – Two Variable Model
Maggie decided she must plan her desserts carefully.
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?
► First step is to identify appropriate decision variables,
the appropriate objective, the constraints and the
relationships between them.
Ex. 3.1(cont’d) - Algebraic Model
Identify the decision variable, write expressions fro
the total taste index and the constraints in terms of
the x’s. Then add explicit constraints to ensure that
the x’s are nonnegative.
Maximize 37(85)x1 +65(95)x2
Subject to:
x1,x2 ≥ 0
Ex. 3.1(cont’d) - Graphical Model
When there are only two decision variables the problem
can be solved graphically.
To graph this, consider the associate equality
(120x1+160x2=450) and find where the associated line
crosses the axes.
Graph the constraints on the figure as shown on the next
Ex. 3.1(cont’d) - Graphical Model
To see which feasible point maximizes the objective,
draw a sequence of lines where, for each, the
objective is a constant.
The last feasible point that it touches is the optimal
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
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
 Sensitivity analysis – see how the optimal solution changes as the
selected inputs vary
Ex. 3.1(cont’d) - Spreadsheet Model
Solver dialog box for this model.
Ex. 3.1(cont’d) - Spreadsheet Model
Optimal Solution for the Dessert Model
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.
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
The Solve dialog box offers you the option to obtain a
sensitivity report.
Solver’s sensitivity report performs two types of sensitivity
1. on the coefficients of the objectives, the c’s, and
2. on the right hand sides of the constraints, the b’s.
The sensitivity report has two sections corresponding to
the two types of analysis. Example 3.1’s sensitivity report.
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.
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.
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.
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.
3.5 Properties of Linear Models
Linear programming is an important subset of a larger
class of models called mathematical programming
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.
 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?
Not easy to recognize in a spreadsheet model because the
logic of the model can be embedded in a series of cell
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.
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
Check the Assume Linear Model box even if the divisibility
property is violated.
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 wellscaled model.
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
In general, there is no foolproof way to find the problem
when a “no feasible solution” message appears.
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.
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
Ex. 3.2(cont’d) - Algebraic Model
Subject to
6x1 + 2x2 + 4x3 + 3x4
2x1 + x2 + 3x3 + 2x4 
4x1 + 2x2 + x3 + 2x4 
x1 
x2 
x3 
x4 
(profit objective)
4000 (labor constraint)
10,000 (glass constraint)
1000 (frame 1 sales constraints)
2000 (frame 2 sales constraints)
500 (frame 3 sales constraints)
1000 (frame 4 sales constraints)
x1, x2, x3, x4  0 (nonnegativity constraint)
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
 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.
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.
Example 3.3 – Another Product Mix
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.
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.
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
+ P2 – I2 = 150
+ P3 – I3 = 300
+ P4 – I4 = 350
+ P5 – I5 = 250
+ 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.
Ex. 3.3(cont’d) - Spreadsheet
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.
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.
Ex. 3.3(cont’d) - Spreadsheet Model
The optimal solution from Solver.
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
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.
A “front-end” for a problem similar to the Pigskin
A “back-end” for a problem similar to the Pigskin model.