Class MPVariable

java.lang.Object
com.google.ortools.linearsolver.MPVariable

public class MPVariable extends Object
The class for variables of a Mathematical Programming (MP) model.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    MPVariable(long cPtr, boolean cMemoryOwn)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Advanced usage: returns the basis status of the variable in the current
    solution (only available for continuous problems).

    void
     
    protected void
     
    protected static long
     
    int
    Returns the index of the variable in the MPSolver::variables_.
    double
    lb()
    Returns the lower bound.
    Returns the name of the variable.
    double
    Advanced usage: returns the reduced cost of the variable in the current
    solution (only available for continuous problems).
    void
    setBounds(double lb, double ub)
    Sets both the lower and upper bounds.
    void
    setInteger(boolean integer)
    Sets the integrality requirement of the variable.
    void
    setLb(double lb)
    Sets the lower bound.
    void
    setUb(double ub)
    Sets the upper bound.
    double
    Returns the value of the variable in the current solution.

    If the variable is integer, then the value will always be an integer (the
    underlying solver handles floating-point values only, but this function
    automatically rounds it to the nearest integer; see: man 3 round).
    protected static long
     
    double
    ub()
    Returns the upper bound.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • swigCMemOwn

      protected transient boolean swigCMemOwn
  • Constructor Details

    • MPVariable

      protected MPVariable(long cPtr, boolean cMemoryOwn)
  • Method Details

    • getCPtr

      protected static long getCPtr(MPVariable obj)
    • swigRelease

      protected static long swigRelease(MPVariable obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • delete

      public void delete()
    • name

      public String name()
      Returns the name of the variable.
    • setInteger

      public void setInteger(boolean integer)
      Sets the integrality requirement of the variable.
    • solutionValue

      public double solutionValue()
      Returns the value of the variable in the current solution.

      If the variable is integer, then the value will always be an integer (the
      underlying solver handles floating-point values only, but this function
      automatically rounds it to the nearest integer; see: man 3 round).
    • index

      public int index()
      Returns the index of the variable in the MPSolver::variables_.
    • lb

      public double lb()
      Returns the lower bound.
    • ub

      public double ub()
      Returns the upper bound.
    • setLb

      public void setLb(double lb)
      Sets the lower bound.
    • setUb

      public void setUb(double ub)
      Sets the upper bound.
    • setBounds

      public void setBounds(double lb, double ub)
      Sets both the lower and upper bounds.
    • reducedCost

      public double reducedCost()
      Advanced usage: returns the reduced cost of the variable in the current
      solution (only available for continuous problems).
    • basisStatus

      public MPSolver.BasisStatus basisStatus()
      Advanced usage: returns the basis status of the variable in the current
      solution (only available for continuous problems).