Package com.google.ortools.sat
Class AffineExpression
- java.lang.Object
-
- com.google.ortools.sat.AffineExpression
-
- All Implemented Interfaces:
LinearArgument,LinearExpr
public final class AffineExpression extends java.lang.Object implements LinearExpr
A specialized linear expression: a * x + b
-
-
Constructor Summary
Constructors Constructor Description AffineExpression(int varIndex, long coefficient, long offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinearExprbuild()Builds a linear expression.longgetCoefficient(int index)Returns the ith coefficient.longgetOffset()Returns the constant part of the expression.intgetVariableIndex(int index)Returns the index of the ith variable.intnumElements()Returns the number of terms (excluding the constant one) in this expression.
-
-
-
Method Detail
-
build
public LinearExpr build()
Description copied from interface:LinearArgumentBuilds a linear expression.- Specified by:
buildin interfaceLinearArgument
-
numElements
public int numElements()
Description copied from interface:LinearExprReturns the number of terms (excluding the constant one) in this expression.- Specified by:
numElementsin interfaceLinearExpr
-
getVariableIndex
public int getVariableIndex(int index)
Description copied from interface:LinearExprReturns the index of the ith variable.- Specified by:
getVariableIndexin 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
-
-