Optimization Constraints

Figure 1 - Adjustable Cell Range Constraints

The Constraints table contains additional conditions that must be satisfied for a solution to be valid. Each constraint in the model is shown in its own row of the table. Constraints are configured in the Constraints Settings window. See below for more information.

To add a constraint, click the Add button to the right of the Constraint table.

To edit an existing constraint, highlight it by selecting its checkbox in the Constraint table and click the Edit button.

For each constraint in the model, the following information is displayed:

  • Check boxes - Each constraint has a check box to its left. This box controls if RISKOptimizer will actually use this constraint during the optimization process. By unchecking this box, that constraint will be ignored.
  • Description – A brief description of the constraint.
  • Formula – A mathematical description of the constraint.
  • Type – Specifies the type of constraint - Hard or Soft.

Configuring Constraints

Figure 2 - Constraint Settings - One Sided Entry

Figure 3 - Constraint Settings - Two Sided Entry

Figure 4 - Constraint Settings - Formula Entry

The Constraints Setting dialog (Figure 2 and 3, right) contains options for specifying conditions that must be met for an optimization trial solution to be considered valid.

The Entry Style button controls the overall format of this dialog. The One-Sided (Figure 2, right) and Two-Sided (Figure 3, right) entry styles are very similar, while the Formula entry style is quite different.

One-Sided and Two-Sided Constraint Entry

In these styles, constraints are entered by specifying one more cells to constrain, the values they should be constrained by, and various options that specify how and when the constraints are evaluated.

The One-Sided and Two-Sided methods of configuration include the following settings: 

  • Range to Constrain – Specifies the cell or cells that must meet a condition.
  • Constraining Value(s) – Specifies the value or values to which the Range to Constrain field must be restricted. A number, a cell, or a range of cells can be entered; a range with multiple cells will specify a different bound for each cell in the Range to Constrain. In the two-sided format, there can be both an upper and lower bound specified. In the one-sided format, only one bound will be available.
  • Constrain – Specifies whether the values of the cells in the Range to Constrain are being tested, or alternatively if particular simulation statistics of the cells in that range are the target of the constraint.
  • One use for the 'Value' option is when it is necessary or desirable to constrain a cell that has a fixed value during each simulation. For example, adjustable cells could contain monetary amounts to spend on different items in an advertising budget (TV ads, Internet ads, etc.) It may be necessary to specify that the total should not exceed a given budget, and that can be done by constraining the value of the cells that adds the amounts in the different categories.

    Another situation where the 'Value' option could be chosen is when the constrained cell involves @RISK statistics functions, like RiskMean or RiskStdDev. This method is especially useful when it is desirable to constrain a statistic not included in the drop-down list. For example, an investor might want to constrain the Sharpe ratio of a portfolio of securities, defined in terms of the mean and standard deviation of the portfolio returns. If the portfolio return (the uncertain quantity) is in cell F10 and the riskfree rate of return is in cell F3, an appropriate formula for the Sharpe ratio is:

    =(RiskMean(F10) – F3) / RiskStdDev(F10)

    If this formula is in cell F12, say, then the 'Value' option for cell F12 should be selected to constrain the Sharpe ratio.

In the Formula entry style of a constraint, any Excel formula can be specified as a constraint.

For example, the formula

=IF(A1>100, B1>0, B1<0)

is a constraint that requires the value in cell B1 to be positive or negative depending on the value in cell A1. Alternatively, the formula can be entered in a cell; if that cell is C1, for example, then you can enter =C1 in the Formula field of the Constraint Settings dialog.

In general, entering constraints in the One-Sided or Two-Sided style helps RISKOptimizer find the optimal solution faster. Only use the Formula entry method in cases where it is not possible to use the other entry styles. The formula discussed above could be entered in cell D1 as:

=IF(A1>100, B1, -B1)

Then a simple One-Sided constraint can be added, requiring that D1>0.

Advanced Constraint Options

Figure 5 - Constraint Settings - Advanced Options

Clicking the 'More' button at the bottom of the Constraint Settings window opens a set of more advanced constraint options. These settings are: 

  • Description – Text that can be used to make the constraint more readable.
  • Constraint Type – RISKOptimizer supports two types of constraints.
    • Hard- Hard constraints are conditions that must be satisfied for a trial solution to be valid. Trial solutions that do not satisfy hard constraints are discarded.
    • Soft - Soft constraints are conditions that would be preferable to satisfy, but can be violated at a certain “penalty” cost. This penalty cost is subtracted from or added to the target value to discourage invalid solutions.
    • See Soft Constraints and Penalty Functions for more information.
  • Precision – Specifies RISKOptimizer’s tolerance to violations of constraints that are so small that they do not make solutions invalid. This small imprecision in the handling of constraints relates to the fact that computers can only handle mathematical operations with finite precision.
  • Typically this field should be left in 'Automatic' mode which will use internal heuristics to handle these round-off error problems. But alternatively, a specific tolerance threshold can be specified.

  • Evaluation Time – When a constraint refers to the value of cells (instead of a Simulation Statistic) it might be necessary to control when the constraint is evaluated. The options are:
    • Automatic - RISKOptimizer decides when to evaluate the constraint based on the context.
    • Iteration Constraint - RISKOptimizer evaluates the constraint every iteration of a simulation.
    • Simulation Constraint – RiskOptimizer evaluates the constraint at the end of each simulation.

Constraints for Efficient Frontier Analysis

To perform an Efficient Frontier Analysis, it is necessary to specify a special type of constraint with multiple alternative “constraining values.” To do this, first configure the model to be an efficient frontier model; see Efficient Frontier Analysis for more information.

Figure 6 - Efficient Frontier Constraint

Once a model has been appropriately configured, extra options appear in the constraint dialog (Figure 6, right).

  • Use for Efficient Frontier – Specifies that this constraint is the special constraint to be used in an efficient frontier analysis. There must be exactly one such constraint to run this type of analysis. When this option is checked, the following options will appear:
    • List of Constraining Values - Specifies how the list of values will be entered. For example, suppose the desired list contains the following list of constraining values: 0.08, 0.085, 0.09, 0.095, 0.10. This can be specified using a min-max range containing 5 values between 0.08 and 0.10. Alternatively, these same values can be entered in a table, or as a reference to an Excel range.
    • Minimum and Maximum Values
    • # of Values (Including Min and Max)