Class MPVariable


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

      Fields 
      Modifier and Type Field Description
      protected boolean swigCMemOwn  
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MPSolver.BasisStatus basisStatus()
      Advanced usage: returns the basis status of the variable in the current
      solution (only available for continuous problems).

      void delete()  
      protected void finalize()  
      protected static long getCPtr​(MPVariable obj)  
      int index()
      Returns the index of the variable in the MPSolver::variables_.
      double lb()
      Returns the lower bound.
      java.lang.String name()
      Returns the name of the variable.
      double reducedCost()
      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 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).
      protected static long swigRelease​(MPVariable obj)  
      double ub()
      Returns the upper bound.
      • Methods inherited from class java.lang.Object

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

      • swigCMemOwn

        protected transient boolean swigCMemOwn
    • Constructor Detail

      • MPVariable

        protected MPVariable​(long cPtr,
                             boolean cMemoryOwn)
    • Method Detail

      • getCPtr

        protected static long getCPtr​(MPVariable obj)
      • swigRelease

        protected static long swigRelease​(MPVariable obj)
      • finalize

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

        public void delete()
      • name

        public java.lang.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).