The Variable Object

The Variable object is an element of the Variables collection and contains all the information stored about each individual variable in the model.

Properties for the Variable Object

Activity

The activity for the variable from the solution. (Double Property - Read/Write)

InitValue

The initial value for the variable. (Double Property - Read/Write)

IsBinary

Specifies if the variable is a binary variable. (Boolean Property - Read/Write)

IsFree

Specifies if the variable is a free variable. (Boolean Property - Read/Write)

IsInteger

Specifies if the variable is an integer variable. (Boolean Property - Read/Write)

IsNonlinear

Specifies if the variable is used in a nonlinear term. (Boolean Property - Read/Write)

IsSemiContinuous

Specifies if the variable is a semi-continuous variable. (Boolean Property - Read/Write)

IsSOS

Specifies if the variable is a member of a SOS set. (Boolean Property - Read/Write)

IsUsed

Specifies if the variable is used in at least one of the constraints or the objective function. (Boolean Property - Read/Write)

LowerBound

The lower bound for the variable. (Double Property - Read/Write)

Name

The name of the variable. (String Property - Read/Write)

ObjectCoeff

The objective coefficient for the variable. (Double Property - Read/Write)

ObjectLowerRange

The lower range for the objective function coefficient in the solution. (Double Property - Read Only)

ObjectUpperRange

The upper range for the objective function coefficient in the solution. (Double Property - Read Only)

PriorityValue

The priority value for the variable. (Integer Property - Read/Write)

ReducedCost

The reduced cost for the variable from the solution. (Double Property - Read Only)

SolverColNr

The column number for the variable in the solver solution. (Integer Property - Read Only)

Stage

The stochastic stage number for the variable. (Integer Property - Read only)

UpperBound

The upper bound for the variable. (Double Property - Read/Write)

VarNr

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

        

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page