The Variable object is an element of the Variables collection and contains all the information stored about each individual variable in the model.
The activity for the variable from the solution. (Double Property - Read/Write)
The initial value for the variable. (Double Property - Read/Write)
Specifies if the variable is a binary variable. (Boolean Property - Read/Write)
Specifies if the variable is a free variable. (Boolean Property - Read/Write)
Specifies if the variable is an integer variable. (Boolean Property - Read/Write)
Specifies if the variable is used in a nonlinear term. (Boolean Property - Read/Write)
Specifies if the variable is a semi-continuous variable. (Boolean Property - Read/Write)
Specifies if the variable is a member of a SOS set. (Boolean Property - Read/Write)
Specifies if the variable is used in at least one of the constraints or the objective function. (Boolean Property - Read/Write)
The lower bound for the variable. (Double Property - Read/Write)
The name of the variable. (String Property - Read/Write)
The objective coefficient for the variable. (Double Property - Read/Write)
The lower range for the objective function coefficient in the solution. (Double Property - Read Only)
The upper range for the objective function coefficient in the solution. (Double Property - Read Only)
The priority value for the variable. (Integer Property - Read/Write)
The reduced cost for the variable from the solution. (Double Property - Read Only)
The column number for the variable in the solver solution. (Integer Property - Read Only)
The stochastic stage number for the variable. (Integer Property - Read only)
The upper bound for the variable. (Double Property - Read/Write)
The variable number in the matrix for the variable. (Integer Property - Read/Write)
Visual Basic Example:
Dim MPL As OptiMax
Dim planModel As Model
Dim planSol As Solution
Dim planVars As Variables
Dim var As Variable
Set MPL = New OptiMax
MPL.Solvers.Add ("c:\mplwin4\CPLEX125.dll")
Set planModel = MPL.Models.Add("Planning.mpl")
Set planSol = planModel.Solution
Set planVars = planModel.Matrix.Variables
MPL.WorkingDirectory = "c:\mplwin4"
Result = planModel.ReadModel(planModel.Name)
Result = planModel.Solve
For Each var In planVars
If (Result > 0) Then
Debug.Print var.VarNr & ") " & var.Name & _
" " & var.Activity & " " & _
" "; var.ReducedCost
End If
Next var