# Difference between revisions of "OptInfo"

New to Analytica 4.3. Supercedes the earlier SolverInfo function.

# OptInfo(opt, item, decision, constraint, asRef)

Provides access to an «item» in the definition of an optimization problem definition («opt») created by DefineOptimization.

Possible values for the «item» are:

"Item" Used for Indexed by Type Description
"All" LP, QP, QCP, NLP local .item various Returns a comprehensive view inside the optimization, listing most items shown here. This is the same info you get when you double click on the «LP», «NLP», etc., cell in a result window.
"vars" LP,QP,QCP,NLP Vars Text This lists all scalar decision variable, where each structured decision has been "flattened" to a single vector. This same index is used to index may of the possible OptInfo results that refer to scalar decisions, e.g., "ObjCoef", "Q", "Lhs", "LhsQ", etc.
"constraints" LP,QP,QCP,NLP Constraints Text This lists all the scalar constraints, where each structured constraint has been flattened to a single vector. This same index is used to index many of the possible OptInfo results that refer to scalar constraints, e.g., "Lhs", "LhsQ", "Rhs", "Sense", "constraintLb", "constraintUb", etc.
"objcoef" LP, QP, QCP Vars numeric The scalar objective linear coefficients.
"Q" QP, QCP Vars, Vars2 numeric The scalar quadratic coefficients for the objective. Dense matrix.
"lhs" LP, QP, QCP Vars, Constraints numeric The linear coefficients for all scalar constraints. Dense matrix. You may optionally specify «constraint» to obtain the coefficients for just one constraint, in the intrinsic dimensionality of that constraint but with respect to all scalar decision variables. Or you may specify «decision» to get the coefficients for just one decision, but relative to all scalar constraints. Or you may specify both «decision» and «constraint» to get the coefficients for only one decision and only one constraint, in the dimensionality of each.
"lhsQ", QCP Vars, Vars2, Constraints numeric The quadratic coefficients for all scalar scalar constraints. Dense matrices, may be too large to fit in memory for some large structured QCPs. You may optionally specify «decision» and/or «constraint» to obtain the quadratic coefficients for just that structured decision and constraint.
"rhs" LP,QP,QCP,NLP Constraints numeric The right-hand side coefficients for all scalar constraints. You may optionally specify «constraint» to get the coefficients for a single structured constraint, in which case the result will be indexed by the constraint's intrinsic indexes. For a linear or quadratic constraint, the RHS will be the constant term. There is no guarantee of the sign, since it depends on how DefineOptimization re-arranges the constraint when it processes the coefficients. For a non-linear constraint, rhs will usually be 0. For a range constraint, e.g., `a <= f(x) <= b`, the far right constant (b) is returned. It is better to use "constraintLb" and "constraintUb" for range constraints.
"constraintUb" LP,QP,QCP,NLP Constraints numeric Upper bound for each scalar constraint. You may optionally specify «constraint» to obtain the values for a single structured constraint in the intrinsic dimensionality of the constraint.
"constraintLb" LP,QP,QCP,NLP Constraints numeric Lower bound for each scalar constraint. You may optionally specify «constraint» to obtain the values for a single structured constraint in the intrinsic dimensionality of the constraint.
"sense" LP,QP,QCP,NLP Constraints '>=','<=', '=', 'R' Inequality for each constraint. 'R' for range (lb & ub). You may optionally specify «constraint» to obtain the sense for a single structured constraint.
"lb" LP,QP,QCP,NLP Vars numeric Lower bound for each scalar variable. You may optionally specify «decision» to obtain the value for a single structured decision variable, in terms of the decision's intrinsic indexes.
"ub" LP,QP,QCP,NLP Vars numeric Upper bound for each scalar variable. You may optionally specify «decision» to obtain the value for a single structured decision variable, in terms of the decision's intrinsic indexes.
"integer type" LP,QP,QCP,NLP Vars 'Continuous', 'Integer', 'Boolean', 'Grouped Integer', or 'Semi-Continuous'. The type of all scalar decision variables. Optionally you may specify «decision» to get the integer type(s) for the indicated structured decision, in terms of the decision's intrinsic indexes.
"group" LP,QP,QCP, NLP Vars numeric Applicable only to a grouped integer variable, returns the group number for each scalar decision variable. You may optionally specify «decision» to obtain the groups for a single structured decision, which will be indexed by the decision's intrinsic indexes.
"maximize" LP,QP,QCP,NLP atomic True, False, Null Indicates whether the optimization maximizes or minimizes an objective, or whether there is no objective at all (a find any feasible problem).
"engine" LP,QP,QCP,NLP atomic text The name of the engine that will be, or was, used to solve the optimization.
"setting" LP,QP,QCP,NLP local .Parameter numeric A list of all solver engine control setting values.
"type" LP,QP,QCP,NLP atomic "LP","QP", "QCP", "CQCP", "NCQCP", "NLP", "NSP" The problem type.

If you include as a «decision» the identifier of a decision variable passed into the «decisions» parameter of DefineOptimization, it gives results just for that decision. The result is dimensioned by the decision variable's indexes rather than by the .Vars index. The «decision» parameter is relevant to any of the «item»s in the above table that show .Vars in the dimensionality column.

«constraint» is the identifier of a constraint node passed into the «constraints» parameter of DefineOptimization. When this is provided, only the portion of the requested item relevant to that constraint is returned, and the result is dimensioned by the constraint's OptDimensions rather than by the .Constraints index. The «constraint» parameter is relevant to any of the «item»s in the above table that show .Constraints in the dimensionality column.