Soft Constraints and Penalty Functions
Soft Constraints are conditions that are desirable to satisfy as much as possible, but that can be somewhat violated as a compromise to improve the target value. When a soft constraint is violated, a penalty is attached to the target. The amount of penalty is determined by a “penalty function” that is specified when defining the constraint, and generally grows larger and large the more in violation of the constraint the solution is.
RISKOptimizer has a default penalty function that is displayed when a soft constraint in entered. However, this can be replaced with any valid Excel formula. Any penalty function should include the keyword DEVIATION. This “placeholder” represents the absolute amount by which the constraint value is beyond its limit. For each trial solution, RISKOptimizer checks whether the soft constraint has been satisfied; if not, it places the amount of deviation in the penalty formula and then calculates the amount of penalty to apply to the target cell value.
For example, imagine a soft constraint A1 < 100 which uses the default penalty function
=100*(EXP(DEVIATION/100)-1)
If A1 is the value 125, the constraint is a magnitude of 25 beyond the constraint limit, and thus the applied penalty will be
=100*(EXP(25/100)-1)
For a total penalty of 28.40. This penalty amount is either added to (for minimization) or subtracted from (for maximization) the target cell value.
When a penalty is applied to the target cell due to an unsatisfied soft constraint, you can see the amount of penalty applied in the RISKOptimizer Watcher. In addition, penalty values are shown in Optimization Log worksheets, created optionally after optimization.
Please note: If a solution is placed in the worksheet at the end of an optimization, the calculated target cell result shown in the spreadsheet will not include any penalties applied due to unsatisfied soft constraints. Check the Optimization Log worksheet to see the penalized target cell value and the amount of penalty imposed due to each unsatisfied soft constraint.