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.long
getCoefficient
(int index) Returns the ith coefficient.long
Returns the constant part of the expression.int
getVariableIndex
(int index) Returns the index of the ith variable.int
Returns 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:LinearArgument
Builds a linear expression.- Specified by:
build
in interfaceLinearArgument
-
numElements
public int numElements()Description copied from interface:LinearExpr
Returns the number of terms (excluding the constant one) in this expression.- Specified by:
numElements
in interfaceLinearExpr
-
getVariableIndex
public int getVariableIndex(int index) Description copied from interface:LinearExpr
Returns the index of the ith variable.- Specified by:
getVariableIndex
in interfaceLinearExpr
-
getCoefficient
public long getCoefficient(int index) Description copied from interface:LinearExpr
Returns the ith coefficient.- Specified by:
getCoefficient
in interfaceLinearExpr
-
getOffset
public long getOffset()Description copied from interface:LinearExpr
Returns the constant part of the expression.- Specified by:
getOffset
in interfaceLinearExpr
-