Class IntVar

java.lang.Object
com.google.ortools.sat.IntVar
All Implemented Interfaces:
LinearExpr, Literal

public final class IntVar
extends java.lang.Object
implements Literal, LinearExpr
An integer variable.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String displayBounds()
    Returns the domain as a string without the enclosing [].
    IntegerVariableProto.Builder getBuilder()
    Returns the variable protobuf builder.
    long getCoefficient​(int index)
    Returns the ith coefficient.
    Domain getDomain()
    Returns the domain of the variable.
    int getIndex()
    Internal, returns the index of the variable in the underlying CpModelProto.
    java.lang.String getName()
    Returns the name of the variable given upon creation.
    long getOffset()
    Returns the constant part of the expression.
    java.lang.String getShortString()
    Returns a short string describing the variable.
    IntVar getVariable​(int index)
    Returns the ith variable.
    Literal not()
    Returns the negation of a boolean variable.
    int numElements()
    Returns the number of elements in the interface.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getName

      public java.lang.String getName()
      Returns the name of the variable given upon creation.
    • getIndex

      public int getIndex()
      Internal, returns the index of the variable in the underlying CpModelProto.
      Specified by:
      getIndex in interface Literal
    • getBuilder

      public IntegerVariableProto.Builder getBuilder()
      Returns the variable protobuf builder.
    • numElements

      public int numElements()
      Description copied from interface: LinearExpr
      Returns the number of elements in the interface.
      Specified by:
      numElements in interface LinearExpr
    • getVariable

      public IntVar getVariable​(int index)
      Description copied from interface: LinearExpr
      Returns the ith variable.
      Specified by:
      getVariable in interface LinearExpr
    • getCoefficient

      public long getCoefficient​(int index)
      Description copied from interface: LinearExpr
      Returns the ith coefficient.
      Specified by:
      getCoefficient in interface LinearExpr
    • getOffset

      public long getOffset()
      Description copied from interface: LinearExpr
      Returns the constant part of the expression.
      Specified by:
      getOffset in interface LinearExpr
    • getShortString

      public java.lang.String getShortString()
      Returns a short string describing the variable.
      Specified by:
      getShortString in interface Literal
    • displayBounds

      public java.lang.String displayBounds()
      Returns the domain as a string without the enclosing [].
    • not

      public Literal not()
      Returns the negation of a boolean variable.
      Specified by:
      not in interface Literal
    • getDomain

      public Domain getDomain()
      Returns the domain of the variable.