# OptInfo

## 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. `"DecisionVector"`

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.`"ConstraintVector"`

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.`"Decisions"`

LP, QP, QCP, NLP (Structured only)

local .Decision Text This lists the names of each structured decision in the optimization. This index is also used by other items of **OptInfo**when the result applies to the set of structured decision variables. This only applies to problems created using DefineOptimization.`"Constraints"`

LP, QP, QCP, NLP (Structured only)

local .Constraint Text This lists the names of each structured constraint in the optimization. This index is also used by other items of **OptInfo**when the result applies to the set of structured constraints. This only applies to problems created using DefineOptimization.`"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. `"IntegerType"`

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 .SettingName 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. `"Intrinsic Indexes"`

LP, QP, QCP, NLP (Structured only)

local .index, Local .item Null, Handle, set of Handles This lists in the index .index a set of handles for all the indexes treated as intrinsic indexes anywhere in the optimization. The array shows which structured decisions ( `result[.item = 'Decision']`

) and which structured constraints (`result[.item = 'Constraint']`

) contains the index as an intrinsic index.You may optionally specify either «decision» or «constraint» to get the intrinsic indexes for a single node. In this case the result is scalar (Null, Handle, or set of Handles.

`"Extrinsic Indexes"`

LP, QP, QCP, NLP (Structured only)

local .index, Local .item Null, Handle, set of Handles Boolean (0 or 1) for objective.

This lists in the index .index a set of handles for all the indexes treated as extrinsic indexes anywhere in the optimization. The array shows which structured decisions ( `result[.item = 'Decision']`

) and which structured constraints (`result[.item = 'Constraint']`

) contains the index as an intrinsic index, and also whether the index is shows up as extrinsic in the objective.You may optionally specify either «decision» or «constraint» to get the extrinsic indexes for a single node. In this case the result is scalar (Null, Handle, or set of Handles.

This option is very useful when you wondering why DefineOptimization has array-abstracted over an index, producing multiple optimization problems. The result points to you exactly which component(s) of your problem the extra indexes are arising from.

`"Decision Intrinsic Indexes"`

LP, QP, QCP, NLP (Structured only)

local .Decision Null or set of Handles Lists all structured decision nodes, and for each, a set containing the the indexes that are intrinsic to decision variable. You may optionally select a single decision node by specifying «decision». `"Decision Extrinsic Indexes"`

LP, QP, QCP, NLP (Structured only)

local .Decision Null or set of Handles Lists all structured decision nodes, and for each, a set containing the the indexes treated as extrinsic for the decision. You may optionally select a single decision node by specifying «decision». `"Objective Dims"`

LP, QP, QCP, NLP (Structured only)

scalar Null, Handle, or set of Handles A list of the indexes that show up in the objective (i.e., are extrinsic to the objective). These result in an array-abstraction over the indexes by DefineOptimization, resulting in an array of optimizations. `"Status"`

LP, QP, QCP, NLP atomic Text The current solve status. This may be `"Not yet solved"`

, or it may be the same text returned by OptStatusText(). Unlike OptStatusText(), it does not initiate a solve.

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.

## History

This function was introduced in Analytica 4.3 and supersedes the earlier SolverInfo function.

Enable comment auto-refresher