The Matrix Object
The Matrix object is a property of the parent Model object and contains all the information stored about the LP matrix for the model.
Collections contained by the Matrix Object
Constraints
Returns the Constraints collection for the matrix. (Object Property)
Variables
Returns the Variables collection for the matrix. (Object Property)
Properties for the Matrix Object
ConCount
The number of constraints in the matrix. (Integer Property - Read Only)
ConEqualCount
The number of equal constraints in the matrix. (Integer Property - Read Only)
ConGreaterThanCount
The number of greater than constraints in the matrix. (Integer Property - Read Only)
ConLessThanCount
The number of less than constraints in the matrix. (Integer Property - Read Only)
ConNonLinearCount
The number of constraints which contain nonlinear terms. (Integer Property - Read Only)
ConRHSCount
The number of nonzero RHS values in the matrix. (Integer Property - Read Only)
ConRangeCount
The number of ranged constraints in the matrix. (Integer Property - Read Only)
ConStageCount
The number of constraints with defined stochastic stages. (Integer Property - Read Only)
ConUsedCount
The number of constraints that have at least one variable. (Integer Property - Read Only)
Density
The density of the matrix. (Double Property - Read Only)
IsObjectMaximize
Specifies if the objective function is maximized. (Boolean Property - Read/Write)
IsStoreByColumns
Specifies if the matrix is stored by columns. (Boolean Property - Read/Write)
IsSynchronized
Specifies if the variables and the constraints for the matrix have been synchronized. (Boolean Property - Read/Write)
ObjectName
The name of the objective function. (String Property - Read/Write)
NonZeroCount
The number of nonzero values in the matrix. (Integer Property - Read Only)
ObjectQuadCount
The number of quadratic terms in the objective function. (Integer Property - Read Only)
Title
Model name that is given with the TITLE statement in MPL. (String Property - Read/Write)
Value (Constraint, Variable)
The nonzero value for the given constraint and variable in the matrix. (Double Property - Read/Write)
VarBinaryCount
The number of binary variables. (Integer Property - Read Only)
VarCount
The number of variables in the matrix. (Integer Property - Read Only)
VarFreeCount
The number of free variables. (Integer Property - Read Only)
VarLowerBoundCount
The number of variables with nonzero lower bound. (Integer Property - Read Only)
VarNonLinearCount
The number of variables that appear in nonlinear terms. (Integer Property - Read Only)
VarInitCount
The number of variables with nonzero initial value. (Integer Property - Read Only)
VarIntegerCount
The number of general integer variables. (Integer Property - Read Only)
VarObjectCount
The number of variables with objective value. (Integer Property - Read Only)
VarPriorityCount
The number of variables with defined priority values. (Integer Property - Read Only)
VarSemiContCount
The number of variables that are semi-continuous. (Integer Property - Read Only)
VarSosCount
The number of variables that are members of SOS sets. (Integer Property - Read Only)
VarStageCount
The number of variables with defined stochastic stages. (Integer Property - Read Only)
VarUpperBoundCount
The number of variables with defined upper bound. (Integer Property - Read Only)
VarUsedCount
The number of variables that appear in at least one constraint or the objective. (Integer Property - Read Only)
Visual Basic Example:
Dim MPL As OptiMax Dim cpxSolver As Solver Dim planModel As Model Dim planMatrix As Matrix Dim con As Constraint Dim var As Variable Set MPL = New OptiMax Set cpxSolver = MPL.Solvers.Add("CPLEX") Set planModel = MPL.Models.Add("planning") MPL.WorkingDirectory = "c:\mplwin4" planModel.ReadModel ("planning.mpl") Set planMatrix = planModel.Matrix Debug.Print "Model Title = " & planMatrix.Title Debug.Print "Objective Name = " & planMatrix.ObjectName Debug.Print "Variable Count = " & planMatrix.VarCount Debug.Print "Binary Count = " & planMatrix.VarBinaryCount Debug.Print "Integer Count = " & planMatrix.VarIntegerCount Debug.Print "Constraint Count = " & planMatrix.ConCount Debug.Print "RHS Count = " & planMatrix.ConRHSCount Debug.Print "Equal Count = " & planMatrix.ConEqualCount Debug.Print "Less Than Count = " & planMatrix.ConLessThanCount Debug.Print "Greater Than Count = " & planMatrix.ConGreaterThanCount Debug.Print "Nonzero Count = " & planMatrix.NonZeroCount Debug.Print "Density of Matrix = " & planMatrix.Density For Each con In planMatrix.Constraints For Each var In planMatrix.Variables If planMatrix(con, var) <> 0 Then Debug.Print "[" & con & "," & var & "]=" & planMatrix.Value(con, var) End If Next var Next con
Methods for the Matrix Object
ToString
Returns a string representing the Matrix object. (Method)