Class AffineExpression
java.lang.Object
com.google.ortools.modelbuilder.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.double
getCoefficient
(int index) Returns the ith coefficient.double
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, double coefficient, double 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 double getCoefficient(int index) Description copied from interface:LinearExpr
Returns the ith coefficient.- Specified by:
getCoefficient
in interfaceLinearExpr
-
getOffset
public double getOffset()Description copied from interface:LinearExpr
Returns the constant part of the expression.- Specified by:
getOffset
in interfaceLinearExpr
-