Page 704 - ExtendSim User Guide

P. 704

```
678 Analysis
Optimization
// maximizes when equation equals constant
MaxProfit = 1.0 - RealAbs(1.0 - equation/K);
Note that the RealAbs(x) function returns the positive absolute
value of x.
For the case where the equation should approach zero, the form would be:
// this becomes maximum when equation equals zero
MaxProfit = ConstantValue - RealAbs(equation);
In this case, ConstantValue should be small, but large enough so that most of the population MaxProfit results are initially positive. If ConstantValue is too small, the convergence calcula- tion will fail because there will be both negative and positive values in the final population results. If ConstantValue is correct, all of the values will tend to become positive as the system converges, and the convergence calculation will then be valid. If ConstantValue is too large, the convergence calculation will tend to be insensitive and high all of the time, causing a pre- mature end of the optimization run.
These techniques can be adapted to solve any “approaching a constant” type of problem.
Run Parameters tab
In most cases, clicking the default buttons for the type of model you are optimizing (random or non-random) will quickly set all of the parameters in this tab to useful values.
Two of the parameters are especially important to convergence of the optimization:
• MaximumSamplesperCase:Themaximumnumberofrunsaveragedtogetamember result. For non-random models, this should be 1. For random models, this needs to be high enough to get a useful mean value at the expense of run time. The Optimizer block starts the number of samples at 1 and increases them with each generation until it reaches the maxi- mum. Sometimes it is useful to reduce the maximum number of samples (possibly to 5), to get a rough idea of the best solution without spending too much time running samples. Most of the time, a useful result will occur and, even if it is not the optimum one, it will be close.
• Terminateifbestandworstwithin(percent):Thisvalueisusedtoexaminethecurrent population of results to see if they are within a specified percentage of each other. The default of 0.99 might not be high enough for a precise answer in a noisy model. Increasing this value (i.e. 0.9999) will cause the optimization to continue until the population converges more closely, increasing the likelihood of a more optimum answer at the expense of run time.
Constraints
When building a model, there are almost always some parameter constraints that have to be satisfied. The two types of constraints are individual constraints and global constraints. The Optimizer block makes it easy to apply virtually any kind of constraint to a model’s parameters.
Individual constraints
Individual constraints are used to change a decision variable’s value if the value has to be lim- ited or if it depends on the values of other decision variables. These constraints are entered as equations, usually with IF or IF-ELSE statements. For example:
if (NumQueueSlots > 7)
How To
```