Risk Solver Platform User Guide
Risk Solver Platform User Guide
Trademarks
Risk Solver Platform, Risk Solver Premium, Premium Solver Platform, Premium Solver, Risk Solver, Risk
Solver Engine, and Solver Platform SDK are trademarks of Frontline Systems, Inc. Windows and Excel are
trademarks of Microsoft Corp. Gurobi is a trademark of Gurobi Optimization, Inc. KNITRO is a trademark of
Ziena Optimization, Inc. MOSEK is a trademark of MOSEK ApS. OptQuest is a trademark of OptTek
Systems, Inc. XpressMP is a trademark of FICO, Inc.
Acknowledgements
Thanks to Dan Fylstra and the Frontline Systems development team for a 20-year cumulative effort to build the
best possible optimization and simulation software for Microsoft Excel. Thanks to Frontline’s customers who
have built many thousands of successful applications, and have given us many suggestions for improvements.
Risk Solver Platform has benefited from reviews, critiques, and suggestions from several risk analysis experts:
• Sam Savage (Stanford Univ. and AnalyCorp Inc.) for Probability Management concepts including SIPs,
SLURPs, DISTs, and Certified Distributions.
• Sam Sugiyama (EC Risk USA & Europe LLC) for evaluation of advanced distributions, correlations, and
alternate parameters for continuous distributions.
• Savvakis C. Savvides for global bounds, censor bounds, base case values, the Normal Skewed distribution
and new risk measures.
How to Order
Contact Frontline Systems, Inc., P.O. Box 4288, Incline Village, NV 89450.
Tel (775) 831-0300 Fax (775) 831-0314 Email [email protected] Web http://www.solver.com
Contents
Start Here: V10.0 Essentials vii
Getting the Most from This User Guide .................................................................................. vii
Installing the Software............................................................................................... vii
Upgrading from Earlier Versions .............................................................................. vii
Obtaining a License ................................................................................................... vii
Getting Help Quickly ................................................................................................ vii
Using the Solver Parameters Dialog .......................................................................... vii
Finding the Examples ............................................................................................... viii
Using Existing Models ............................................................................................. viii
Using Existing VBA Macros .................................................................................... viii
Using Large-Scale Solver Engines ........................................................................... viii
Getting Started with Tutorials .................................................................................. viii
Getting and Interpreting Results ............................................................................... viii
Automating Your Model with VBA ......................................................................... viii
Mastering Optimization and Simulation Concepts ................................................... viii
Software License and Limited Warranty .................................................................................. ix
Obtaining a License
Use Help – License Code on the Ribbon. V10.0 has a new license manager, which
makes obtaining a license much easier (you can activate a license over the Internet).
But V9.5 and earlier license codes in your Solver.lic license file will be ignored in
V10.0. See the chapter “Using Help, Licensing and Product Subsets” for details.
Grant of License: Subject to all the terms and conditions of this License, Frontline grants to Licensee a non-
exclusive, non-transferable except as provided below, right and license to Use the Software (as the term "Use"
is defined below) for the term as provided below, with the following restrictions:
Evaluation License: If and when offered by Frontline, on a one-time basis only, for a Limited Term
determined by Frontline in its sole discretion, Licensee may Use the Software on one computer (the "PC"), and
Frontline will provide Licensee with a license code enabling such Use. The Software must be stored only on
the PC. An Evaluation License may not be transferred to a different PC.
Standalone License: Upon Frontline’s receipt of payment from Licensee of the applicable Fee for a single-Use
license ("Standalone License"), Licensee may Use the Software for a Permanent Term on one computer (the
"PC"), and Frontline will provide Licensee with a license code enabling such Use. The Software may be stored
on one or more computers, servers or storage devices, but it may be Used only on the PC. If the PC fails in a
manner such that Use is no longer possible, Frontline will provide Licensee with a new license code, enabling
Use on a repaired or replaced PC, at no charge. A Standalone License may be transferred to a different PC
while the first PC remains in operation only if (i) Licensee requests a new license code from Frontline, (ii)
Licensee certifies in writing that the Software will no longer be Used on the first PC, and (iii) Licensee pays a
license transfer fee, unless such fee is waived in writing by Frontline in its sole discretion.
Flexible Use License: Upon Frontline’s receipt of payment from Licensee of the applicable Fee for a multi-
Use license ("Flexible Use License"), Licensee may Use the Software for a Permanent Term on a group of
several computers as provided in this section, and Frontline will provide Licensee with a license code enabling
such Use. The Software may be stored on one or more computers, servers or storage devices interconnected by
any networking technology that supports the TCP/IP protocol (a "Network"), copied into the memory of, and
Used on, any of the computers on the Network, provided that only one Use occurs at any given time, for each
Flexible Use License purchased by Licensee. Frontline will provide to Licensee (under separate license) and
Licensee must install and run License Server software ("LSS") on one of the computers on the Network (the
"LS"); other computers will temporarily obtain the right to Use the Software from the LS. If the LS fails in a
manner such that the LSS cannot be run, Frontline will provide Licensee with a new license code, enabling Use
on a repaired or replaced LS, at no charge. A Flexible Use License may be transferred to a different LS while
the first LS remains in operation only if (i) Licensee requests a new license code from Frontline, (ii) Licensee
certifies in writing that the LSS will no longer be run on the first LS, and (iii) Licensee pays a license transfer
fee, unless such fee is waived by Frontline in its sole discretion.
"Use" of the Software means the use of any of its functions to define, analyze, solve (optimize, simulate, etc.)
and/or obtain results for a single user-defined model. Use with more than one model at the same time, whether
on one computer or multiple computers, requires more than one Standalone or Flexible Use License. Use
occurs only during the time that the computer’s processor is executing the Software; it does not include time
when the Software is loaded into memory without being executed. The minimum time period for Use on any
one computer shall be ten (10) minutes, but may be longer depending on the Software function used and the size
and complexity of the model.
Other License Restrictions: The Software includes license control features that may write encoded
information about the license type and term to the PC or LS hard disk; Licensee agrees that it will not attempt to
alter or circumvent such license control features. This License does not grant to Licensee the right to make
copies of the Software or otherwise enable use of the Software in any manner other than as described above, by
any persons or on any computers except as described above, or by any entity other than Licensee. Licensee
acknowledges that the Software and its structure, organization, and source code constitute valuable Intellectual
Property of Frontline and/or its suppliers and Licensee agrees that it shall not, nor shall it permit, assist or
encourage any third party to: (a) copy, modify adapt, alter, translate or create derivative works from the
Software; (b) merge the Software into any other software or use the Software to develop any application or
program having the same primary function as the Software; (c) sublicense, distribute, sell, use for service
bureau use, lease, rent, loan, or otherwise transfer the Software; (d) "share" use of the Software with anyone
else; (e) make the Software available over the Internet, a company or institutional intranet, or any similar
networking technology, except as explicitly provided in the case of a Flexible Use License; (f) reverse compile,
reverse engineer, decompile, disassemble, or otherwise attempt to derive the source code for the Software; or
(g) otherwise exercise any rights in or to the Software, except as permitted in this Section.
U.S. Government: The Software is provided with RESTRICTED RIGHTS. Use, duplication, or disclosure
by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the
Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable.
Contractor/manufacturer is Frontline Systems, Inc., P.O. Box 4288, Incline Village, NV 89450.
2. ANNUAL SUPPORT.
Limited warranty: If Licensee purchases an "Annual Support Contract" from Frontline, then Frontline
warrants, during the term of such Annual Support Contract ("Support Term"), that the Software covered by the
Annual Support Contract will perform substantially as described in the User Guide published by Frontline in
connection with the Software, as such may be amended from time to time, when it is properly used as described
in the User Guide, provided, however, that Frontline does not warrant that the Software will be error-free in all
circumstances. During the Support Term, Frontline shall make reasonable commercial efforts to correct, or
devise workarounds for, any Software errors (failures to perform as so described) reported by Licensee, and to
timely provide such corrections or workarounds to Licensee.
3. WARRANTY DISCLAIMER.
EXCEPT AS PROVIDED IN SECTION 2 ABOVE, THE SOFTWARE IS PROVIDED "AS IS" AND
"WHERE IS" WITHOUT WARRANTY OF ANY KIND; FRONTLINE AND, WITHOUT EXCEPTION, ITS
SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE
SOFTWARE OR ANY WARRANTIES ARISING FROM COURSE OF DEALING OR COURSE OF
PERFORMANCE AND THE SAME ARE HEREBY EXPRESSLY DISCLAIMED TO THE MAXIMUM
EXTENT PERMITTED BY APPLICABLE LAW. WITHOUT LIMITING THE FOREGOING, FRONTLINE
DOES NOT REPRESENT, WARRANTY OR GUARANTEE THAT THE SOFTWARE WILL BE ERROR-
FREE, UNINTERRUPTED, SECURE, OR MEET LICENSEES’ EXPECTATIONS. FRONTLINE DOES
NOT MAKE ANY WARRANTY REGARDING THE SOFTWARE'S RESULTS OF USE OR THAT
FRONTLINE WILL CORRECT ALL ERRORS. THE LIMITED WARRANTY SET FORTH IN SECTION 2
IS EXCLUSIVE AND FRONTLINE MAKES NO OTHER EXPRESS OR IMPLIED WARRANTIES OR
CONDITIONS WITH RESPECT TO THE SOFTWARE, ANNUAL SUPPORT AND/OR OTHER SERVICES
PROVIDED IN CONNECTION WITH THIS LICENSE, INCLUDING, WITHOUT LIMITATION, ANY
IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, TITLE AND NONINFRINGEMENT.
4. LIMITATION OF LIABILITY.
IN NO EVENT SHALL FRONTLINE OR ITS SUPPLIERS HAVE ANY LIABILITY FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
WITHOUT LIMITATION ANY LOST DATA, LOST PROFITS OR COSTS OF PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES), HOWEVER CAUSED AND UNDER ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE OR THE EXERCISE
OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF
LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, THE ABOVE LIMITATION MAY
NOT APPLY. NOTWITHSTANDING ANYTHING HEREIN TO THE CONTRARY, IN NO EVENT
SHALL FRONTLINE’S TOTAL CUMULATIVE LIABILITY IN CONNECTION WITH THIS LICENSE,
THE SOFTWARE, AND ANY SUPPORT CONTRACTS PROVIDED BY FRONTLINE TO LICENSEE
HEREUNDER, WHETHER IN CONTRACT OR TORT OR OTHERWISE EXCEED THE PRICE OF ONE
STANDALONE LICENSE. LICENSEE ACKNOWLEDGES THAT THIS ARRANGEMENT REFLECTS
THE ALLOCATION OF RISK SET FORTH IN THIS LICENSE AND THAT FRONTLINE WOULD NOT
ENTER INTO THIS LICENSE WITHOUT THESE LIMITATIONS ON ITS LIABILITY. LICENSEE
ACKNOWLEDGES THAT THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY
FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.
Term: The License shall become effective when Licensee first downloads, accepts delivery, installs or uses the
Software, and shall continue: (i) in the case of an Evaluation License, for a limited term (such as 15 days)
determined from time to time by Frontline in its sole discretion ("Limited Term"), (ii) in the case of Standalone
License or Flexible Use License, for an unlimited term unless terminated for breach pursuant to this Section
("Permanent Term").
Termination: Frontline may terminate this License if Licensee breaches any material provision of this License
and does not cure such breach (provided that such breach is capable of cure) within 30 days after Frontline
provides Licensee with written notice thereof.
6. GENERAL PROVISIONS.
Proprietary Rights: The Software is licensed, not sold. The Software and all existing and future worldwide
copyrights, trademarks, service marks, trade secrets, patents, patent applications, moral rights, contract rights,
and other proprietary and intellectual property rights therein ("Intellectual Property"), are the exclusive property
of Frontline and/or its licensors. All rights in and to the Software and Frontline’s other Intellectual Property not
expressly granted to Licensee in this License are reserved by Frontline. For the Large-Scale LP/QP Solver
only: Source code is available, as part of an open source project, for portions of the Software; please contact
Frontline for information if you want to obtain this source code.
Amendments: This License constitutes the complete and exclusive agreement between the parties relating to
the subject matter hereof. It supersedes all other proposals, understandings and all other agreements, oral and
written, between the parties relating to this subject matter, including any purchase order of Licensee, any of its
preprinted terms, or any terms and conditions attached to such purchase order.
Compliance with Laws: Licensee will not export or re-export the Software without all required United States
and foreign government licenses.
Assignment: This License may be assigned to any entity that succeeds by operation of law to Licensee or that
purchases all or substantially all of Licensee’s assets (the "Successor"), provided that Frontline is notified of the
transfer, and that Successor agrees to all terms and conditions of this License.
Governing Law: Any controversy, claim or dispute arising out of or relating to this License, shall be governed
by the laws of the State of Nevada, other than such laws, rules, regulations and case law that would result in the
application of the laws of a jurisdiction other than the State of Nevada.
Risk Solver Platform Overview
Risk Solver Platform and its subsets Premium Solver Platform and Premium
Solver are fully compatible upgrades for the Solver bundled with Microsoft
Excel, which was developed by Frontline Systems for Microsoft. Your Excel
Solver models and macros will work without changes, and the classical Solver
Parameters dialog can be used whenever needed in Risk Solver Platform.
Premium Solver
Premium Solver is Frontline’s basic upgrade for the standard Excel Solver, for
conventional optimization. It includes a Simplex LP Solver, GRG Nonlinear
Solver, Evolutionary Solver, Branch & Bound method for integer and
alldifferent constraints, and the Multistart method for global optimization.
Risk Solver
Risk Solver is Frontline’s full-function product for Monte Carlo simulation. It
includes all of the simulation functionality of Risk Solver Platform and Risk
Solver Premium, but no optimization functionality.
The LP/Quadratic Solver handles both linear programming (LP) and quadratic
programming (QP) problems with up to 8,000 variables (2,000 integer variables)
– four times the size of Premium Solver, and 40 times the size of Excel Solver.
Advanced methods for LP/MIP problems yield solutions as much as hundreds of
times faster than the Excel Solver, and 5 to 20 times faster than Premium Solver.
The Interval Global Solver uses state-of-the-art interval methods to find the
globally optimal solution to a nonlinear optimization problem, all real solutions
to a system of nonlinear equations, or an “inner solution” to a system of
nonlinear inequalities. It handles smooth nonlinear (NLP) problems of up to
500 decision variables and 250 constraints, plus bounds on the variables.
The SOCP Barrier Solver uses an interior point method to solve linear (LP),
quadratic (QP), quadratically constrained (QCP), and second order cone
programming (SOCP) problems – the natural generalization of linear and
New as of Risk Solver Platform V9.5 is a facility to create decision trees on your
Excel spreadsheet. Using the Ribbon, you can easily create decision nodes and
branches, event nodes and branches, and terminal nodes. The tree is drawn in
graphic form on the spreadsheet; standard Excel worksheet formulas compute
‘rollback’ values at each node, and the best-choice value at the root node, based
on either expected value or utility function (certainty equivalent) criteria. With
a Ribbon choice, you can graphically highlight the optimal path through the tree.
Risk Solver Platform offers many options that allow you to control the modeling
system and PSI Interpreter, in addition to options for controlling Solver Engines
for optimization and simulation. In earlier versions of Frontline’s software,
these options had to be set manually, which required that users learn about the
Platform’s abilities to algebraically analyze and transform Excel models.
Starting in V9.0, most of these Platform options have an Automatic choice,
which is the default choice for these options in newly created models. The
options (found on the Task Pane Platform tab) include:
Optimization Model Interpreter Simulation Model Interpreter
Solve Uncertain Models Supply Engine With
Nonsmooth Model Transformation Automatically Select Engine
(on the Task Pane Engine tab)
Stochastic Transformation
Guided Mode is a new facility introduced in V9.5, which enables you to ‘learn
as you go’ about the characteristics of Excel optimization models (for example,
linear, nonlinear or non-smooth, deterministic vs. stochastic) and the impact of
these Platform options on the analysis and solution of your model. Whenever
you optimize a model, Guided Mode displays a series of dialogs explaining what
Risk Solver Platform is doing and its diagnosis and transformation of your
model. Guided Mode is ‘on’ by default when you first install the software, but
every dialog it displays includes a check box to turn off Guided Mode.
Each Automatic choice means that the Platform can analyze your model and
automatically choose the best setting for these options. This normally results in
better solutions and faster times; however, the process of analyzing your model
and trying certain alternatives can take extra time, especially for large models.
To improve solution time when you re-run your model, you can inspect the
solution log in the Task Pane Output tab to see what choices were made
Risk Solver Platform, Premium Solver Platform and Solver Platform SDK all
support multiple, field-installable Solver engines, in addition to their “bundled”
Solver engines. Such Solver engines are licensed as separate products; they
provide additional power and capacity to solve problems much larger and/or
more difficult than the problems handled by the bundled Solver engines. Unlike
most other optimization software, a license for a Solver Engine enables you to
use that Solver in Excel, Matlab, Java, C/C++, C#, Visual Basic, VB.NET, and
other languages. New in V10.0 are 64-bit versions of these Solver Engines.
Field-installable Solver engines are seamlessly integrated into Risk Solver
Platform – to use one, you simply select the Solver engine by name in the
dropdown list that appears in the Task Pane Engine tab. They produce reports
as Excel worksheets, like the bundled Solver engines; their options can be set in
the Task Pane, or in Solver Options dialogs; and they can be controlled by VBA
code in your custom applications. The Solver engines are also seamlessly
integrated into the Solver Platform SDK. Trial licenses for these Solver engines
are available, allowing you to evaluate how well they perform on a challenging
Solver model that you’ve developed.
The large-scale Solver Engines are more valuable than ever in Risk Solver
Platform, which can transform linear programming models with uncertainty into
larger, conventional linear programming or second order cone programming
models, using stochastic programming and robust optimization methods.
Risk Solver Platform V10.0 supports both 32-bit and 64-bit Excel 2010, as well
as Excel 2007 and Excel 2003. With 64-bit Excel 2010, V10.0 can handle
much larger workbook models, perform large numbers of multiple optimizations
and simulations, and handle more Monte Carlo trials than ever before.
LP/Quadratic Solver
The LP/Quadratic Solver includes a wide range of improvements in presolve,
preprocessing, cut generation and heuristics for LP/MIP problems. These
methods are now automatically selected under overall user control.
Now you can set just three LP/Quadratic Solver options – Preprocessing, Cuts,
and Heuristics – to gain the benefit of these methods. For each of these options,
you can select None, Automatic, or Aggressive. Each choice activates specific
combinations of methods that Frontline has found effective on many models.
As usual with LP/MIP problems, performance is very model-dependent – but
overall, you can expect a significant speed improvement on your LP/MIP
problems. We expect many user models will solve twice as fast as in V9.0.
Evolutionary Solver
The Evolutionary Solver has been redesigned to deeply exploit the search
possibilities afforded by multiple processor cores. In addition to improvements
in its algorithms, ‘balance of effort’ heuristics, and stopping rules, the
Click Next to proceed. You will then be prompted for a password for this
installation, which Frontline Systems will provide (normally by email). Enter it
into the dialog box, and click Next.
The Setup program then displays a dialog box like the one shown below, where
you can select or confirm the folder to which files will be copied (normally
C:\Program Files\Frontline Systems\Risk Solver Platform, or if you’re installing
Risk Solver Platform for 32-bit Excel on 64-bit Windows, C:\Program Files
(x86)\Frontline Systems\Risk Solver Platform). Click Next to proceed.
Next, the Setup program looks for a license file Solver.lic that may already exist
on your system – normally the environment variable FRONTLIC contains the
If you enter an activation code (you must have Internet access for this to
succeed), the Setup program will display a dialog reporting whether your license
was successfully activated. But you don’t have to do this – just click Next.
If you have an existing license, or you’ve just activated a license for full Risk
Solver Platform, the Setup program will give you the option to run the software
as a subset product – Risk Solver Premium, Premium Solver Platform, Premium
Solver, or Risk Solver – instead of full RSP. The main reason to do this is to
confirm that the functionality you need is available in the subset product.
After you click Install, the Risk Solver Platform files will be installed, and the
program file RSPAddin.xll will be registered as a COM add-in (which may take
some time). A progress dialog appears, as shown below; be patient, since this
process takes longer than it has in previous Risk Solver Platform releases.
When the installation is complete, you’ll see a dialog box like the one below.
Click Finish to exit the installation wizard.
If you uncheck the box next to “Risk Solver Platform Addin” and click OK, you
will deactivate the Risk Solver Platform COM add-in, which will remove the
Risk Solver Platform tab from the Ribbon, and also remove the PSI functions for
optimization from the Excel 2007 Function Wizard.
Excel 2003
In earlier versions of Excel, COM add-ins and other add-ins are managed in
separate dialogs, and the COM Add-In dialog is available only if you display a
toolbar which is hidden by default. To display this toolbar:
1. On the View menu, point to Toolbars, and then click Customize.
2. Click the Commands tab.
3. Under Categories, click Tools.
4. Under Commands, click COM Add-Ins and drag your selection to the
toolbar.
Introduction
This chapter describes the ways Risk Solver Platform V10.0 differs from its
predecessors in terms of overall operation, including registration, licensing, use
of product subsets, and use of the Welcome Screen, online Help and examples.
You have two options to obtain and activate a license, using this dialog:
1. If you contact Frontline Systems at (775) 831-0300 or [email protected],
and give us the Lock Code shown in the middle of the dialog (click the
Email Lock Code button to do this quickly), we can generate a license
code for your PC, and email this to you. You can then select and copy
(Ctrl+C) the license code, and paste it (Ctrl+V) into the lower edit box in
this dialog.
2. Even easier, and available 24x7 if you have Internet access on this PC: If
you have a license Activation Code from Frontline Systems, you can copy
and paste it into the upper edit box in this dialog. When you click OK,
Risk Solver Platform contacts Frontline’s license server over the Internet,
sends the Lock Code and receives your license code automatically. You’ll
see a message confirming the license activation, or reporting any errors.
If you have questions, please contact Frontline Systems at (775) 831-0300 or
[email protected].
In this dialog, you can select the subset product you want, and click OK. The
change to a new product takes effect when you next restart Microsoft Excel:
You’ll see the subset product name instead of Risk Solver Platform as a tab on
the Ribbon, and a subset of the Ribbon options. To facilitate this, when you
click OK Risk Solver Platform will ask whether you want to restart Excel now:
Premium Solver
Premium Solver is Frontline’s basic upgrade for the standard Excel Solver, for
conventional optimization. It includes a Simplex LP Solver, GRG Nonlinear
Solver, Evolutionary Solver, Branch & Bound method for integer and
alldifferent constraints, and the Multistart method for global optimization.
Risk Solver
Risk Solver is Frontline’s full-function product for Monte Carlo simulation. It
includes all of the simulation functionality of Risk Solver Platform and Risk
Solver Premium, but no optimization functionality.
To access Help on any Platform option, Engine option, or Model element, click
the underlined link in the brief explanation that appears at the bottom of the
Task Pane. For example, here’s the Help that appears when you click the Type
field link for a chance constraint in your model:
Introduction
Risk Solver Platform will display its Add Constraint dialog, where you can enter
the right hand side(s) as a constant number, a cell range, or a defined name.
Click in the Constraint edit box, or click the range selector icon to its right,
and use your mouse to select the cell range C1:C5 for the right hand sides:
Then click OK. This will define five constraints: B1 <= C1, B2 <= C2, B3 <=
C3, B4 <= C4, and B5 <= C5.
You can solve the model immediately by clicking the Optimize button on the
Ribbon, or by clicking the green arrow at the top right of the Task Pane.
The optimal values of the decision variables at A1:A3, the objective at A4, and
the constraints at B1:B5 appear on the worksheet, and a Solver Result message
(“Solver found a solution. All constraints and optimality conditions are
satisfied”) appears in green at the bottom of the Task Pane.
Either action will display the Solver Parameters dialog: Click here
Refresh model
Use the buttons at the top of the Output tab to pause or stop the Solver, restore
the original values of the decision variables, copy the solution message log to
the Windows Clipboard (so you can paste the text into another application),
erase the solution log, or analyze or solve the model.
Analyze Model
Pause Solver
To maximize profit, we should make 200 TV sets, 200 stereos, and 0 speakers.
The Solver Results message “Solver found a solution. All constraints and
optimality conditions are satisfied” appears in green at the bottom of the Task
Pane. Don’t ignore this message, because it provides critical information about
what happened during the solution process, and what you can and cannot
assume about the solution on the worksheet!
To learn more about the solution process, click the Output tab at the top of the
Task Pane. The solution log in the upper part of this pane reports what
happened during the solution process. If you are puzzled by the Solver Result
message, simply click the underlined message in the log to open online Help to
a full explanation of that message.
The Answer and Sensitivity Reports appear as new worksheets, inserted into the
workbook just to the left of the EXAMPLE worksheet, as shown on the next
page. The Sensitivity Report, which provides dual values (shadow prices and
reduced costs) and associated ranges, is described in Risk Solver Platform
Reference Guide.
Notice that the report highlights the constraint on Chassis parts used, and the
non-negativity constraints on products that are built from Chassis parts. To
satisfy the constraint C11 <= B11 where B11 is -1, we’d have to build a negative
number of stereos (or TV sets). In a large model with thousands of constraints
with no feasible solution, this report can focus your attention on the “trouble
spots” – the constraints that make the problem infeasible. The set of constraints
shown is called an IIS or Irreducibly Infeasible Subset of all the constraints. For
more information, please see the Risk Solver Platform Reference Guide.
The Linearity Report, which is available in all of the Risk Solver Platform
subsets except Risk Solver, is very useful, but it does have two drawbacks: (i) It
highlights only a constraint that behaves nonlinearly – but if this constraint is
calculated through a chain of formulas, it may not highlight the exact cell
formula where the nonlinearity first occurs. (ii) It is based on a numerical test
for linear or nonlinear behavior – a test that can be ‘fooled’ by a poorly scaled
model. (A ‘poorly scaled model’ is one that computes values of the objective,
constraints, or intermediate results that differ by many orders of magnitude,
which can lead to inaccuracy in computer arithmetic.)
If you have Risk Solver Platform or Premium Solver Platform, you can use the
Polymorphic Spreadsheet Interpreter to perform a symbolic test for linearity that
cannot be ‘fooled’ by scaling problems. Click the tab to display the
EXAMPLE3 worksheet. On the Task Pane Platform tab, in the Diagnosis group
of options, and ensure that the Intended Model Type is set to Linear:
We can see immediately that this model will find values for the stock allocations
that minimize portfolio variance, subject to constraints that (i) all funds are used
(the sum of the stock allocations is 100% or 1.0) and (ii) the portfolio return is at
least 9.5%.
Cell I17 computes the portfolio variance using a special function
QUADPRODUCT, which is defined by Risk Solver Platform. This function can
be used to compute any ‘quadratic form’ such as xTQx + cx. In EXAMPLE4, the
elements of the matrix Q are the covariances of returns of pairs of stocks, and
the elements of the vector c (at B11:F11) are all zero. You could instead
compute portfolio variance using a series of Excel formulas using multiplication
and addition, but it’s more convenient to use QUADPRODUCT.
Solving with the GRG Nonlinear Solver yields the same values (to two decimal
places) for the decision variables. If you have Risk Solver Platform or
Premium Solver Platform, you can also use the Standard SOCP Barrier Solver –
just select it from the dropdown list at the top of the Task Pane Engine tab and
click the Optimize button again. This yields nearly the same values for the
decision variables, Portfolio Return at I19, and Portfolio Variance at I17.
We can also “turn this problem around” and seek to maximize Portfolio Return,
subject to a constraint that Portfolio Variance is (say) no more than 1%. To do
this, we can edit the optimization model directly in the Task Pane:
1. Select “Portfolio_Variance (Min)” under Objective in the outline.
2. In the Objective Properties area below the outline, click the Address
property and type or select cell I19 (or type “Portfolio_Return”).
Change the Sense dropdown choice from Minimize to Maximize.
The Task Pane Model tab should now appear as shown on the next page. This
problem now has a linear objective and a quadratic constraint; it is called a
quadratically constrained or QCP problem. It can no longer be solved by the
methods used in the LP/Quadratic Solver (a quadratic extension of the Simplex
method), but it can be solved by the GRG Nonlinear Solver, or (more
efficiently) by the SOCP Barrier Solver.
If we now click the Optimize button with the LP/Quadratic Solver selected, the
message “The linearity conditions required by this Solver engine are not
satisfied” appears in red at the bottom of the Task Pane.
If we click the Analyze button in the Task Pane, or select the dropdown choice
Analyze Without Solving below the Optimize button on the Ribbon, Risk
Solver Platform reports that the model is nonlinear (NLP), as shown on the next
page. (Advanced technical point: Since Risk Solver Platform can compute
directional derivatives for IF functions, they are treated as nonlinear rather than
non-smooth, unless the Platform tab Advanced group option Require Smooth
Functions is set to True.)
If we again Analyze the model with this option setting, we find that the
transformed model has 27 variables (18 of them integer) and 67 constraints, as
shown on the next page. But it’s now a linear programming (LP) model – so it
can be solved by the LP/Quadratic Solver. By solving this transformed model,
we can find a solution to the original model on the EXAMPLE4 worksheet.
In EXAMPLE6, our decision variables are the (X, Y) coordinates of the airline
hub, at cells D12:E12, and a third decision variable at F19. Cell F19 also serves
as the objective function, to be minimized. We calculate the distance from the
hub to each of the six cities in cells F13:F18. We define a block of constraints
Click the EXAMPLE7 tab to display the model, and click the Analyze button.
We see that this formulation of the model is diagnosed as second order cone
Introduction
This chapter introduces simulation and risk analysis in Risk Solver Platform,
with a series of examples. Each of these examples can also be used in Risk
Solver Premium, and all but the last one can be used in Risk Solver.
“A First Simulation Example” takes you step-by-step through the process of
building and analyzing a risk analysis model using Monte Carlo simulation.
“Airline Revenue Management Example” takes you through three versions
of an airline yield management problem, to illustrate a single simulation,
multiple parameterized simulations, and simulation optimization.
Uncertain Variables
In any problem, there are factors or inputs that you can control – for example,
the price you set for a product, and factors or inputs that you cannot control –
for example, customer demand, interest rates, etc. Risk Solver Platform uses
uncertain variables (random variables in mathematics) to represent inputs that
are uncertain and beyond your control. (It uses decision variables to represent
factors or inputs that you can control.)
To see more of the features of this dialog, try clicking the expand icon in
the title bar: the expanded dialog is shown on the next page. The left panel
provides another way to select one of Risk Solver Platform’s probability
distributions; the right panel provides chart options; and the bottom panel
reveals more “control parameters” that can be applied to any distribution.
Now we can either type in a number or cell reference, or we can click the
button at the right edge of the field: When we do this, a small “balloon” follows
the mouse pointer as we point and click on cell E11, as shown below.
Now E11 appears as the min (a) parameter. Since at this moment, the min (a)
value of 5.50 is greater than the max (b) value of 3, the parameter turns red –
this is a hint that the parameters are inconsistent. The red disappears once we
enter references to cell E12 for likely (c) and E13 for max (b). When we click
the Save icon, =PsiTriangular(E11,E12,E13) is inserted into cell B6.
We’ve now defined the uncertain variables in our model. Anything calculated
from these uncertain variables is an uncertain function, but usually we’re
interested only in specific results such as Net Profit at cell B11. When we “turn
on” Interactive Simulation, B11 will effectively hold an array of values, each
one calculated from different values sampled for B4, B5, B6 and B7.
What would we like to know about the array of values for Net Profit at cell B11?
The simplest summary result is the average (or mean) Net Profit. Note that this
When we click the Mean button, a small “balloon” like the one below appears
and follows the mouse pointer as we move to a worksheet cell, in this case B12.
When we click to “drop,” the formula =PsiMean(B11) appears in the cell.
If we click in cell B12 as shown above, this cell will contain =PsiOutput(B11).
Any one of these three actions – defining a summary statistic such as PsiMean()
on B11, add PsiOutput() to the formula in cell B11, or placing =PsiOutput(B11)
in another cell – is sufficient to designate cell B11 as an uncertain function.
Now 1,000 Monte Carlo simulation trials (the default number) will be executed
each time we change the spreadsheet, and cell B12 will display the true average
for Net Profit across these trials – as shown below.
The result of “shaking the ladder” is striking: Our true average Net Profit for
these 1,000 trials is only $93,075 – quite a bit less than the “Flawed Average”
Model figure of $117,750! And we also see that we can lose money – the last of
the 1,000 trials, which appears on the worksheet, shows a loss of $15,431. (If
you run this model yourself with no fixed random seed, you might have to press
F9 a few times to see a final Net Profit similar to this one.)
Try pressing F9 (the Excel recalculate key) on this model: Each time you do,
another 1,000 Monte Carlo trials are run, and a slightly different true average
Net Profit figure will be displayed – but normally much less than $117,750.
To see and do more, just double-click on B11, the cell calculating Net Profit, to
display a frequency chart of these outcomes, as shown below.
We see immediately that in some outcomes, we can lose of lot of money – over
$60,000! We also see that we make a profit in most outcomes – but how many
exactly? By left-clicking the mouse over the chart, we can display “crosshairs”
and see the (x,y) coordinates at the mouse pointer tip. By right-clicking the
mouse over the chart and selecting Add Lower, we can quickly put a vertical
bar at 0 on the horizontal axis, as shown below.
The Percentiles tab shows the same information as the Cumul Frequency tab,
but in numeric form. Below, we’ve shown the 50th through 65th percentiles:
The fact that Net Profit goes down as our Unit Cost at B6 goes up is expected.
But why does Net Profit go up as cell B9 goes up? Note that B9 = 1 corresponds
to the Hot market scenario, 2 corresponds to the OK market, and 3 corresponds
to the Slow market scenario. The fact that B9 is positively correlated with Net
Profit is telling us that we make higher profits when the market is slow, not
when it’s hot. Our typical Selling Price is lower when the market is hot, and the
increased Sales Volume doesn’t make up for this.
Click the Clipboard icon to copy the currently displayed chart to the Windows
Clipboard. You can then choose Edit Paste in Word, Excel, PowerPoint and
many other applications to paste the chart image into your document. (Choosing
Edit Paste in Excel inserts a static, non-updating chart image in the worksheet.)
Click the Print icon to immediately print the currently displayed chart on your
default printer, or click the down arrow next to this icon to display the menu
choices shown above: Print Preview, Printer Settings and Page Settings. You
can choose a printer and set printer options, set page margins, and preview your
output using these menu choices.
You can control the chart type, color, dimensionality and transparency, bin
density, titles and legends, axis labels and number formats, horizontal axis
scaling, and more. As you change chart options in the right pane, the chart is
immediately updated so you can see the results (unlike some other simulation
products for Excel). When you’re satisfied with the chart format, you can save
and apply it to just this chart, to all charts on this worksheet, or to all charts in
the workbook when you click the Apply button at the bottom of the right pane.
In this section, we’ll explore a simple airline revenue management model, also
known as a yield management model. We’ll start with a simple simulation
model, like the one in the previous section. But in this section, we’ll see we can
answer further questions by running multiple parameterized simulations in Risk
Solver, and by solving a simulation optimization model in Risk Solver Premium
and Risk Solver Platform.
To open this example, click Help – Simulation Examples on the Ribbon, which
opens a workbook SimExamples.xls with the list of example workbooks. Click
the links to open examples YieldManagement1.xls (a simple simulation
model), YieldManagement2.xls (a model with multiple parameterized
simulations), and YieldManagement3.xls (a simulation optimization model).
A Single Simulation
The model YieldManagement1.xls is shown on the next page.
From the Statistics tab in the Uncertain Function dialog, or from cell C16, we
see that the mean or expected net revenue is about $20,457. From the
Cumulative Frequency tab or the Percentiles tab, we can see that the 10%
percentile is $20,000 – if we see 110 tickets, we’ll earn as much revenue as a
full flight (100 seats * $200) 90% of the time. You can see why airlines find
that overbooking makes sense as a policy!
The Scatter Plots tab shows you quick scatter plots of this uncertain function
against one or more uncertain variables, or other uncertain functions. In this
example – shown on the next page – it shows a scatter plot of C15 (net revenue)
against C7 (number of no-shows). Since we’re selling 110 tickets, we see that
revenue grows at first as the number of no-shows increases, since we avoid
overbooking compensation and sell each empty seat for more than the refund
issued to the no-show passenger. But when the number of no-shows passes a
certain level, net revenue declines. Perhaps we should sell more than 110?
Now we can simply type a new number of Tickets Sold, such as 125, into cell
C11. Instantly, Risk Solver Platform performs a new simulation of 1,000 Monte
Carlo trials, and updates the Uncertain Function dialog and the worksheet with
the results – as shown on the next page.
The new distribution of outcomes is quite different – we have more high-
revenue data points – but the mean or expected revenue is not so different --
$20,521. Selling 125 tickets does seem to be better than selling 110 tickets, but
we’re not yet sure that this is the best number of tickets to sell. (We’ll answer
that question in the next two sections.)
In the meantime, however, Interactive Simulation allows us to “play what-if”
with this model, changing the parameter that we can control (the number of
tickets sold), while properly modeling the behavior of the parameter we cannot
control (the number of no-shows). As Prof. Sam Savage says, “Interactive
Simulation does for uncertainty what the spreadsheet did for numbers.”
The dialog now includes a dropdown list that allows you to select a simulation
to display. You can examine the Frequency, Cumulative Frequency, Reverse
Cumulative Frequency, Sensitivity, Scatter Plots, Statistics or Percentiles tabs
for any simulation.
The worksheet will initially display values for the last Monte Carlo trial of the
last simulation performed (except for the cells containing PSI Statistics function
calls such as PsiMean()). But you can display any trial from any simulation, by
changing the selections in the Sim # and Trial # controls on the Ribbon:
By examining this data, you can get a better idea of how many tickets to sell.
But Risk Solver Platform can help your further.
This shows a Box-Whisker diagram for each of the 51 simulations, with the
mean, median, 25th and 75th percentiles, and the minimum and maximum value
for net revenue on each one. You can click the right edge of the Trend and Box-
Whisker charts to open a right panel with options for customizing these charts.
You can use the icons on the title toolbar to print the chart, or copy it to the
Clipboard, where it can be pasted into another application such as PowerPoint.
Simulation Optimization
Introduction
This chapter introduces stochastic optimization in Risk Solver Platform, with a
series of examples.
To open the examples, click Help – Optimization Examples on the Ribbon,
which open a workbook OptExamples.xls with the list of example workbooks.
Click the link StochasticExamples.xls to open this workbook.
We use the term stochastic optimization to mean optimization of models that
include uncertainty, using any solution method. Risk Solver Platform offers an
exceptional level of power to find robust optimal solutions to models with
uncertainty, using three different solution methods:
Simulation optimization
Stochastic programming
Robust optimization
The first method, simulation optimization, is also available in Risk Solver
Premium, and is the only method in other software products such as Crystal Ball
Professional and @RISK Industrial. It handles very general models, but it is not
scalable to large models (with thousands of variables and constraints), and it
doesn’t support the important modeling concept of recourse decisions.
Stochastic programming and robust optimization can be applied only to
linear and quadratic programming models with uncertainty, but they are scalable
to large models. Full Risk Solver Platform is required to use these methods.
Our first example may surprise you: It is a capital budgeting problem, where the
projects being considered for funding have uncertain future cash flows. Models
similar to EXAMPLE1 have been used with other software products for many
years to illustrate how simulation optimization can be used to optimize models
with uncertainty. We’ll show how to do this in Risk Solver Platform or Risk
Solver Premium, using simulation optimization and the Evolutionary Solver –
To model the uncertainty in this problem, we use PSI functions that define
uncertain variables with certain probability distributions. We can create these
functions via the Distributions dropdown gallery and the Uncertain Variable
dialog, as shown in the last chapter, or we can just type in the formulas.
To model the “Cash Flow if Successful” in column C, we use the
PsiTriangular() function, specifying a minimum, most likely, and maximum
cash flow. For example, the formula in C4 is =PsiTriangular(400000, 500000,
900000).
To model the “Chance of Success” in column D, we use =PsiBinomial(1,.9).
On each trial, this distribution returns 1 with probability 90% and 0 with
probability 10%. In column E we multiply the “Cash Flow if Successful” and
the “Chance of Success” to obtain the “Expected Cash Flow.”
Column G computes the net cash flow – the “Expected Cash Flow” in column E
minus the “Initial Investment” in column F. Column H holds our decision
variables, which are constrained to be binary integer (0 or 1 at the solution).
Cell F13 computes the total initial investment as the SUMPRODUCT of the
project initial investments (column F) and the 0-1 variables in column H. In the
model, F13 is constrained to be less than the $1.5 million budget in F14.
On the Engine tab, select the Evolutionary Solver from the dropdown list.
Why do we choose these settings? In the case of other software products, it’s
because simulation optimization is the only technology they have – and “if your
only tool is a hammer, every problem looks like a nail.” Simulation
optimization is also a very general approach that can handle nonlinear and non-
smooth functions, and it’s comparatively easy to understand.
The idea behind simulation optimization is straightforward: For each set of
values for the decision variables considered by the optimizer, we perform one
simulation, a compute user-specified summary measures – such as
=PsiMean(F16) in the Project Selection model – for the constraints and/or
objective that depend on uncertainty. The optimizer uses these summary
measures to decide what set of values it should try next for the decision variables
– and the process is repeated.
The great strength of simulation optimization is its generality – but this is also
its weakness: It requires a new simulation at each step of the optimization, and
because the method assumes no structure in the model, in general the number of
steps can grow exponentially with the number of variables and constraints.
We’ve decided to fund projects #1, 3, 4, 5, and 7 for expected total net cash flow
of $1,388,094. That’s a great result. But – how much work did we do to solve
this model, and did we need to do that much work? It might not matter for a
small model like this one – but for a ‘scaled-up’ model that might involve
hundreds or thousands of projects, the solution might have taken far more time.
Solving Automatically
Let’s allow Risk Solver Platform to choose the solution method and the Solver
Engine automatically. To do this, go to the Task Pane Platform tab, and change
the Solve Uncertain Models option to Automatic.
On the Engine tab, check the box to automatically select a Solver Engine.
and then click the Analyze button to analyze the structure of the model. The
Model Diagnosis section of the Task Pane Model tab “pops up” to show the
results, as shown on the next page.
and click the Analyze button again – this will analyze the structure of the
transformed robust counterpart model.
The transformed model has 9 variables and 8 functions (instead of 3 and 3), but
it has 0 uncertainties – it’s a conventional linear programming model. Solving
this robust counterpart model will give us an approximate (and somewhat
conservative) solution to the original stochastic LP problem.
We run one simulation to see the expected value of the objective, which is about
$1,502, lower than the initial value of $1,693. But our chance constraint is not
only satisfied but over-satisfied – we meet consumer demand about 99% of the
time, when we asked for only 95%. This solution is more conservative than
necessary.
But Risk Solver Platform can automatically improve this solution, by adjusting
the size of the uncertainty set for the chance constraint. To do this, click the
special button to “Auto Adjust Chance Constraints” that appears at the top of
the Task Pane. After a moment, a new solution appears with the message
“Solver has converged to the current solution of the robust chance constrained
problem. All constraints are satisfied,” as shown on the next page.
We now have a good solution to the Gas Company problem, found with either
simulation optimization or robust optimization. But we can do better than this –
we can reduce our expected total cost to $1,276, a significant improvement.
We can do this provided that the business situation permits us to make the
decision of how much gas to purchase next year on a ‘wait and see’ basis, after
the uncertainty of the weather is resolved – a so-called recourse decision. In
this example, our gas supplier must accept our purchase order next year, and not
require us to commit to a specific amount of gas this year for delivery next year.
One of the most important messages we can convey is this: If the business
situation permits you to make some decisions on a ‘wait and see’ basis, it’s
crucial to include this in your optimization model. If you don’t do this, you
may find an optimal solution to the wrong model for the actual business
problem.
We emphasize this because so many people have built models that don’t include
‘wait and see’ decisions, because (i) they haven’t learned this concept and (ii)
their software hasn’t allowed them to create models with recourse decisions.
Simulation optimization is very popular, but as described in the technical
literature and implemented in software, it has no concept of recourse decisions.
In the next example, Gas Company Recourse, we’ll assume that our decision of
how much gas to purchase next year can be made on a ‘wait and see’ basis, after
This model has the same objective (C25), the same decision variables (D14, D15
and D18), and the same constraints (C22 and C23) as in EXAMPLE2. It differs
in just two ways: (i) Cell D18 – the amount of gas to purchase next year –
appears as a recourse decision variable. (ii) Cell C23 is no longer a chance
constraint – it is a normal constraint, and in fact it’s = rather than >= – we
expect to satisfy next year’s consumer demand exactly. The recourse decision
variable allows us to do this – in each possible future scenario, once the weather
uncertainty is resolved and consumer demand is known, we will purchase just
the amount of gas we need to meet demand.
The robust counterpart has 9 variables and 8 functions, but the uncertainty and
the recourse decision have been eliminated, yielding a conventional linear
programming model. As with Gas Company Chance, solving this robust
counterpart model will give us an approximate solution to the original problem.
Now click the Optimize button, or the green arrow on the Task Pane. In a
fraction of a second, the solution appears, with the message “Solver found a
solution. All constraints and optimality conditions are satisfied.” As shown on
the next page, the expected value of the objective is now about $1,365– a
considerable improvement over the minimum cost of about $1,434 in Gas
Company Chance.
If you examine the trials, you’ll see the pattern: The optimal solution is to not
store any gas in Year 1 for use in Year 2, but instead to buy just enough gas to
meet the uncertain demand in Year 2. (With higher gas costs or lower storage
costs, the optimal solution might change.).
This solution offers a lower expected cost (the average cost over all future
scenarios) because of the flexibility introduced by use of a recourse decision.
And we were able to do this because we created the right kind of model for the
business situation.
The ‘moral of this story’ is that Risk Solver Platform gives you the power to
solve such problems, using three different technologies – simulation
optimization, stochastic programming, and robust optimization. But it’s up to
you to take advantage of the concept of recourse decisions – when they can be
used – and create the right kind of model for your company’s business situation.
Introduction
This chapter introduces the use of parameters, and functions for sensitivity
analysis in Risk Solver Platform, with examples. In Version 10.0, the role of
parameters – for optimization, simulation, and sensitivity analysis – has been
enhanced, and the sensitivity analysis functions are new.
Sensitivity analysis is designed to help you explore a conventional Excel
spreadsheet model, often before you define optimization or simulation model.
The goal of sensitivity analysis is to identify the key input parameters that have
the greatest impact on results of interest in your model (such as Net Profit), and
to see the effect of varying these key input parameters over a range, in reports
and graphs. Risk Solver Platform helps you automatically identify sensitivity
parameters, and automatically vary them to produce reports and graphs.
Defining a Parameter
You can manually define an input cell as a parameter by simply selecting the
cell, choosing Parameters and Sensitivity, Optimization or Simulation from
the Ribbon, and entering a lower and upper limit on values for the parameter, or
a list of explicit values for the parameter. In the example on the next page, we
are defining a sensitivity parameter.
The chart shows us, at a glance, that Total NPV is most sensitive to cell E13 –
which is a large positive cash flow ($75) in Year 6 for Opportunity 4. It is next
most sensitive (in the opposite direction, decreasing when the parameter
increases) to the interest rate in cell F4.
The right panel of the chart shows the lower value and upper value that were
used for each input cell when computing the formula value. An ordinary cell
containing a number is set to its current value – n% and its current value + n%,
where n% (initially 10%) is specified in the edit box in the lower right corner of
the chart. If any input cell is already defined as a parameter, the lower and
upper limit arguments of its PsiXxxParam() call are used instead.
By checking or clearing the boxes “Show Current Parameters” and “Show
Candidate Cells” at the top of the right panel, you can show one or both types of
Defining Results
When you perform a sensitivity analysis (which will automatically vary
sensitivity parameters), or multiple optimizations or simulations (which will
vary optimization or simulation parameters), Risk Solver Platform will keep
track of one or more result cell values, corresponding to each parameter value.
For optimizations, Risk Solver Platform tracks the final objective and
decision variable values found by the Solver; you can also track a
constraint value by setting its Monitor property in the Task Pane.
For simulations, Risk Solver Platform tracks the values of all uncertain
functions (simulation outputs, referenced inPsiOutput() or PSI Statistics
function calls).
For sensitivity analysis, Risk Solver Platform tracks results the cell
currently selected at the time you perform the analysis, and any other
results you define.
To define a sensitivity result cell, select the cell (such as A3 below – always a
formula cell) on the worksheet, and choose Parameters – Results from the
Ribbon. A small “balloon” will appear, containing a function call such as
=PsiSenValue(A3). You can move the mouse to “drag and drop” this formula
into an empty cell. When you do this, cell A3 is defined as a sensitivity result
cell, and appears in the Task Pane Model outline under Sensitivity Results.
Introduction
This chapter introduces decision trees in Risk Solver Platform. Such trees are a
useful graphical and computational aid for problems that involve sequential
decisions and events, where there are a small number of decision alternatives at
each step, and a small number of alternative outcomes for each event.
In the example below, we’ve used Help – Optimization Examples, and clicked
on TreeExample.xls, which is based on an example by Prof. Mike Middleton.
You can also create and edit a decision tree in the Task Pane Model tab, using
the Add (+) and Remove (X) icons and the properties area at the bottom of the
The Add Node and Change Node options display the dialog shown on the next
page. To change a node, you must first select it on the Excel worksheet – you
may select either the node graphic or one of the immediately adjacent cells.
The Copy Node and Paste Node choices can be used to copy a subtree (rooted
at the selected node) and paste the copy at another position in the decision tree;
this is very useful when there are identical choices at later stages in the tree.
The Add Branch and Change Branch options display the Decision Tree dialog
shown below. To change a branch, you must first select it on the Excel
worksheet – you may select either the branch graphic or one of the immediately
adjacent cells. Note that Add/Change Node and Add/Change Branch options
display the same Decision Tree dialog: Branches are associated with the node to
their left, and you can edit properties of the node and its branches in this dialog.
The next page shows the example decision tree shown earlier, with Excel
worksheet gridlines turned off, and the best decision strategy highlighted.
In this example, we’ve selected the decision node named Method, represented
by the graphic symbol at cell K16 on the worksheet. The optimal choice at this
node (given that we’re maximizing expected value or EV) is branch #2, and the
rollback value of the subtree rooted at this node is 90,000.
Note the small Copy icon in the upper right corner of the Decision Tree Node
properties pane: You can click this icon to copy a subtree rooted at this node.
When you’ve selected a Terminal node in the Model outline, you’ll notice a
small Paste icon in this same area: You can click this icon to paste a subtree at
the position of the Terminal node.
Platform Tab
By default, rollback values for a decision tree are computed assuming that you
want to Maximize Expected Value or EV. You can change this by setting
options in the Decision Tree section of the Task Pane Platform tab, as shown on
the next page.
You can select Maximize or Minimize in the dropdown list for the Decision
Node EV/CE option. For the Certainty Equivalents option, you can choose
either Expected Value or Exponential Utility Function. The remaining three
options come into play only when you choose Exponential Utility Function –
they set parameters of this function.
Introduction
This chapter introduces multiple discriminant analysis (MDA) in Risk Solver
Platform. Discriminant analysis is a statistical technique for analyzing a data
set, consisting of cases or observations of one or more variables, and classifying
the cases into different groups. MDA is sometimes called discriminant factor
analysis or canonical discriminant analysis. It has many applications in
financial services and consumer marketing, among other fields.
In the example on the next page, due to Prof. Cliff Ragsdale, a personnel
department wants to use historical data on scores from pre-employment aptitude
tests of factory employees, and later performance reviews of the employees who
were hired, to predict whether new employees will perform well on the job.
The historical data includes scores on two pre-employment tests, for mechanical
aptitude and verbal aptitude, and a classification of the actual performance of
each employee as superior (Group 1), average (Group 2), or inferior (Group 3).
The personnel department wants to develop a classification rule to help them
screen new applicants and accept those likely to be superior, reject those likely
to be inferior, and conduct further checks on applicants likely to be ‘average’.
The historical data provides 7 cases each of superior and inferior employees, and
6 cases of average employees.
In the picture on the next page, we’ve selected Reports – Discriminant
Analysis – Discriminant Analysis to display the Discriminant Analysis dialog.
For the Training Sample, we’ve selected cells B4:B23 which contain the
categorical variable (1, 2 or 3) representing superior, average and inferior
performance for each employee, and cells C4:D23 containing the corresponding
scores on the mechanical aptitude and verbal aptitude tests. For the Classifica-
tion Sample, we’ve selected cells C4:D9 on another worksheet, containing the
test scores for six new applicants.
We are using the default choices for the MDA methods, which use quadratic
discriminant analysis (unpooled estimates).
Introduction
This chapter explains how to obtain and interpret results from optimization in
Risk Solver Platform. We’ll discuss what can go wrong, and what to do about
it, and also how to get more than a single optimal solution from your model.
Risk Solver Platform has many powerful optimization algorithms, and will fully
exploit the power of your PC. But the model that you create may be relatively
easy to optimize (if you use linear functions like SUM) or extremely difficult to
optimize (if you use non-convex and non-smooth functions like LOOKUP). The
results you get depend on the model you create.
In the following sections, we’ll focus on immediate actions you can take when
you get an unexpected result – but if you read the chapter “Mastering
Conventional Optimization Concepts,” you’ll learn more about optimization
models and solution methods, and better understand why the unexpected result
appeared, and how to design your model to get the solutions you want.
If you click the Copy icon, the contents of the solution log will be copied to
the Windows Clipboard, where you can paste it into Microsoft Word, NotePad,
or an email message to Frontline Systems Technical Support. Below is the
complete solution log from the above example:
---- Start Solve ----
Using: Full Reparse.
Parsing started...
No uncertain input cells.
Diagnosis started...
Model diagnosed as "NSP".
This was a successful solution – but in cases where you have a Solver Result
error message that you don’t understand, or a solution that you don’t under-
stand, the solution log can be quite helpful.
Below is a portion of the solution log (from the LP/Quadratic Solver) for the
EXAMPLE5 model:
Integer solution of 3100 found by Feasibility Pump after 0
iterations and 0 nodes (0.01 seconds)
After 0 nodes, 1 on tree, 3100 best solution, best possible
2355.01 (0.18 seconds)
After 1 nodes, 2 on tree, 3100 best solution, best possible
2355.01 (0.18 seconds)
Integer solution of 2630 found by Unknown after 285 iterations
and 2 nodes (0.19 seconds)
After 2 nodes, 2 on tree, 2630 best solution, best possible
2361.69 (0.19 seconds)
Integer solution of 2400 found after 294 iterations and 3 nodes
(0.20 seconds)
After 3 nodes, 1 on tree, 2400 best solution, best possible
2361.69 (0.20 seconds)
Engine Solve time: 0.20 Seconds.
If you are having problems finding the solution you want or expect, this detailed
log can sometimes be helpful.
Notice the two hyperlinks in the Help text, to Functions of the Variables and the
Linearity Report. If you click the latter link, the Help text below appears.
The Linearity Report and (in Risk Solver Platform and Premium Solver
Platform) the Structure Report can help when you encounter “The
linearity conditions required by this Solver engine are not satisfied.”
The Feasibility Report and Feasibility-Bounds Report can help when you
encounter “Solver could not find a feasible solution.”
The Scaling Report can help when you encounter either of these messages,
or other unexpected messages or solution values. See the section below
“Problems with Poorly Scaled Models.”
See the section “An ‘Accidentally’ Nonlinear Model” in the chapter “Examples:
Conventional Optimization” to see how the Linearity Report, and (in Premium
Solver Platform and full Risk Solver Platform) the Structure Report produced
by the PSI Interpreter can help us pinpoint the nonlinear formulas in this model.
Click Continue if you want to continue solving; click Stop to cause the Solver
to stop the solution process (this may take a few seconds) and display the
message “Solver stopped at user’s request.” Clicking Restart may be useful
with the Evolutionary Solver – see the Risk Solver Platform Reference Guide.
You can make a real-time decision that the current solution is “good enough,”
and press ESC or click the Pause/Stop button, then click the Stop button in the
Show Trial Solution dialog, to stop the Solver with the current solution.
Dual Values
When you formulate and solve a linear programming problem, or a smooth
nonlinear optimization problem, the solution process also yields numbers, called
dual values, for the decision variables and constraints that are “pressed to the
limit” at the optimal solution. A dual value can tell you, for example, how much
you could pay to acquire more units of a scarce resource that is fully utilized in
the solution; it is sometimes called a shadow price or marginal value.
The dual value for a decision variable is nonzero only when the variable’s
value is equal to its upper or lower bound at the optimal solution. This is
called a nonbasic variable, and its value was driven to the bound during the
optimization process. Moving the variable’s value away from the bound
will worsen the objective function’s value; conversely, “loosening” the
bound will improve the objective. The dual value measures the increase in
the objective function’s value per unit increase in the variable’s value.
The dual value for a constraint is nonzero only when the constraint is
equal to its bound. This is called a binding constraint, and its value was
driven to the bound during the optimization process. Moving the constraint
left hand side’s value away from the bound will worsen the objective
function’s value; conversely, “loosening” the bound will improve the
objective. The dual value measures the increase in the objective function’s
value per unit increase in the constraint’s bound.
In nonlinear optimization problems, the dual values are valid only at the single
point of the optimal solution – if there is any curvature involved, the dual values
begin to change as soon as you move away from the optimal solution. In linear
programming problems, the dual values remain constant over a range of
increases and decreases in the variables’ objective coefficients and the
constraints’ right hand sides, respectively.
To obtain dual values in report form, simply select Reports – Optimization –
Sensitivity from the Ribbon. An example Sensitivity Report appears below.
You can also obtain dual values via the Risk Solver Platform Object-Oriented
API, with simple references such as myProb.VarDecision.DualValue(i) or
myProb.FcnConstraint.DualValue(i) in your VBA code. This is described in
greater depth in the chapter “Automating Optimization in VBA.”
On the next page is a Sensitivity Report for EXAMPLE1, the Product Mix
model which is the first example in the chapter “Examples: Conventional
Optimization.” At the optimal solution, we use all 800 Speaker Cones and 600
Electronics units, but not all of the other components. We don’t produce any
Speakers – cell F9 is driven to its lower bound of 0. What do the dual values tell
us about the two binding constraints, and the one “nonbasic” decision variable?
The dual value of 12.5 for Speaker Cones tells us that we could increase Total
Profits by $12.50 for every additional Speaker Cone we can acquire, up to 100
more. Similarly, the dual value of 25 for Electronics units tells us we could use
up to 50 more units and increase Total Profits by $25.00 for each extra unit.
Multiple Solutions
When you solve an integer programming problem or a global optimization
problem, the final solution you see on the Excel worksheet is typically the best
of several candidate solutions that were found during the solution process. You
can obtain and examine these other solutions; this can be useful, especially if
you have other criteria, not captured in the formulation of the optimization
model, for preferring one solution over another. For each candidate solution,
you can examine the final values of the decision variables and the objective.
To obtain multiple solutions in report form, select Reports – Optimization –
Solutions from the Ribbon.
For integer programming problems, the report shows each ‘incumbent’ or
feasible integer solution found by the Branch & Bound method during the
solution process.
For global optimization problems, the report shows each locally optimal
solution found by the Multistart method.
For non-smooth optimization problems solved with the Evolutionary
Solver, the report shows key members of the final population of solutions.
For all types of problems, if only one candidate solution was found, the
Solutions choice will not appear in the Reports – Optimization gallery. For
example, advanced Solvers for integer programming problems may find optimal
solutions at the root node of the Branch & Bound tree, without considering any
other incumbent solutions. For integer programming problems solved with the
LP/Quadratic or Large-Scale LP/QP Solver, the Engine tab Integer group
PreProcessing option must be set to None in order to create a Solutions Report.
You can also obtain multiple solutions via the Risk Solver Platform Object-
Oriented API, by accessing a property such as myProb.Solver.NumSolutions,
setting the property myProb.Solver.SolutionIndex to choose a solution, then
accessing the solution in the usual manner.
Risk Solver Platform displays a dialog where you can enter a lower and upper
limit for the parameter value, or alternatively a list of values or a cell range:
We click the cell selector icon to the right of the field containing 0.095, and then
point and click to select cell I20. The properties of the constraint are updated to
use cell I20 for the right hand side, as shown on the next page.
Just one more step is required: We must specify how many optimizations we
want to perform. On the Task Pane Platform tab, we set the very first option
Optimizations to Run to 10, as shown on the next page.
Select the optimization result you would like to chart: In this example, we want
to plot the optimal objective (Portfolio Variance) across the 10 optimizations,
where the Portfolio Return threshold is varied on each optimization.
Introduction
This chapter explains how to obtain and interpret results from simulation in Risk
Solver Platform. We’ll discuss what can go wrong, and what to do about it,
and also how to get maximum insight from the results of a simulation.
Simulation is ‘simpler’ than optimization in the sense that it requires only (i)
sampling of input values, (ii) calculation of your Excel model with these values,
and (iii) collection of the results; no ‘search for a best solution’ is involved. A
simulation can be performed on almost any model, using any Excel functions.
But the way you build your model does affect the speed of simulation, or the
time required to get results. And the structure of your model will become even
more important in the next chapter, when we consider optimization and models
that include uncertainty.
In the following sections, we’ll focus on immediate actions you can take when
you get an unexpected result – but if you read the chapter “Mastering Simulation
and Risk Analysis Concepts,” you’ll learn more about the Monte Carlo
simulation process, and better understand how to design your model to get the
best results in the least time.
Enter a positive number for the option Sim. Random Seed. A value of 0 here
means “use the value of the system clock as the seed on each simulation.”
If you have the Interpreter option set to Psi Interpreter, the progress indicator
usually won’t be updated during the trials of a single simulation, because all of
these trials are being executed in parallel. If you are running a multiple
parameterized simulation, the progress indicator will be updated for each new
simulation, as shown in the example below.
Dialog Tabs
The PDF, CDF, and Reverse CDF tabs provide three different views of the
shape of a probability distribution. You can left-click to display “cross-
hairs” with numerical values on these charts, or right-click to add Lower
and Upper bounds on the sampled values.
The Statistics and Percentiles tabs provide accurate analytic values for the
distribution’s key statistics and percentiles. These are computed from the
parameters you specify, and don’t depend on sampling or simulation.
Using the title toolbar icons, you can save your settings, print the charts or
numbers from any of the dialog tabs, or copy the charts or numbers to the
Windows Clipboard, where they can be pasted into other applications. You
can also fit a distribution to historical data you have in a cell range.
Using the 3-D toolbar you can – with a single click – shift between 2-D and
3-D, shrink or magnify the chart, or move or rotate the chart to a different
perspective.
Dialog Tabs
The Frequency, Cumulative Frequency, and Reverse Cumulative
Frequency tabs provide three different views of the full range of outcomes
for an uncertain function. You can click to display “crosshairs” with
numerical values on these charts, or add Lower and Upper bounds to see the
estimated probability of a profit or loss, for example.
The Tornado chart on the Sensitivity tab quickly shows you which
uncertain variables have the greatest impact on this uncertain function,
across the full range of Monte Carlo trials. The Scatter Plots tab often
reveals further insights about the behavior of this uncertain function versus
each uncertain variable, or versus other uncertain functions.
The Statistics and Percentiles tabs give you a full range of numerical
results for this uncertain function, across the full range of Monte Carlo
trials. Using PSI Statistics functions, you can place any of these values into
a worksheet cell.
You can also fit an analytic distribution to data that you obtain from another
source, such as historical observations of the process you want to model. If you
have this sample data on your Excel worksheet, you can simply select the cell
range containing the data, and click the Fit icon on the Ribbon. Using this tool,
you can easily create an uncertain variable whose distribution models this data.
Risk Solver Platform displays a dialog box, where you can enter a lower limit
and upper limit for the parameter value, or a specific list of values that you
would like the parameter to take on successive simulations. If you specify a
lower and upper limit, then when you set the number of simulations, the
parameter will take on equally-spaced values from the lower to the upper limit.
To set the number of simulations, simply edit the option in the Task Pane
Platform tab Simulation group option Simulations to Run:
Introduction
This chapter explains how to obtain and interpret results from stochastic
optimization (optimization of models with uncertainty) in Risk Solver Platform.
We’ll discuss what can go wrong, and what to do about it, and also how to get
more than a single optimal solution from your model.
Risk Solver Platform has powerful algorithms for automatically transforming
and solving optimization models with uncertainty. But since a stochastic
optimization model includes decision variables, uncertain variables, and
constraints and an objective that may depend on both, there are “more things
that can go wrong.” Indeed, everything you’ve read in the previous two
chapters, “Getting Results: Conventional Optimization” and “Getting Results:
Simulation and Risk Analysis” will apply to stochastic optimization – plus there
are a variety of special result messages and error messages that apply only to
stochastic optimization models.
The good news is that everything you’ve learned so far about conventional
optimization and Monte Carlo simulation does apply to stochastic optimization
in Risk Solver Platform. Unlike most other software packages, Risk Solver
Platform has one consistent user interface, set of terms, and model elements for
all types of simulation and optimization models.
In the following sections, we’ll focus on immediate actions you can take when
you get an unexpected result – but if you read the chapter “Mastering Stochastic
Optimization Concepts,” you’ll learn far more about stochastic optimization
models and solution methods, and better understand why the unexpected result
appeared, and how to design your model to get the solutions you want.
If you click the Copy icon, the contents of the solution log will be copied to
the Windows Clipboard, where you can paste it into Microsoft Word, NotePad,
or an email message to Frontline Systems Technical Support. Also on the
next page is the complete solution log from the Gas Company Chance model
(before clicking the button to automatically improve the solution).
Note what happened during the solution process: Risk Solver Platform found
that a Stochastic Transformation could not be applied to this model, because it
has a decision-dependent uncertainty (the number of no-shows at cell C7
depends on the number of tickets sold, our decision variable, at C11). See the
chapter “Mastering Stochastic Optimization Concepts” for more information on
this important property of your model.
Risk Solver Platform diagnosed the model as “SIM NonCvx,” and solved it
using simulation optimization – the most general, but least scalable stochastic
optimization method in Risk Solver Platform. It used the GRG Nonlinear
Solver Engine (selected by the user) for optimization, and on every trial solution
explored by the GRG Solver, it automatically performed a simulation.
Let’s contrast what happened above with another example, where there are no
decision-dependent uncertainties, and the underlying optimization model is a
linear programming problem, but there is a chance constraint.
Below is an example of the Output tab at the solution of the Gas Company
Chance model in StochasticExamples.xls (described more fully in the chapter
“Examples: Stochastic Optimization”).
Again, if you click the Copy icon, the contents of the solution log will be
copied to the Windows Clipboard, where you can paste it into Microsoft Word,
NotePad, or an email message to Frontline Systems Technical Support.
Below is the solution log from the Gas Company Chance model (before clicking
the button to automatically improve the solution).
---- Start Solve ----
Using: Full Reparse.
Parsing started...
Uncertain input cells detected.
User requested Robust Counterpart.
Diagnosis started...
Convexity testing started...
Stochastic Transformation succeeded using Robust Counterpart
with D Norm.
Transformed model is "LP Convex".
Model: [StochasticExamples.xls]Gas Company Chance
Using: Psi Interpreter
Parse time: 1.19 Seconds.
Engine: Standard LP/Quadratic
Setup time: 0.02 Seconds.
Engine Solve time: 0.00 Seconds.
Notice that the Help topic points out the option to Auto Adjust Chance
Constraints. This is one key to better solutions when robust optimization is
used, as in this example. Clicking the icon at the top of the Task Pane yields
an improved solution, and the following solution log:
---- Start Solve ----
Model: [StochasticExamples.xls]Gas Company Chance
Using: Psi Interpreter
Using: Full Reparse.
Parsing started...
Diagnosis started...
Parse time: 0.19 Seconds.
Engine: Standard LP/Quadratic
Setup time: 0.00 Seconds.
Engine Solve time: 0.00 Seconds.
(above lines appear 7 times)
Below is an Answer Report obtained for the Gas Company Chance model when
we first received the Solver Result message “Solver found a conservative
solution to the robust chance constrained problem. All constraints are satisfied:”
Note especially row 26, which reports the status of the chance constraint
VaR0.95($C$23) >=0: We asked for satisfaction of this constraint 95% of the
time, but at this solution the constraint is being satisfied 99.5% of the time.
This is a strong hint that the solution is conservative, and can be improved.
Dialog Tabs
The Frequency, Cumulative Frequency, and Reverse Cumulative
Frequency tabs provide three different views of the full range of outcomes
for an uncertain function. You can click to display “crosshairs” with
numerical values on these charts, or add Lower and Upper bounds to see the
estimated probability of a profit or loss, for example.
The Tornado chart on the Sensitivity tab quickly shows you which
uncertain variables have the greatest impact on this uncertain function,
across the full range of Monte Carlo trials. The Scatter Plots tab often
reveals further insights about the behavior of this uncertain function versus
each uncertain variable, or versus other uncertain functions.
The Statistics and Percentiles tabs give you a full range of numerical
results for this uncertain function, across the full range of Monte Carlo
trials. Using PSI Statistics functions, you can place any of these values into
a worksheet cell.
Introduction
This chapter explains how to use the Object-Oriented API in Risk Solver
Platform to create, modify and solve optimization models under the control of
your custom application written in VBA.
This API is compatible with the object-oriented API offered by Frontline’s
Solver Platform SDK, used to build custom applications of optimization and
simulation using C++, C#, VB.NET, Java, MATLAB and other languages.
Risk Solver Platform also supports “traditional” VBA functions, which are
upward compatible from the VBA functions supported by the standard Excel
Solver. This API is described in the Risk Solver Platform Reference Guide.
If you select FcnConstraint and then type a period, you’ll be prompted with the
properties and methods available for Functions:
This makes it much easier to write correct code, without consulting the manual.
What’s more, you can use this object-oriented API when programming Excel
and Risk Solver Platform from new languages such as VB.NET and C#,
working in Visual Studio, and receive IntelliSense prompts in the syntax of
these languages!
If you’re using new functionality in Risk Solver Platform, the object-oriented
API is your best bet. And if you’re planning to move your application outside of
Excel in the future – so it will run as a standalone program – you’ll find that
Frontline’s Solver Platform SDK offers an object-oriented API that closely
resembles the new APIs in Risk Solver Platform.
The dropdown list at the top left corner of the Object Browser initially displays
<All Libraries> – change this to select RSP. In the object browser pictured,
we’ve highlighted the properties of the Function object
Introduction
This chapter explains how to use the Object-Oriented API in Risk Solver
Platform to create, modify and solve simulation models under the control of
your custom application written in VBA.
In the simplest case, you can use a few standard lines of VBA code to enable
and disable Interactive Simulation, as described below. But you can do much
more in VBA, to create custom risk analysis applications.
You can define a Problem and instantiate it from the spreadsheet with two lines
of code, then access the uncertain elements of your model via Variable and
Function objects. You can perform simulations, access trials and summary
statistics, and present them the way you want to your end user. All the power of
the Excel object model is available, including database access, charts and
graphs, and custom dialogs and controls.
Risk Solver Platform’s VBA object model closely resembles the object-oriented
API of Frontline’s Solver Platform SDK – which includes a complete toolkit
for Monte Carlo simulation. This makes it easier to move an application from
Excel to a custom program written in C/C++, Visual Basic, VB.NET, Java or
MATLAB.
GetFrequency Method
Variable and Function objects also have a GetFrequency method, that plays the
same role as the PsiFrequency() function on the spreadsheet. It takes an argu-
ment specifying the type of frequency distribution (density, cumulative, etc.)
and an array argument specifying the upper limits of the “bins” for which you
want to obtain frequency data. It yields a DoubleMatrix object that takes two
subscripts: the index (starting from 0) of the cell in the range represented by the
Variable or Function object, and the index (starting from 0) of the frequency bin.
Introduction
This chapter explains basic and advanced concepts of optimization, such as the
types of problems you can solve, types of constraints (regular, integer, conic,
alldifferent) you can specify, the nature of linear, quadratic and nonlinear
functions, convex and non-convex functions, smooth and non-smooth functions,
and the algorithms and methods used by Risk Solver Platform and plug-in
Solver engines.
This chapter focuses on conventional or deterministic optimization models,
which do not include any uncertainty. The next chapter “Creating and Solving
Models that Include Uncertainty” explains the concepts of stochastic
optimization models – those that do include uncertainty – and solution methods
such as robust optimization, stochastic programming, and simulation
optimization.
If you are using Risk Solver Platform for the first time, we recommend that you
try out the examples described in the chapter “Examples: Conventional
Optimization” before tackling this material. If you are relatively new to
optimization, you may find it useful to read the first section below, “Elements of
Solver Models,” and then proceed to the Examples chapters. If you’ve been
using the Solver for a while, and you’d like a more in-depth review of the
mathematical relationships found in Solver models, and the optimization
methods and algorithms used by the Solver, read the more advanced sections of
this chapter, and the next chapter.
Evolutionary Solver
The Evolutionary Solver usually finds good solutions to problems where the
objective and constraints include non-smooth or discontinuous functions of the
variables – in other words, where there are no restrictions on the formulas that
are used to compute the objective and constraints. For example, if your model
uses IF, LOOKUP or similar functions of the variables, it’s likely that the graphs
of these functions will contain “jumps” or “breaks.” For this class of problems,
the Solver will return the best feasible solution (if any) that it can find in the
time allowed.
The Evolutionary Solver can be used on problems with all-smooth functions that
may have multiple locally optimal solutions, in order to seek a globally optimal
solution, or simply a better solution than the one found by the nonlinear GRG
Solver alone; however, the Interval Global Solver or the combination of
multistart methods and the GRG Solver are likely to do as well or better than the
Evolutionary Solver on such problems. It can be used on problems with smooth
convex functions, but it is usually less effective and efficient than the nonlinear
GRG Solver on such problems. Similarly, it can be used on problems with all-
linear functions, but there is little point in doing so when the Simplex,
LP/Quadratic, or SOCP Barrier Solver is available.
Semi-Continuous Constraints
It is often useful to place a semi-continuous constraint on a decision variable.
This specifies that, at the solution, the variable must be either 0, or else a
continuous value within a range, determined by the bounds on the variable. For
Alldifferent Constraints
A special type of integer constraint supported by Risk Solver Platform and its
subset products is called an “alldifferent” constraint. Such a constraint is of the
form (for example) A1:A5 = alldifferent, where A1:A5 is a group of decision
variables, and it specifies that these variables must be integers in the range 1 to
N (N = 5 in this example), with each variable different from all the others at the
solution. Hence, A1:A5 will contain a permutation of integers, such as 1,2,3,4,5
or 1,3,5,2,4. The alldifferent constraint can be used to model problems
involving ordering of choices, such as the Traveling Salesman Problem.
Convex Functions
The key property of functions of the variables that makes a problem “easy” or
“hard” to solve is convexity. If all constraints in a problem are convex functions
of the variables, and if the objective is convex if minimizing, or concave if
maximizing, then you can be confident of finding a globally optimal solution (or
determining that there is no feasible solution), even if the problem is very large
– thousands to hundreds of thousands of variables and constraints.
In contrast, if any of the constraints are non-convex, or if the objective is either
non-convex, concave if minimizing, or convex if maximizing, then the problem
is far more difficult: You cannot be certain of finding a feasible solution even if
one exists; you must either “settle for” a locally optimal solution, or else be
prepared for very long solution times and rather severe limits on the size of
problems you can solve to global optimality (a few hundred to perhaps one
thousand variables and constraints), even on the fastest computers. So it pays to
understand convexity!
Geometrically, a function is convex if, at any two points x and y, the line drawn
from x to y (called the chord from x to y) lies on or above the function – as
shown in the diagram below, for a function of one variable. A function is
concave if the chord from x to y lies on or below the function. This property
extends to any number of ‘dimensions’ or variables, where x = (x1, x2, …, xn)
and y =( y1, y2, …, yn).
Algebraically, a function f is convex if, for any points x and y, and any t between
0 and 1, f( tx + (1-t)y ) <= tf(x) + (1-t)f(y). A function f is concave if –f is
convex, i.e. if f( tx + (1-t)y ) >= tf(x) + (1-t)f(y). A linear function – described
below – is both convex and concave: The chord from x to y lies on the line, and
f( tx + (1-t)y ) = tf(x) + (1-t)f(y). As we’ll see, a problem with all linear
functions is the simplest example of a convex optimization problem that can be
solved efficiently and reliably to very large size.
A non-convex function “curves up and down.” A familiar example is the sine
function (SIN(C1) in Excel), which is pictured below.
Linear Functions
In many common cases, the objective and/or constraints are linear functions of
the variables. This means that the function can be written as a sum of terms,
where each term consists of one decision variable multiplied by a (positive or
negative) constant. Algebraically, we can write:
a1x1 + a2x2 + ... + anxn
where the ais, which are called the coefficients, stand for constant values and the
xis stand for the decision variables. A common example is =SUM(C1:C5),
where C1:C5 are decision variables and the ais are all 1. Note that a linear
function does not have to be written in exactly the form shown above on the
spreadsheet. For example, if cells C1 and C2 are decision variables, B1 =
C1+C2, and B2 = A1*B1 where A1 is constant in the problem, then B2 is a
linear function (=A1*C1+ A1*C2).
Geometrically, a linear function is always a straight line, in n-dimensional space
where n is the number of decision variables. On the next page is a perspective
plot of 2x1 +1x2. As noted above, a linear function is always convex.
Remember that the ais need only be constant in the optimization problem, i.e.
not dependent on any of the decision variables. For example, suppose that the
function is =B1/B2*C1 + (D1*2+E1)*C2, where only C1 and C2 are decision
variables, and the other cells contain constants (or formulas that don’t depend on
the variables). This would still be a linear function, where a1 = B1/B2 and a2 =
(D1*2+E1) are the coefficients, and x1 = C1 and x2 = C2 are the variables.
Note that the SUMPRODUCT and DOTPRODUCT functions compute exactly
the algebraic expression shown above. If we were to place the formula =B1/B2
Quadratic Functions
The last two examples of nonlinear functions above, =C1^2 or =C1*C2, are
simple instances of quadratic functions of the variables. A more complex
example is:
=2*C1^2+3*C2^2+4*C1*C2+5*C1
A quadratic function is a sum of terms, where each term is a (positive or
negative) constant (again called a coefficient) multiplied by a single variable or
the product of two variables. In linear algebra notation, we can write xTQx + cx
where x is a vector of n decision variables, Q is an n x n matrix of coefficients,
and c is an n vector of linear coefficients. The QUADPRODUCT function
∂fm/∂x1, ∂fm/∂x2, …,
∂fm/∂xn
This matrix is called the Jacobian matrix. In a linear programming problem,
this is the LP coefficient matrix, and all of its elements (the ais) are constant.
The second partial derivatives of a function f (x1,x2,...,xn) with respect to each
pair of variables xi and xj are denoted ∂2f / ∂xi∂xj. There are n2 second partial
derivatives, and they can be collected into an n x n matrix:
∂2f/∂x1∂x1, ∂2f/∂x1∂x2, …,
∂2f/∂x1∂xn
∂2f/∂x2∂x1, ∂2f/∂x2∂x2, …,
∂2f/∂x2∂xn
…
∂2f/∂xn∂x1, ∂2f/∂xn∂x2, …,
∂2f/∂xn∂xn
This matrix is called the Hessian matrix. It provides second order (curvature)
information for a single problem function, such as the objective. The Hessian of
a linear function would have all zero elements; the Hessian of a quadratic
function has all constant elements; and the Hessian of a general nonlinear
function may change depending on the point (values of the decision variables)
where it is evaluated.
When reading the next section, “Optimization Problems and Solution Methods,”
bear in mind that the different classes of Solver problems, and the computing
time required to solve these problems, is directly related to the nature of the
derivatives (constant, changing, or undefined) of their problem functions, as
outlined above.
For example, because the first derivatives of linear functions are constant, they
need be computed only once – and second derivatives (which are zero) need not
be computed at all. For quadratic functions, the first and second derivatives can
be computed only once, whereas for general nonlinear functions, these
derivatives may have to be computed many times.
Nonlinear Optimization
As outlined above, nonlinear programming (NLP) problems are intrinsically
more difficult to solve than LP, QP, QCP or SOCP problems. They may be
convex or non-convex, and since their second derivatives are not constant, an
NLP Solver must compute or approximate the Hessians of the problem functions
many times during the course of the optimization. Since a non-convex NLP
may have multiple feasible regions and multiple locally optimal points within
such regions, there is no simple or fast way to determine with certainty that the
problem is infeasible, that the objective function is unbounded, or that an
optimal solution is the “global optimum” across all feasible regions. But some
NLP problems are convex, and many problems include linear or convex
quadratic constraints in addition to general nonlinear constraints. Frontline’s
field-installable nonlinear Solver engines are each designed to take advantage of
NLP problem structure in different ways, to improve performance.
If you use the GRG Nonlinear Solver – the only choice for NLPs in the standard
Excel Solver, Premium Solver and Risk Solver Premium – bear in mind that it
applies the same method to all problems, even those that are really LPs or QPs.
If you don’t select another Solver engine from the Task Pane Engine tab
dropdown list box (or, in the standard Microsoft Excel Solver, if you don’t
check the Assume Linear Model box in the Solver Options dialog), this Solver
will be used – and it may have difficulty with LP or QP problems that could
have been solved easily with one of the other Solvers. Risk Solver Platform can
automatically determine the type of problem, and select only the “good” or
“best” Solver engine(s) for that problem.
Global Optimization
Risk Solver Platform and its subset products include powerful tools to help you
find the globally optimal solution for a smooth nonlinear non-convex problem.
These tools include multistart methods, which can be used with the nonlinear
GRG Solver, the Large-Scale GRG Solver, the Large-Scale SQP Solver, and the
KNITRO Solver; an Interval Global Solver in Risk Solver Platform and
Premium Solver Platform that offers powerful interval methods for global
optimization in a commercial software product; and the Evolutionary Solver, for
global solutions of smooth and non-smooth problems.
Non-Smooth Optimization
The most difficult type of optimization problem to solve is a non-smooth
problem (NSP). Such a problem may not only have multiple feasible regions
and multiple locally optimal points within each region – because some of the
functions are non-smooth or even discontinuous, derivative or gradient
information generally cannot be used to determine the direction in which the
function is increasing (or decreasing). In other words, the situation at one
possible solution gives very little information about where to look for a better
solution.
Integer Programming
When a Solver model includes integer constraints (for example A1:A10 =
integer, A1:A10 = binary, A1:A10 = semicontinuous, or A1:A10 = alldifferent),
it is called an integer programming problem. Integer constraints make a model
non-convex, and finding the optimal solution to an integer programming
problem is equivalent to solving a global optimization problem. Such problems
may require far more computing time than the same problem without the integer
constraints.
The standard Microsoft Excel Solver uses a basic Branch & Bound method, in
conjunction with the linear Simplex or nonlinear GRG Solver, to find optimal
solutions to problems involving general integer or binary integer variables. Risk
Solver Premium and Premium Solver use a much more sophisticated Branch &
Bound method that is extended to handle alldifferent constraints, and that often
greatly speeds up the solution process for problems with integer variables. In
Risk Solver Platform and Premium Solver Platform, the LP/Quadratic Solver
uses improved pseudocost-based branch and variable selection, reduced cost
fixing, primal heuristics, cut generation, Dual Simplex and preprocessing and
probing methods to greatly speed up the solution of integer linear programming
problems.
The Evolutionary Solver handles integer constraints, in the same form as the
other Solver engines (including alldifferent constraints), but it does not make use
of the Branch & Bound method; instead, it generates many trial points and uses
“constraint repair” methods to satisfy the integer constraints. (The constraint
repair methods include classical methods, genetic algorithm methods, and
integer heuristics from the local search literature.) The Evolutionary Solver can
often find good solutions to problems with integer constraints, but where the
Branch & Bound algorithm can guarantee that a solution is optimal or is within
a given percentage of the optimal solution, the Evolutionary Solver cannot offer
such guarantees.
Cut Generation
The LP/Quadratic Solver, the Large-Scale LP/QP Solver, Large-Scale SQP
Solver, MOSEK Solver, Gurobi Solver, and XPRESS Solver all make use of
“cut generation” methods to improve performance on integer linear program-
ming problems. Cut generation derives from so-called “cutting plane” methods
that were among the earliest methods applied to integer programming problems,
but they combine the advantages of these methods with the Branch & Bound
method to yield a highly effective approach, often referred to as a “Branch &
Cut” algorithm.
A cut is an automatically generated linear constraint for the problem, in addition
to the constraints that you specify. This constraint is constructed so that it “cuts
off” some portion of the feasible region of an LP subproblem, without
eliminating any possible integer solutions. Many cuts may be added to a given
LP subproblem, and there are many different methods for generating cuts. For
example, Gomory cuts are generated by examining the reduced costs at an LP
solution, while knapsack cuts, also known as lifted cover inequalities, are
generated from constraints involving subsets of the 0-1 integer variables. Cuts
add to the work that the LP solver must perform on each subproblem (and hence
they do not always improve solution time), but on many problems, cut
generation enables the overall Branch & Cut algorithm to more quickly discover
integer solutions, and eliminate branches that cannot lead to better solutions than
the best one already known.
Introduction
You can also set a seed for any specific uncertain variable, using the Seed option
in the Uncertain Variable dialog, or by supplying a PsiSeed() property function
as an argument to the PSI Distribution function call. This means the uncertain
variable will have its own independent stream of random numbers starting from
the given seed, whether or not you’ve set a seed for the whole simulation run.
Sampling Method
In standard Monte Carlo sampling, numbers generated by the chosen random
number generator are used directly to obtain sample values for the uncertain
variables (PSI Distribution functions) in the model. With this method, the
variance or estimation error in computed samples for uncertain functions is
inversely proportional to the square root of the number of trials; hence to cut the
error in half, four times as many trials are required.
Risk Solver Platform provides two other sampling methods than can
significantly improve the ‘coverage’ of the sample space, and thus reduce the
variance in computed samples for output functions. This means that you can
achieve a given level of accuracy (low variance or error) with fewer trials. You
choose this via the Sampling Method option on the Engine tab, shown above.
Latin Hypercube Sampling. Latin Hypercube sampling begins with a
stratified sample in each dimension (one for each uncertain variable), which
constrains the random numbers drawn to lie in a set of subintervals from 0 to 1.
Then these one-dimensional samples are combined and randomly permuted so
that they ‘cover’ a unit hypercube in a stratified manner. This often reduces the
variance of uncertain functions.
Measures of Variation
Risk Solver Platform provides several standard measures of variation:
PsiVariance, which describes the spread of the distribution of values
PsiStdDev for standard deviation, the square root of variance
PsiSkewness, which describes the asymmetry of the distribution of values
PsiKurtosis, which describes the peakedness of the distribution of values
PsiMin, PsiMax, and PsiRange for the minimum and maximum values,
and the difference between them
Quantile Measures
To get a complete grasp of the range of outcomes, it’s essential to look at
quantile measures, such as percentiles and Value at Risk, in addition to
measures of central tendency and variation. Quantile measures allow you to
answer questions such as ‘How much money might we lose, with 5% or 10%
probability?” or “What is the probability that we’ll make at least $100,000?”
based on your simulation model. Risk Solver Platform provides:
PsiPercentile, which provides percentile values from 1% to 99%
PsiTarget, which returns the proportion of values less than or equal to a
target value
PsiBVaR, which measures standard (‘Basel’) Value at Risk
PsiCVaR, which measures Conditional Value at Risk
Confidence Intervals
Every Monte Carlo simulation uses a sample of the possible values of your
uncertain variables; hence any statistic resulting from the simulation involves
some degree of sampling error. For the mean and standard deviation of an
output value, Risk Solver Platform provides functions that help you assess this
error, and estimate the range or interval in which you can be confident that the
true mean or standard deviation lies, at a confidence level that you specify:
PsiMeanCI, which returns a confidence interval for the mean
PsiStdDevCI, which returns a confidence interval for the standard
deviation
PsiCITrials, which returns the number of simulation trials needed to obtain
a confidence interval of a given size, at a given confidence level
n n2 1
Ri Ri1 Ri 2
Ri is the difference between the ranks of observation i
for the two variables
You pass PsiCorrMatrix (matrix cell range, position) as an argument to the PSI
Distribution function, for example =PsiNormal (10,5,PsiCorrMatrix(A1:C3,1))
for the first uncertain variable covered by the correlation matrix. You’d pass
PsiCorrMatrix(A1:C3,2) to the PSI Distribution function for the second variable,
and PsiCorrMatrix(A1:C3,3) for the third. This specifies that the first variable
has a rank correlation coefficient of 0.8 with the second variable, and 0.5 with
the third variable. The second and third variables are correlated with each other,
with a rank correlation coefficient of 0.2.
Note that a correlation matrix must always have 1’s on the diagonal, because an
uncertain variable is always perfectly correlated with itself. Also, the matrix
must be symmetric: If row 2, column 1 contains 0.8, then row 1, column 2 must
also contain 0.8. Finally, the correlation coefficients must be consistent with
each other: For example, if uncertain variable 1 is strongly positively correlated
with variable 2, and variable 2 is strongly positively correlated with variable 3,
then variable 1 cannot be negatively correlated with variable 3. Formally, the
matrix must be positive semidefinite – it cannot have any negative eigenvalues.
Risk Solver Platform tests for this condition, and displays #N/A in the PSI
Distribution cells for the uncertain variables that refer to an inconsistent
correlation matrix.
Analytic Distributions
As described above, and documented in the Reference Guide, Risk Solver
Platform provides a wide range of analytic probability distributions – more than
40 distributions are available, from PsiBernoulli() to PsiWeibull(). Given
knowledge and experience, you can choose and use these distributions in your
simulation models. But as discussed above, this is often the most challenging
part of creating a Monte Carlo simulation model, especially for users with
spreadsheet modeling expertise, but limited math and statistics background.
Moreover, when different end user modelers choose their own analytic
distributions and parameters, they will often create models that cannot be
compared or combined (‘rolled up’), because the relationships between
uncertain variables and functions would not be preserved. In large firms
especially, where different business units must take into account common
uncertainties, a better approach is needed.
Introduction
Risk Solver Platform offers you one unified framework for modeling and
solving optimization problems, with or without uncertainty. Models may
include ‘normal’ decision variables, constraints and an objective, plus uncer-
tainties, recourse decision variables, chance constraints, and recourse
constraints. This chapter seeks to explain this framework, starting from the
basics of Solver models. It assumes only a limited knowledge of optimization –
but if you’ve first read the chapter “Mastering Conventional Optimization
Concepts,” you’ll gain a much deeper understanding from reading this chapter.
Our goal is to find a solution – values for the decision variables in our model –
that satisfies the constraints and that maximizes or minimizes the objective. In
computing the objective and constraints, we use parameters of the model – for
example quantities, distances, shipping costs, interest rates, etc.
Decision-Dependent Uncertainties
In many real-world problems, the uncertainties being modeled are independent
of the decision variables. For example, in a crop planning model where the
acres to plant of different crops are decision variables, and the rainfall in a future
period is an uncertainty, the uncertainty is almost surely independent of the
decisions.
In other real-world problems, the uncertain parameters being modeled are
dependent on the decision variables – they change if the decisions change. For
example, in a market response model that includes competitor actions in a future
period, where your product prices are decision variables, and your competitors’
product prices are uncertainties, it is quite likely that the uncertainties will
depend on the decisions.
In portfolio models where one is investing in publicly traded, large capitalization
stocks, a decision to purchase some number of shares is unlikely to affect the
uncertain future returns on those stocks. On the other hand, a large institution
investing in thinly traded small-capitalization stocks may find that decisions to
purchase a large number of shares may move the market price and impact the
uncertain future returns. So both types of problems arise in practice. As we’ll
see later, the presence of decision-dependent uncertainties has a huge impact
on how, and even whether, our model can be solved.
Uncertain Variables
A certain parameter is easy to model, in a worksheet cell containing a number.
A primitive uncertainty requires a way to specify the range and ‘shape’ of the
values it can assume. In Risk Solver Platform, we model primitive uncertainties
as uncertain variables in worksheet cells that contain special add-in functions.
For example:
Decision Variables
Conventional optimization deals with only one type of decision variable, which
represents a decision that must be made ‘here and now,’ irrespective of any
uncertainty in the model. We call this a normal or first-stage variable.
If we are dealing with uncertainty that will be resolved in the future, then at
some point the array of sample values for the uncertainty is effectively replaced
by a single value, the realization of the uncertainty as it actually occurs.
If the situation we are modeling allows us to make certain decisions after the
uncertainty becomes known, on a ‘wait and see’ basis, we can model these
decisions with recourse variables, also called second-stage variables. (At the
‘second stage,’ the uncertainty has become known.)
This is one form of a chance constraint; the criterion that it must be satisfied for
all realizations of the uncertainties up to a given percentile (say 95%) makes it a
VaR (Value at Risk) constraint. We write this constraint as VaR 0.95 A1 <= B1.
Risk Solver Platform supports two other criteria besides VaR that may be better
choices for many models.
A chance constraint includes:
A left hand side that depends on decision variables and uncertainties.
A relation that must be either <= or >=. (A chance constraint can’t be an
equality. Note however that a recourse constraint can be an equality.)
A right hand side that should be constant in the problem (if the RHS
depends on decision variables or uncertainties, Risk Solver Platform
converts LHS <= RHS into the form LHS – RHS <= 0).
A criterion that may be VaR (Value at Risk), CVaR (Conditional Value at
Risk), or USet (Uncertainty Set). These criteria are discussed below.
A measure that may be a percentile 0.01 – 0.99 for VaR or CVaR, or a
‘budget of uncertainty’ (any positive value) for USet.
Decision-Dependent Uncertainties
As described in the Introduction section, in many real-world problems, the
uncertain variables being modeled are independent of the decision variables. In
other real-world problems, the uncertainties are dependent on the decision
variables – they change when the decision variables change.
The methods of stochastic programming (SP) were created, more than fifty
years ago, to deal with problems where the uncertainties are independent of the
decisions. Much more recently, methods of robust optimization (RO) were
created, also to deal with problems where uncertainties are independent of the
decisions. Most methods in the SP and RO literature cannot be applied to
problems where the uncertainties are dependent on decision variables. But
where they can be applied, these methods are scalable to large models, and they
generally yield optimal solutions.
The methods of simulation optimization were created, also more than fifty years
ago, to deal with problems where the uncertainties may be dependent on the
decisions. This dependence makes the problem much harder to solve. Where
SP and RO methods often are based on linear programming and conic
optimization, simulation optimization is usually based on methods such as
genetic and evolutionary algorithms, and tabu and scatter search. These
methods are more flexible and general – but they require far more solution time,
are generally not scalable to large models, and yield only ‘improved’ solutions,
not optimal solutions.
Two-Stage Problems
Two-Stage Linear Programming Problems
A very common case is a two-stage stochastic linear programming problem:
The objective and constraints depend linearly on the decision variables.
The uncertain variables are independent of the decision variables.
The problem includes both normal decisions and recourse decisions.
The problem may or may not include chance constraints.
The presence of recourse decisions in the problem implies that at least some
(and usually all) of the uncertainty will be resolved over the horizon of interest.
Hence the problem is called ‘two-stage,’ where the normal decisions are made at
the first stage – before the uncertainties are resolved – and the recourse
decisions are made at the second stage – after they are resolved. The Solver
must find single values for the normal variables, and multiple values for the
recourse variables (for each realization of the uncertainties) that satisfy the
constraints and optimize the objective.
We cannot solve this problem with conventional simulation optimization
methods, because these methods have no concept of recourse decisions. But
since the problem is linear, we can use either stochastic programming or
robust optimization methods – and with these methods we can solve much
larger models, hundreds of times faster than with simulation optimization. In
the Task Pane Platform tab, we set the Optimization Model group option Solve
Uncertain Models to Stochastic Transformation, and we set the Transformation
group option Stochastic Transformation to either Deterministic Equivalent or
Robust Counterpart. When we click Optimize, the transformed model is created
and solved.
If we choose the ‘Determ Equivalent,’ we can place integer constraints on the
normal and recourse variables (though this may make the model more difficult
to solve). But the model cannot include chance constraints, and the transformed
model may become quite large (its size depends on the product of the number of
recourse variables and constraints, and the number of simulation trials).
If we choose the ‘Robust Counterpart’, the model can include chance
constraints, and the transformed model will be significantly smaller and solve
faster than if we choose ‘Determ Equivalent.’ But we cannot place integer
constraints on the recourse variables, and the solution may be more conservative
than with ‘Determ Equivalent.’
Advanced Topics
Bounds, Discretization, and Correlation
An uncertainty specified via a probability distribution such as PsiUniform(0,1)
has finite bounds of 0 and 1, but it has a practically infinite set of possible values
between 0 and 1; we can only consider a sample of the possible values during an
optimization. An uncertainty specified via PsiNormal(0,1) has infinite bounds,
as well as an infinite set of possible values. In practice, however, most of the
probability mass of the Normal distribution lies within three standard deviations
on either side of the mean, and a reasonable sample of values from the Uniform
and Normal distributions can be used for computations.
Risk Solver Platform uses Monte Carlo simulation to generate samples of
uncertainties, based on the probability distributions specified by the user. It uses
the minimum and maximum values for each distribution obtained during the
simulation as ‘effective’ lower and upper bounds, which are used in constructing
the robust counterpart to an uncertain model.
When Risk Solver Platform solves a stochastic LP (as explained above) by
forming the ‘deterministic equivalent’ problem, the Monte Carlo trials are used
L2 Norm
D Norm
Introduction
It’s a maxim that a successful Solver model will grow in size over time. When
the initial results from an optimization model demonstrate ways to achieve
significant cost savings, improved schedules, higher quality or increased profits,
management is naturally interested in applying these methods to bigger
problems. This might involve extending the model to include more plants,
warehouses, assembly lines, or personnel; to bring in other divisions or
geographic regions; or to cover more time periods, more detailed process steps,
or more specific parts or products. The result is an increase in the number of
decision variables, constraints, and cells in your model.
When your model grows in size, it becomes more challenging to design and
maintain, and also more challenging to solve. Good modeling practices –
touched upon in the chapter “Examples: Conventional Optimization” – become
far more important, so your model remains comprehensible to other Excel users,
auditable for errors, and easy to modify. Issues such as your model type (LP,
QP, QCP, SOCP, NLP or NSP), sparsity, and scaling also become far more
important, since they strongly influence the time it takes to solve your model,
and the reliability of the solutions you obtain.
This chapter can only briefly survey good modeling practices – entire books
have been devoted to this subject (we will recommend some). It focuses on
steps you can take to obtain faster and more reliable solutions for large models
using the Premium Solver and Premium Solver Platform, including:
Steps towards better performance that are easy to apply in most situations
Steps you can take – with more design and modeling effort – to improve the
formulation of your model, by replacing non-smooth or nonlinear
constraints with linear (or integer linear) constraints
Steps you can take to enable Premium Solver (and in some cases, Premium
Solver Platform and Risk Solver Platform) to analyze your model more
efficiently
Quadratic Approximations
If you cannot represent the entire problem using linear functions of the
variables, try to formulate it as a quadratic (QP) or quadratically constrained
(QCP) problem, with a quadratic objective and/or constraints. You may be able
to use a local, quadratic approximation to a smooth nonlinear function f near a
point a:
f (x) f (a) + f ´(a)(x - a) + ½ f ´´(a)(x - a)2
where f ´(a) denotes the first derivative, and f ´´(a) denotes the second derivative
of the function f at the point a. Several Solver engines offer excellent
performance on QP problems, and the SOCP Barrier Solver and the MOSEK
Solver offer good to excellent performance on QCP problems.
Even if you cannot eliminate nonlinear functions from your problem altogether,
you can improve solution time by making an effort to ensure that as many
variables as possible occur linearly in the objective and all of the constraints. If
you’re using the GRG Solver, you can set its Engine tab option Recognize
Linear Variables to True, to save time during the solution process. And the
Large-Scale GRG Solver and Large-Scale SQP Solver engines also recognize
both linearly occurring variables and linear constraints automatically, for still
faster solutions. The Large-Scale SQP Solver is particularly effective when
used with Premium Solver Platform or Risk Solver Platform, because it uses the
Fixed-Charge Constraints
You may have a quantity x in your model that must “jump” from zero to some
(fixed or variable) non-zero value, under certain conditions. For example, a
machine on a production line may have a fixed setup time or cost if it is used at
all, plus a time or cost per unit produced. You can avoid creating a non-smooth
function for x by introducing a binary integer variable y (which is 1 if x is used
and 0 if it isn’t), and adding a constraint x <= My, where M is a constant that is
larger than any possible value for x.
For example, suppose you have a machine that has a setup time of 10 minutes,
but once set up will process a widget every 30 seconds. Let cell C1 hold the
number of widgets you are producing on this machine, and use cell E1 for a
binary integer variable y that is 1 if you produce any widgets on this machine.
Then the total production time can be computed as =0.5*C1+10*E1. Assuming
that C1 can be at most 10,000, let M1 = 10000 and add a constraint:
C1 <= M1*E1 (or C1 – M1*E1 <= 0)
If variable C1 is nonnegative (C1 >= 0) and variable E1 is binary integer (E1 =
binary), then C1 is forced to be 0 whenever E1 is 0, or equivalently E1 is forced
to be 1 whenever C1 is greater than 0. Since the production time calculation and
the constraint are both linear functions, you can solve the problem with the
Simplex (or LP/Quadratic) Solver and the Branch & Bound method. This is
called a fixed-charge constraint.
You can sometimes use a semi-continuous variable to model this kind of
situation, instead of a binary variable, continuous variable, and “Big M”
constraint. At the optimal solution, a semi-continuous variable must either be
zero, or must lie within a specified continuous range. This is usually even more
efficient than using a fixed-charge constraint as outlined above.
Either-Or Constraints
Constraints in an optimization problem are implicitly connected by the logical
operator AND – all of them must be satisfied. Sometimes, however, your model
may call for either one constraint (say f(x) <= F) or another constraint (say g(x)
<= G) to be satisfied. You might consider using the OR function in Excel, but
as noted in the chapter “Mastering Conventional Optimization Concepts,” this
IF Functions
In the chapter “Mastering Conventional Optimization Concepts,” we used
=IF(C1>10,D1,2*D1), where C1 depends on the decision variables, as an
example of a non-smooth function: Its value “jumps” from D1 to 2*D1 at
C1=10. If you use this IF function directly in your model, you’ll either have to
try the Task Pane Platform tab Nonsmooth Model Transformation option, or
solve the model with the Evolutionary Solver. Instead, you can avoid the IF
function and solve the problem with the nonlinear GRG Solver – or even the
linear Simplex Solver – by introducing a binary integer variable (say E1) that is
1 if the conditional argument of the IF is TRUE, and 0 otherwise. Add the
constraints:
C1 – 10 <= M1*E1
10 – C1 <= M1*(1–E1)
When E1 is 0, the first constraint forces C1 <= 10, and the second constraint has
no effect. When E1 is 1, the first constraint has no effect, and the second
constraint forces C1 >= 10. (If C1=10 exactly, this formulation allows either
E1=0 or E1=1, whichever one yields the better objective.) The value of the IF
function can then be calculated as D1*E1 + 2*D1*(1-E1), which simplifies to
D1*(2-E1) in this example. If D1 is constant in the problem, this is a linear
function; if D1 depends linearly on the variables, it is a quadratic; otherwise, it is
smooth nonlinear. In all cases, the non-smooth behavior has been eliminated.
Depending on how you use the result of the IF function in the rest of your
model, you may be able to take this strategy further. Suppose, for example, that
if f(x) >= F then you want to impose the constraint g(x) <= G; if f(x) < F then
you don’t need this constraint. You can then use a binary variable y (cell E1 in
the example above), and impose constraints like the pair above plus an
additional constraint on g(x):
f(x) – F <= My
F – f(x) <= M(1-y)
The three prices (slopes of the line segments) are c1, c2 and c3. V1 represents a
fixed initial cost; V2 and V3 are also constant in the problem and can be computed
from:
V2 = V1 + c1*B1 - c2*B1
V3 = V2 + c2*B2 - c3*B2
In the model, the variable x is replaced by three variables x1, x2 and x3,
representing the quantity ordered or shipped at each possible price. Also
included are three 0-1 or binary integer variables y1, y2 and y3. Since you want to
minimize costs, the objective and constraints are:
Minimize V1*y1 + V2*y2 + V3*y3 + c1*x1 + c2*x2 + c3*x3
Subject to x1 B1*y1, x2 B2*y2, x3 B3*y3
If the cost curve is concave as shown above, this is sufficient; but if the function
is non-concave (it may vary up and down), additional “fill constraints” are
needed:
y1 + y2 + y3 1
x1 B1*y2
x2 B2*y3
j=1
The SUMPRODUCT function corresponds to the summation expression above
for one constraint. The entire set of five constraint formulas could be defined
with the array form of the DOTPRODUCT function (described in detail later in
this section). In EXAMPLE1, you would select cells C11 to C15 and “array-
enter” the following formula:
{=DOTPRODUCT(D9:F9,D11:F15)}
The braces above are not typed, but they appear when you “array-enter” the
formula by pressing CTRL-SHIFT-ENTER instead of just ENTER. If you
aren’t familiar with array formulas in Microsoft Excel, you can read about them
in Excel’s online Help. They are one of the most useful features of Microsoft
Excel.
If your LP model is “dense” and regular in form rather than “sparse,” you may
wish to consider use of Microsoft Excel’s matrix built-in functions, such as
MMULT which (when array-entered into a group of cells) yields the matrix
product of its two operands. For example, the five constraints in EXAMPLE1
could be written in vector-matrix form as:
Ax <= b
where A is the matrix of coefficients, x is the vector of decision variables and b
is the vector of constraint right hand sides. In the Microsoft Excel formula
language, the left hand side of this expression could be written as:
{=MMULT(_A,TRANSPOSE(_X))}
(The TRANSPOSE function is needed only to “match up” the orientation of the
matrix _A with the row vector _X.) In worksheet EXAMPLE1, if you insert
defined names _A for the coefficients D11:F15 and _X for the variables D9:F9,
then select cells C11:C15 and array-enter the above formula, it will compute the
values of all five constraints.
The PSI Interpreter in Premium Solver Platform and Risk Solver Platform
recognizes most kinds of array formulas supported by Microsoft Excel. But (for
rather technical reasons) the use of array formulas actually involves a speed
disadvantage in the PSI Interpreter when the coefficients are extracted via
automatic differentiation.
If you’re using Premium Solver Platform and Risk Solver Platform, we
recommend that you use array formulas where they make sense, and focus on
making your model simple and easy to maintain. In a large model, you’ll
probably find that you want or need to use multiple tabular areas for the
formulas that define your constraints, and it may be inconvenient or impractical
to define entire constraint left hand sides with functions like MMULT and
TRANSPOSE.
Using DOTPRODUCT
DOTPRODUCT is a generalized version of the Excel function SUMPRODUCT,
and it is very useful for defining the objective function and constraints of linear
programming problems. DOTPRODUCT is also recognized for fast problem
setup as described above, provided that you follow the rules outlined earlier:
Your formula must consist only of =DOTPRODUCT(cell reference, cell
reference) where all of the cells in one of the cell references are decision
variables, and all of the cells in the other cell reference are constant in the Solver
problem. Each cell reference must be either an individual selection or a defined
name, but the cell ranges specified by the two arguments need not have the same
“shape” (row, column, or rectangular area).
For use in Excel and for purposes of fast problem setup, DOTPRODUCT will
accept defined names that specify multiple selections for either of its arguments.
For example, if you had designed a model where the decision variables
consisted of several rectangular cell selections, you could still calculate the
objective function for your model with one call to DOTPRODUCT.
DOTPRODUCT always processes its arguments in column, row, area order – in
an individual selection it reads cells across columns, wrapping around to
subsequent rows, and in a multiple selection it reads the individual cell
selections in the order in which they are listed. For example, the formula:
=DOTPRODUCT(A1:C2,D1:D6)
will calculate as =A1*D1+B1*D2+C1*D3+A2*D4+B2*D5+C2*D6.
Using QUADPRODUCT
The QUADPRODUCT function can be used to define the objective for
quadratic programming problems in a single function call, as required for fast
problem setup.
As explained in “Quadratic Functions” in the chapter “Mastering Conventional
Optimization Concepts,” a quadratic function is a sum of terms, where each term
is a (positive or negative) constant (called a coefficient) multiplied by a single
variable or the product of two variables. This means that in order to represent
the most general quadratic function, we might have a coefficient for each
instance of a single variable, and a coefficient for each possible pair of two
variables. The QUADPRODUCT function is designed to supply coefficients for
each single variable and each pair of variables, in a manner similar to
SUMPRODUCT and DOTPRODUCT.
You supply the arguments of QUADPRODUCT as shown below:
=QUADPRODUCT(variable cells, single coefficients, pair coefficients)
The first argument must consist entirely of decision variable cells. The second
and third arguments must consist entirely of cells whose values are constant in
the optimization problem; if these cells contain formulas, those formulas must
not refer to any of the decision variables. The second argument supplies the
coefficients to be multiplied by each single variable in the first argument, using
an element-by-element correspondence. The third argument supplies the
coefficients to be multiplied by each pair of variables drawn from the first
argument. Hence, if there are n cells in the first argument, there must be n2 cells
in the third argument. If the variables are represented by x1,x2,...,xn, the single
coefficients by a1,a2,...,an, and the pair coefficients by c1,c2,...,cN where N = n2,
QUADPRODUCT computes the function:
Introduction
Although this Guide provides many valuable hints for making effective use of
Risk Solver Platform, it does not attempt to teach you everything about
optimization, Monte Carlo simulation, and stochastic optimization. We strongly
recommend that you consult one of the books cited below, or discuss your
problem with a knowledgeable consultant at Frontline Systems, at a nearby
university, or at a firm specializing in optimization and simulation methods.
There’s a vast literature on problems of various types and for various industries
and business situations that have been solved successfully with the methods
available in the Solver. Don’t reinvent the wheel – find out how others have
solved problems similar to yours!
You may also want to attend a training seminar on risk analysis and
simulation, optimization, and other advanced techniques in Excel, presented by
Frontline Systems instructors or consultants who work closely with us. For
current information on training seminars, visit www.solver.com or contact us at
[email protected].