The Constraint Object
The Constraint object is an element of the Constraints collection and contains all the information stored about each individual constraint in the model.Properties for the Constraint Object
Activity
The activity for the constraint from the solution. (Double Property - Read Only)
ConNr
The constraint number in the matrix. (Integer Property - Read/Write)
IsNonlinear
Specifies if the constraint contains nonlinear variables. (Booelan Property - Read/Write)
IsUsed
Specifies if the constraint contains at least one variable. (Boolean Property - Read/Write)
LowerBound
The lower bound for the constraint. (Double Property - Read Only)
Name
The name of the constraint. (String Property - Read/Write)
RangeValue
The range value for the constraint. (Double Property - Read/Write)
RHSLowerRange
The lower range for the RHS value in the solution. (Double Property - Read Only)
RHSUpperRange
The upper range for the RHS value in the solution. (Double Property - Read Only)
RHSValue
The right-hand-side value for the constraint. (Double Property - Read/Write)
ShadowPrice
The shadow price for the constraint from the solution. (Double Property - Read Only)
SlackValue
The slack value for the constraint from the solution. (Double Property - Read Only)
SolverRowNr
The row number for the constraint in the solver solution. (Integer Property - Read Only)
StageNr
The stochastic stage number for the constraint. (Integer Property - Read Only)
Type
The type of the constraint. (Enumerated Property - Read/Write). Possible values are:
- mplConUnknown
- mplConLessThan
- mplConGreaterThan
- mplConEqual
- mplConRanged.
UpperBound
The upper bound for the constraint. (Double Property - Read Only)
Visual Basic Example:
Dim MPL As OptiMax Dim planModel As Model Dim planSol As Solution Dim planCons As Constraints Set MPL = New OptiMax MPL.Solvers.Add ("c:\mplwin4\CPLEX65.dll") Set planModel = MPL.Models.Add("Planning.mpl") Set planSol = planModel.Solution Set planCons = planSol.Constraints MPL.WorkingDirectory = "c:\mplwin4" result = planModel.ReadModel(planModel.Name) result = planModel.Solve If (result > 0) Then MsgBox planModel.ErrorMessage End if For Each constr In planCons Debug.Print constr.ConNr & ") " & constr.Name & _ " " & constr.SlackValue & " " & constr.ShadowPrice Next constr