The Variables collection is used to store a list of Variable objects.The parent can either be the Matrix object or the Solution object. These objects use the Variables collection to store a list of all the variables that are defined in the matrix or the solution.
The number of variables in the collection. (Integer Property - Read Only)
Returns the selected Variable object from the collection. (Object Property)
Adds a new Variable object to the matrix. (Method)
The number of binary variables. (Integer Property - Read Only)
The number of free variables. (Integer Property - Read Only)
The number of variables with nonzero initial value. (Integer Property - Read Only)
The number of general integer variables. (Integer Property - Read Only)
The number of variables with nonzero lower bound. (Integer Property - Read Only)
The number of variables that appear in nonlinear terms. (Integer Property - Read Only)
The number of variables with defined priority values. (Integer Property - Read Only)
The number of variables that are members of SOS sets. (Integer Property - Read Only)
The number of variables with defined upper bound. (Integer Property - Read Only)
The number of variables that appear in at least one constraint or the objective. (Integer Property - Read Only)
Visual Bassic Example:
Dim MPL As OptiMax
Dim planModel As Model
Dim planSol As Solution
Dim planVar As Variables
Set MPL = New OptiMax
MPL.Solvers.Add ("c:\mplwin4\CPLEX65.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
Debug.Print "Variable Count = " & planVars.Count
Debug.Print "Binary Count = " & planVars.BinaryCount
Debug.Print "Integer Count = " & planVars.IntegerCount
Debug.Print "Free Count = " & planVars.IntegerCount
Debug.Print "Nonlinear Count = " & planVars.IntegerCount