Class AffineExpression
java.lang.Object
com.google.ortools.sat.AffineExpression
- All Implemented Interfaces:
LinearArgument,LinearExpr
A specialized linear expression: a * x + b
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a linear expression.longgetCoefficient(int index) Returns the ith coefficient.longReturns the constant part of the expression.intgetVariableIndex(int index) Returns the index of the ith variable.intReturns the number of terms (excluding the constant one) in this expression.
-
Constructor Details
-
AffineExpression
public AffineExpression(int varIndex, long coefficient, long offset)
-
-
Method Details
-
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
-