Running an Optimization Within a SubModel

One of the applications for a SubModel is to carry out a dynamic optimization (i.e., at specified times) during a simulation.  For example, imagine a situation where you were simulating the operation of a facility over a period of one year.  Every month, the operators make a decision based on the current state of the system.  This decision is based on a simple optimization analysis using currently available data (i.e., at every simulated month during the simulation). The optimization chooses the optimum values of a few control variables that they will use for the next month.

To represent this in GoldSim, you would need to specify the Solution Type for the SubModel as "Optimization", and the SubModel itself would represent the optimization calculations carried out by the simulated operator.

   Note: If a SubModel is set to carry out an optimization, it cannot contain any Spreadsheet elements.

When you select "Optimization" for the Solution Type, GoldSim enables optimization for the SubModel and immediately switches to the Optimization tab for the SubModel:

This is the standard optimization dialog that is also used for stand-alone models, and is described elsewhere in detail.

Several points regarding use of this dialog for SubModel optimization, however, are worth noting:

   Optimization Variables can be defined in terms of variables that are outside of the SubModel. That is, initial values, upper bounds and lower bounds for Optimization Variables can be defined in terms of a variable that is placed on the input interface to the SubModel.

   In most cases, all of the Optimization Variables themselves (and perhaps the Objective Function) should be placed on the output interface to the SubModel (since the purpose of the SubModel is typically to determine these variables). When running an Optimization in a SubModel, the only applicable result type is Final Value.  At the end of the optimization, the SubModel outputs the final (optimized) values of the Optimization Variables.

   Optimizations can sometimes fail or may be unable to converge.  GoldSim provides different types of error messages when carrying out optimizations.  If an optimization of a SubModel fails, a fatal warning message will be displayed (and the simulation is halted).  If the optimization completes, but cannot fully converge, a message will be written to the run log (but the simulation will not be halted).

Related Topics…

Learn more about: