Package com.google.ortools.sat
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.StringdisplayBounds()Returns the domain as a string without the enclosing [].IntegerVariableProto.BuildergetBuilder()Returns the variable protobuf builder.longgetCoefficient(int index)Returns the ith coefficient.DomaingetDomain()Returns the domain of the variable.intgetIndex()Internal, returns the index of the variable in the underlying CpModelProto.java.lang.StringgetName()Returns the name of the variable given upon creation.longgetOffset()Returns the constant part of the expression.java.lang.StringgetShortString()Returns a short string describing the variable.IntVargetVariable(int index)Returns the ith variable.Literalnot()Returns the negation of a boolean variable.intnumElements()Returns the number of elements in the interface.java.lang.StringtoString()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:
toStringin classjava.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. -
getBuilder
Returns the variable protobuf builder. -
numElements
public int numElements()Description copied from interface:LinearExprReturns the number of elements in the interface.- Specified by:
numElementsin interfaceLinearExpr
-
getVariable
Description copied from interface:LinearExprReturns the ith variable.- Specified by:
getVariablein interfaceLinearExpr
-
getCoefficient
public long getCoefficient(int index)Description copied from interface:LinearExprReturns the ith coefficient.- Specified by:
getCoefficientin interfaceLinearExpr
-
getOffset
public long getOffset()Description copied from interface:LinearExprReturns the constant part of the expression.- Specified by:
getOffsetin interfaceLinearExpr
-
getShortString
public java.lang.String getShortString()Returns a short string describing the variable.- Specified by:
getShortStringin interfaceLiteral
-
displayBounds
public java.lang.String displayBounds()Returns the domain as a string without the enclosing []. -
not
Returns the negation of a boolean variable. -
getDomain
Returns the domain of the variable.
-