imit_model / AnyLogic / UsersManual(AnyLogic)
.pdf
AnyLogic V User’s Manual
If the optimization engine cannot find any feasible solutions, you should check the constraints for feasibility and fix the inconsistencies of the relationships modeled by the constraints.
16.3 Optimization settings
To enable optimization, you must ensure that each simulation ends. By default, a simulation never ends; therefore the optimization engine gets no samples of the objective function. To ensure that each simulation ends, you must define a simulation stop condition (see section 13.3, “Simulation stop conditions” for details). Note that a simulation may involve several replications. A sample of the objective function is the result of a simulation rather than a replication.
In general, a simulation stop condition should be specified in such a way that the value of the objective function is significant when simulation stops. The model should be stable, transient processes should be finished, and statistics should be representative.
Optimization can stop under two circumstances: the maximum number of simulations is exceeded or the value of the objective function stops improving. The latter is also known as automatic stop. You can use either of these conditions to stop an optimization. If more than one condition is specified, optimization stops when the first condition is satisfied.
Set up these settings of an optimization process using the OptQuest settings dialog.
►To open the OptQuest settings dialog
1.Click the optimization experiment in the Project window.
2.In the Properties window, click the Settings button.
The OptQuest settings dialog box is displayed, see Figure 162.
© 1992-2004 XJ Technologies http://www.xjtek.com |
367 |
AnyLogic V User’s Manual
16.4 Running the optimization
After you set up the optimization, you are ready to run it. This involves the following steps:
•Start the optimization
•Observe the status
•Determine the best solution
If desired, you can pause the optimization while it is running. This section describes how you can control running the optimization.
►To start the optimization
1.Set the optimization experiment as a current experiment.
2.Click the Run
toolbar button, or Choose Model|Run from the main menu.
This starts the optimization process and opens the Optimization window as shown in Figure 163.
© 1992-2004 XJ Technologies http://www.xjtek.com |
369 |
AnyLogic V User’s Manual
Store best solution in simulation – the button stores the best found solution in a simulation experiment.
The chart in the Optimization window illustrates the progress of the optimization. The X- axis represents simulations, and the Y-axis represents the best value of the objective function found for each simulation.
The table above the chart displays information about optimization parameters. The table includes the following information:
Parameter – name of the optimization parameter.
Best – parameter value corresponding to the best solution found.
Current – value used in the current simulation.
The values in the column Best form the best solution found up to the current time. Once optimization has finished, this solution is considered to be optimal. The best value of the objective function shown as Best objective found corresponds to this optimal solution.
►To stop the optimization
1.Click the Stop
toolbar button, or Choose Model|Stop from the main menu.
You can suspend optimization and examine the model using various windows and commands, as described in Chapter 11, “Running and observing a model”. This becomes useful if you want to examine precisely how the model performs under the current set of optimization parameters. You can even modify some parameters; keep in mind that those modifications affect the current simulation only.
►To suspend optimization
1.Click the Pause
toolbar button, or Choose Model|Pause from the main menu.
When suspended, you can resume optimization or debug it by running the model step-by- step.
© 1992-2004 XJ Technologies http://www.xjtek.com |
371 |
AnyLogic V User’s Manual
Be careful when using the Automatic stop option. In the case of an optimization jam, (i.e., when the objective function is changing too slowly), it is possible that optimization will stop long before the real optimal solution is found. If you encounter this problem, decrease the objective function precision, suggest other parameter values, or do not use Automatic stop.
►Find an optimal solution faster
•Adjust the OptQuest Engine settings for your problem. Fine-tuning these settings can increase optimization performance (for more information, please consult AnyLogic Class Reference):
•Suggest initial values for optimization parameters as close to the optimal value as possible
•Reduce the search space by specifying ranges for optimization parameters
•Exclude parameters that do not influence the objective function
•Avoid using constraints. First, optimize your model without constraints; then check the optimal solution for constraints. If some constraints are not satisfied, start optimizing with constraints.
•Solve the optimization problem interactively and iteratively:
1.Initially, use a rough approximation of the problem: wide ranges, big steps, low precisions.
2.Run the optimization until the best-found value starts changing slowly.
3.Set up the optimization more precisely. Reduce ranges and steps of optimization parameters. Start with optimization parameter values obtained on the previous step.
4.Run the optimization until the best-found value starts changing slowly. If you are satisfied with the results, stop the optimization. Otherwise, go back to step 3.
►Speed up simulation
•Make sure the model runs in virtual time rather than in real time. See section 13.1, “Simulation speed” to know how to set virtual time mode.
•Keep the simulation stop simple, see section 13.3, “Simulation stop conditions”.
© 1992-2004 XJ Technologies http://www.xjtek.com |
373 |
AnyLogic V User’s Manual
17. Collecting data and performing statistical analysis
AnyLogic supports collecting and visualizing data during model execution.
The data is collected in AnyLogic datasets. It can be collected explicitly by adding data by user or implicitly by collecting data on variables during the model execution. The collected data is visualized in chart windows and AnyLogic animation.
AnyLogic also supports the statistics block for analyzing data: calculating statistical information on datasets, such as mean value, minimum, maximum, etc. Collected statistics can be exported to external applications.
17.1 Collecting data in datasets
AnyLogic supports datasets – objects that help you to collect, display, and analyze data during model execution.
A dataset has three main elements:
•Array of 2D data points of a finite size,
•Array of intervals where sample hits are counted (for histograms and Gantt charts),
•A block of statistical data for all data ever added to the dataset.
Each data point of a dataset has two values: x and y. The y-value is usually a sample of some observable of a model. Depending on the dataset, the x-value can represent one of the following (see Figure 164):
•Sample number – for a non-timed dataset that records y-value samples.
•Logical time – for a timed dataset that records how the y-value changes over time.
•Another observable – for a phase dataset that records pairs of arbitrary samples showing how some y-value changes depending on some x-value.
© 1992-2004 XJ Technologies http://www.xjtek.com |
375 |

toolbar button, or Choose
toolbar button, or Choose
toolbar button, or Choose
toolbar button, or Choose
toolbar button, or Choose 