Enhancements to Optimizer in Analytica 4.0
(Back to What's new in Analytica 4.0?)
Selecting an external engine
The functions LpDefine, QpDefine, and NlpDefine now have an optional engine parameter, which can be used to specify an external add-on engine such as Knitro, Mosek, Xpress, etc. For example:
NlpDefine( ... ; Engine : "KNITRO" )
would use the Knitro engine to solve the non-linear optimization problem. In order to use this feature, the Knitro engine must be properly installed and a license for it acquired. These configurations are described in Using a Solver Add-on Engine.
If the Engine parameter is not explicitly specifyed, LpDefine, QpDefine or NlpDefine will use the internal default solver engine that is deemed most appropriate for the problem. To determine which engine has been selected for a given problem previously defined, use:
SolverInfo( lp, "engine" )
Generalized Access to Solver Engine Parameters
Each solver engine in general has its own unique set of parameters that can be used to control its search. For example, the parameters used by Knitro only partially overlap the parameters used by the built-in evolutionary algorithm. To be able to take full advantage of Knitro, you need to be able to access all its parameters. If a third-party engine becomes available after Analytica 4.0 is released, it may have additional parameters.
The solver engine parameters have previously been exposed to the Analytica end-user as optional parameters to LpDefine, QpDefine and NlpDefine. Since these definitions are fixed, it doesn't provide a fully flexible mechanism for accessing and setting the solver parameters. For this reason, a new method for specifying solver control settings has been added to LpDefine, QpDefine and NlpDefine.
When you define an LP, QP or NLP, you can specify all search control parameters for the engine by settings up an array, where the index contains the parameter name(s) being set, and the array value contains the parameter value. then provide these to LpDefine, QpDefine or NlpDefine as
LpDefine( ... , Parameter: I , Setting: A )
When a setting appears twice, once in the Setting parameter and again as a separate standard function parameter, the function parameter is used. For example:
Index param := ["PARAM_ITLIMIT"]; Variable setting := Array(Param,[30]); LpDefine( ..., Parameter: param, Setting: setting, ItLimit: 20 )
in this example, an ItLimit of 20 would be used.
To view the current search control settings used in a particular LP, QP, or NLP, the function:
SolverInfo( lp, "Setting")
returns a 1-D array, in which a local index ".Parameter" contains the parameter name, and the array value contains the current setting. In general, the local index may contain a different set of parameters than those provided in the Parameter argument to LpDefine. There may be additional ones since in general only a subset will be specified explicitly, and if parameters that don't apply to the current engine appear in the Parameter argument to LpDefine, then those won't appear in the result from SolverInfo.
To access the default parameter settings for a given solver engine, use:
SolverInfo( Engine: engname, Item: "Setting" )
The largest and smallest allowable values for each setting can also be obtained using:
SolverInfo( Engine: engname, Item: ["Setting","Min Setting","Max Setting"] )
Enable comment auto-refresher