SetVariableBounds method: OptInterface class

Syntax

SetVariableBounds(modelID, varArrayID, boundType, lowerBound, upperBound, &keyRecord [, changeModelBounds])

Description

The SetVariableBounds method overrides the bounding values specified for a model variable array, or for a variable within the array.

Parameters

Parameter Description

modelID

Specify as a string the name of the optimization model for which you want to override the bounding values. This is the name used for the model definition in Application Designer.

varArrayID

Specify as a string the name of the variable array being optimized. Your application documentation should provide this name.

boundType

Specify a system constant indicating which bounding values to override. The value you specify here determines how the lowerBound and upperBound parameters are applied to the specified model.

  • %OPT_LOWER_BOUND: Override only the lower bound as specified by the lowerBound parameter. The upperBound parameter is ignored.

  • %OPT_UPPER_BOUND: Override only the upper bound as specified by the upperBound parameter. The lowerBound parameter is ignored.

  • %OPT_BOUND_BOTH: Override both the lower bound and the upper bound as specified by the lowerBound and upperBound parameters, respectively.

lowerBound

Specify as a number the lower bound that should be applied to a variable or a variable array if the boundType parameter permits the override. You can also set this parameter to one of the following system constants:

upperBound

Specify as a number the upper bound that should be applied to a variable or a variable array if the boundType parameter permits the override. You can also set this parameter to one of the following system constants:

&keyRecord

Specify a record with the same key fields as the variable array being optimized. To override the bounding values specified for a single variable within the array, populate the record's key fields to specify the variable. To override the bounding values specified for the entire variable array, set all of the record's fields to a null value.

Note: You must either provide values for all keys, or set them all to null values.

changeModelBounds

Specify a Boolean value:

  • true: Indicates that the specified model should be updated in memory to reflect the specified variable bounds. Any analytic instance that invokes this model from the active optimization engine is affected by these settings, which are propagated to the solver in memory. This is the default value if you omit this parameter.

  • false: Indicates that the specified model should not be updated in memory, and that the specified variable bounds apply only to the next time the Solve method is called.

Returns

%OptInter_Success if the method succeeds, %OptInter_Fail otherwise.

Example

Local Record &rec;
Local integer &result;
Local OptInterface &oi = CreateOptInterface();
Local float &objval = 0.0;
Local string &modelId = "QE_PSA_MODEL";
Local string &varArrayName = "X";
Local float &lb = 0.0;
Local float &ub = 0.0;

&rec = CreateRecord(Record.QEOPT_VAL_X_WRK);
&rec.QEOPT_RESINDEX.Value = 1;
&rec.QEOPT_SOLINDEX.Value = 2;
&rec.QEOPT_TIMEINDEX.Value = 3;

&result = &oi.SetVariableBounds(&modelId, &varArrayName,
 %Opt_Upper_Bound, &lb, &ub, &rec, False);