SetVariableType method: OptInterface class

Syntax

SetVariableType(modelID, varArrayID, varType)

Description

Use the SetVariableType method to change the data type of a model variable array.

Parameters

Parameter Description

ModelID

Specify as a string the name of the optimization model for which you want to change the variable type. This must be the name of one of the models associated with the analytic type definition.

varArrayID

Specify as a string the name of the variable array for which you want to change the variable type. Your application documentation should provide this name.

varType

Specify one of the following system constants representing the new variable type:

  • %Opt_Var_Cont: Represents a continuous variable type, which can be any floating point value.

  • %Opt_Var_Bin: Represents a binary variable type, for which the value can be only 0 or 1.

  • %Opt_Var_Int: Represents an integer variable type, which can be any integer.

Returns

%OptInter_Success if the method succeeds, %OptInter_Fail otherwise.

Example

Local OptInterface &oi = CreateOptInterface();
Local string &varArrayName = "X";
Local integer &result;

&result = &oi.SetVariableType("QE_PSA_MODEL",  &varArrayName, %Opt_Var_Bin);

If (&result <> %OptInter_Success) Then
   &oi.DumpMsgToLog(%Severity_Status, "Failed to change variable type ");
End-If;