Solver

advertisement
456/556 Introduction to
Operations Research
Optimization with the Excel
2007 Solver
Excel’s Solver Add-In







One of the tools in Excel that can
be used for optimization
problems is the Solver.
Click the Microsoft Office
Button, and then click Excel
Options.
Click the Add-Ins category.
In the Manage box, click Excel
Add-ins, and then click Go.
Check the Solver Add-in box
and choose OK.
You may need to use you
Microsoft Office installation disk
for this step.
Once loaded, the Solver can be
accessed from the Data tab’s
Analysis group.
2
The Solver Parameters Dialog
Box




Set Target Cell - Specifies the target
cell that you want to set to a certain
value or that you want to maximize or
minimize.

This cell must contain a formula.
Equal to - Specifies whether you
want the target cell to be maximized,
minimized, or set to a specific value.

If you want a specific value, type
it in the box.
By Changing Cells - Specifies the
cells that can be adjusted until the
constraints in the problem are satisfied
and the cell in the Set Target Cell
box reaches its target.

The adjustable cells must be
related directly or indirectly to the
target cell.
Guess - Guesses all nonformula cells
referred to by the formula in the Set
Target Cell box, and places their
references in the By Changing Cells
box.
3
The Solver Parameters Dialog
Box (cont.)





Subject to the Constraints - Lists the
current restrictions on the problem.

Add - Displays the Add Constraint
dialog box.

Change - Displays the Change
Constraint dialog box.

Delete - Removes the selected
constraint.
Solve - Starts the solution process for
the defined problem.
Close - Closes the dialog box without
solving the problem.

Retains any changes you made by
using the Options, Add, Change,
or Delete buttons.
Options - Displays the Solver Options
dialog box, where you can load and save
problem models and control advanced
features of the solution process.
Reset All - Clears the current problem
settings, and resets all settings to their
original values.
4
The Solver Options Dialog Box


You can control
advanced features of
the solution process,
load or save problem
definitions, and define
parameters for both
linear and nonlinear
problems.
Each option has a
default setting that is
appropriate for most
problems.
5
The Solver Options Dialog Box

Max time - Limits the time taken by the
solution process.


Iterations - Limits the time taken by the
solution process by limiting the number
of interim calculations.


While you can enter a value as high as
32,767, the default value of 100 seconds
is adequate for most small problems.
While you can enter a value as high as
32,767, the default value of 100 is
adequate for most small problems.
Precision - Controls the precision of
solutions by using the number you enter
to determine whether the value of a
constraint cell meets a target or satisfies
a lower or upper bound.


Precision must be indicated by a fractional
number between 0 (zero) and 1.
Higher precision is indicated when the
number you enter has more decimal
places — for example, 0.0001 is higher
precision than 0.01.
6
The Solver Options Dialog Box
(cont.)

Tolerance - The percentage by which
the target cell of a solution satisfying
the integer constraints can differ from
the true optimal value and still be
considered acceptable.



This option applies only to problems with
integer constraints.
A higher tolerance tends to speed up the
solution process.
Convergence - When the relative
change in the target cell value is less
than the number in the Convergence
box for the last five iterations, Solver
stops.



Convergence applies only to nonlinear
problems and must be indicated by a
fractional number between 0 (zero) and 1.
A smaller convergence is indicated when the
number you enter has more decimal places —
for example, 0.0001 is less relative change
than 0.01.
The smaller the convergence value, the more
time Solver takes to reach a solution.
7
The Solver Options Dialog Box
(cont.)




Assume Linear Model - Select to
speed the solution process when all
relationships in the model are linear
and you want to solve a linear
optimization problem.
Assume Non-Negative - Causes
Solver to assume a lower limit of 0
(zero) for all adjustable cells for which
you have not set a lower limit in the
Constraint box in the Add
Constraint dialog box.
Use Automatic Scaling - Select to
use automatic scaling when inputs and
outputs have large differences in
magnitude — for example, when
maximizing the percentage of profit
based on million-dollar investments.
Show Iteration Results - Select to
have Solver pause to show the results
of each iteration.
8
The Solver Options Dialog Box
(cont.)

Estimates - Specifies the approach
used to obtain initial estimates of the
basic variables in each onedimensional search.



Tangent - Uses linear extrapolation
from a tangent vector.
Quadratic - Uses quadratic
extrapolation, which can improve the
results on highly nonlinear problems.
Derivatives - Specifies the
differencing used to estimate partial
derivatives of the objective and
constraint functions.


Forward - Use for most problems, in
which the constraint values change
relatively slowly.
Central - Use for problems in which
the constraints change rapidly,
especially near the limits. Although this
option requires more calculations, it
might help when Solver returns a
message that it could not improve the
solution.
9
The Solver Options Dialog Box
(cont.)

Search - Specifies the algorithm used
at each iteration to determine the
direction to search.




Newton - Uses a quasi-Newton
method that typically requires more
memory but fewer iterations than the
Conjugate gradient method.
Conjugate - Requires less memory
than the Newton method but typically
needs more iterations to reach a
particular level of accuracy. Use this
option when you have a large problem
and memory usage is a concern, or
when stepping through iterations
reveals slow progress.
Load Model - Displays the Load
Model dialog box, where you can
specify the reference for the model
you want to load.
Save Model - Displays the Save
Model dialog box, where you can
specify where to save the model. Click
only when you want to save more
than one model with a worksheet —
the first model is automatically saved.
10
Example 1 (File Cabinets)

An office manager needs to purchase new filing
cabinets. She knows that Ace cabinets cost $40
each, require 6 square feet of floor space, and hold
24 cubic feet of files. On the other hand, each
Excello cabinet costs $80, requires 8 square feet of
file space, and holds 36 cubic feet. Her budget
permits her to spend no more than $560 on files,
while the office has space for no more than 72
square feet of cabinets. The manager desires the
greatest storage capacity within the limitations
imposed by funds and space. How many of each
cabinet should she buy?
11
Example 1 (cont.)




As we saw in Lecture 2, we can formulate this
situation as a linear programming problem.
Let x1= the number of Ace cabinets to be
bought.
Let x2 = the number of Excello cabinets to be
bought.
Let Z = the total storage capacity of cabinets
purchased.
12
Example 1 (cont.)


Our model for deciding how to allocate file
cabinets is as follows:
Maximize: Z = 24 x1 + 36 x2
Subject to the restrictions:
40 x1 + 80 x2 ≤ 560 (cost)
6 x1 + 8 x2 ≤ 72 (space)
and
x1 ≥ 0; x2 ≥ 0.
13
Example 1 (cont.)


From the Defined
Names group of the
Formulas tab, use
Define Name or the
Name Manager to
assign names to cells
we will use in formulas.
This can also be done
by right-clicking on a
range of cells and
choosing Name a
Range.
14
Example 1 (cont.)
15
Example 3 (cont.)
16
Example 3 (cont.)
17
References


Finite Mathematics and Calculus with
Applications (4th ed) by Margaret Lial,
Charles Miller, and Raymond Greenwell
Introduction to Operations Research
(8th ed) by Frederick Hillier and Gerald
Leiberman
18
Download