SolverInfo
The SolverInfo function provides information about a specific optimizer engine, or about a previously-defined LP, QP or NLP. Its declaration is:
SolverInfo( lp : optional LP_TYPE ; item : atomic text ; engine : optional atomic text ; ref : optional boolean = False )
Where:
- lp : A problem instance previously defined by LpDefine, QpDefine or NlpDefine, LpRead, or returned by FindIIS.
- item : A description of the desired item(s). Case insensitive. See below for possible values.
- engine: The name of a Solver engine.
- ref : A flag indicating whether a reference to the result should be returned.
Obtaining Information about a Problem Instance
You can obtain information about a previously-defined optimization problem using the two-parameter form of SolverInfo:
SolverInfo( lp, item )
For example, to get the variable lower bounds use:
SolverInfo( lp, "lb" )
Possible values for the Item are
"Item" | Valid For | Dimensionality | Type | Description |
---|---|---|---|---|
"objcoef" | LP, QP | Vars | numeric | |
"Q" | QP | Vars, Vars2 | numeric | |
"lhs" | LP, QP | Vars, Constraints | numeric | |
"rhs" | LP,QP,NLP | Constraints | numeric | |
"constraintUb" | LP,QP,NLP | Constraints | numeric | Upper bound for each constraint |
"constraintLb" | LP,QP,NLP | Constraints | numeric | Lower bound for each constraint |
"lb" | LP,QP,NLP | Vars | numeric | |
"sense" | LP,QP,NLP | Constraints | '>=','<=', or '=' | |
"ub" | LP,QP,NLP | Vars | numeric | |
"ctype" | LP,QP,NLP | Vars | 'C', 'I', or 'B' | |
"maximize" | LP,QP,NLP | atomic | True, False | |
"engine" | LP,QP,NLP | atomic | text | |
"setting" | LP,QP,NLP | local .Parameter | numeric | |
"type" | LP,QP,NLP | atomic | "LP","QP", "QCP" or "NLP" | |
"vars" | LP,QP,NLP | Vars | elements of the Vars index | |
"constraints" | LP,QP,NLP | Constraints | the constraint names |
If any of these Items are specified, but the lp parameter is not provided, an error results.
Obtaining Information about a Solver Engine
The usage:
SolverInfo( engine: atomic text ; Item : atomic text )
returns information about a solver engine. The possible values for Item in this usage are:
Item | Dimensionality | Type | Description |
---|---|---|---|
"Setting" | List | numeric | Array of control setting names. |
"MaxSetting" | Local .Parameter | numeric | upper bounds for setting |
"MinSetting" | Local .Parameter | numeric | lower bounds for setting |
"Name" | atomic | text | The engine name |
"DLL" | atomic | text | File path to solver engine's DLL |
"TrialPeriod" | atomic | numeric | number of days until Frontline solver trial license expires |
"MaxVars" | atomic | numeric | Maximum number of decision variables supported by engine |
"MaxIntVars" | atomic | numeric | Maximum number of integer variables supported by engine |
"MaxConstraints" | atomic | numeric | Maximum number of constraints supported by engine |
"MaxVarBounds" | atomic | 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 |
If the Engine parameter is omitted, but the Lp parameter is present, then the setting for the engine used by the Lp is returned. If both the LP and Engine parameters are specified, then these settings will be returned for the specified Engine (in the case that these differ).
General Information
Some information can be obtained without specifying any problem instance or engine using the syntax, e.g.:
SolverInfo( Items: "AvailEngines" )
The possible Items not pertaining to any engine or problem instance are:
Item | Dimensionality | Type | Description |
---|---|---|---|
"AvailEngines" | List | Text | The names the Solver engines available for use. |
Obtaining Multiple Items in a Single Call
Multiple items can be obtained from SolverInfo in a single call by array abstracting over the Item parameter. For example:
Index SettingInfo := ["Name","Max","Min","Value"] Variable TheSettings := SolverInfo( Lp:the_lp, Item: SettingInfo )
This example would return two dimensional array indexed by SettingInfo and by a local index named .Parameters.
Since many of the possible Item values return results with different dimensionality, using the function in this way would cause the dimensionalities to be combined undesirably. Thus, when obtaining items having different dimensionality in a single call, the ref parameter can be set to true, and a reference to each setting is returned. For example, the following would compute slack:
var info := SolverInfo( lp, Item: ["lhs","rhs"], Ref:true ); var x := LpSolution(lp); #info[.Parameter="rhs"] - sum( #info[.Parameter='lhs'] * x, Vars )
Enable comment auto-refresher