OptEngineInfo
New to Analytica 4.3. Supercedes the earlier SolverInfo function.
OptEngineInfo(engine,item,asRef)
The SolverInfo function provides information about a specific optimizer engine, or about the solver engines that are currently installed and ready for use.
«Engine» is the name of a solver engine. The following are included with Analytica:
- "Lp/Quadratic"
- "SOCP Barrier"
- "GRG Nonlinear"
- "Evolutionary"
Various add-on engines can be purchased separately. These include:
- "LSLP"
- "LSGRG"
- "LSSQP"
- "Knitro"
- "OptQuest"
- "MOSEK"
- "XPress"
- "Gurobi"
«Item» may be from this table:
Item | Dimensionality | Type | Description |
---|---|---|---|
"SettingNames" | List | numeric | Array of control setting names. |
"MaxSetting" | Local .Parameter | numeric | upper bounds for setting |
"MinSetting" | Local .Parameter | numeric | lower bounds for setting |
"Default" | Local .Parameter | numeric | default value for setting |
"EngineName" | atomic | text | The engine name (null without error if engine not installed) |
"DLL" | atomic | text | File path to solver engine's DLL, "" for bulit-in engines. |
"TrialPeriod" | atomic | numeric | number of days until Frontline solver trial license expires |
"ProblemTypes" | Local .ProblemType | boolean | A list of the problem types handled by each engine |
"MaxVars" | Local .ProblemType | numeric | Maximum number of decision variables supported by engine |
"MaxIntVars" | Local .ProblemType | numeric | Maximum number of integer variables supported by engine |
"MaxConstraints" | Local .ProblemType | numeric | Maximum number of constraints supported by engine |
"MaxVarBounds" | Local .ProblemType | numeric | Maximum number of variable bounds supported by engine |
"Milliseconds" | atomic | numeric | Time spent in computation. |
"Iterations" | atomic | numeric | # of iterations engine has performed |
"Calls" | atomic | numeric | # of function evaluations that have occurred |
"Jacobians" | atomic | numeric | # of jacobians evaluations that have occurred |
"Hessians" | atomic | numeric | # of hessians evaluations that have occurred |
All Available Engines
The special usage:
OptEngineInfo("All","")
returns an unindexed list of all solver engine names present on the computer.
When you use "All" with an item specified, then that item information is returned for all engines. The result is indexed by a local index named .Engine. For example, to get the DLL location for all add-on engines, use:
OptEngineInfo("All","DLL")
note: for the four standard built-in engines, the DLL evaluates to the empty text value, "". For add-on engines, this a non-empty file path. For mal-configured add-on engines, «null» is returned.
Getting the result as a Reference
When the optional parameter, «asRef», is specified as True
a reference to the requested value is returned. This is useful when you are requesting multiple items with different dimensionalities at the same time, or when requesting one of the items indexed by .Parameter for multiple engines at the same time. If you don't use asRef:true
in these cases, the dimensions will be combined, which may not be desired.
To illustrate, consider an example:
OptEngineInfo("LP/Quadratic",["MaxSetting","MaxVars"])
Notice that OptEngineInfo("LP/Quadratic","MaxSetting")
is indexed by .Parameter, while OptEngineInfo("LP/Quadratic","MaxVars")
is indexed by .ProblemType. The result of the above expression will thus be a 3-D array indexed by both .Parameter and .ProblemType, as well as by the implicit index ["MaxSetting","MaxVars"]. When you examine just the "MaxSetting" slice, there is an extra index .ProblemType that has nothing to do with the "MaxSetting".
The use of references avoids this undesired combination of dimensions. When the above is replaced by:
OptEngineInfo("LP/Quadratic",["MaxSetting","MaxVars"],asRef:true)
then the result is a two cell vector, the first item being a reference to a 1-D array indexed by .Parameter, the second item being a reference to a 1-D array indexed by .ProblemType.
It is recommended that you use references when obtaining the parameter settings for multiple engines, since it is possible for different engines to have a different set of parameters. When the parameter sets are identical for all engines, then the same index will be used. But this is not guaranteed as some parameters are unique to specific engines, and in that case you could end up with multiple .Parameter indexes in the same array. Hence, you should use, e.g.:
OptEngineInfo("All","Defaults",asRef:true)
Examples
- OptEngineInfo("All","ProblemTypes") →
- OptEngineInfo("Evolutionary",["MaxSetting","Default","MinSetting"]) →
Enable comment auto-refresher