Class WeightedSumExpression
java.lang.Object
com.google.ortools.sat.WeightedSumExpression
- All Implemented Interfaces:
LinearArgument
,LinearExpr
A specialized linear expression: sum(ai * xi) + b.
-
Constructor Summary
ConstructorsConstructorDescriptionWeightedSumExpression
(int[] variablesIndices, long[] coefficients, long offset) -
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
-
WeightedSumExpression
public WeightedSumExpression(int[] variablesIndices, long[] coefficients, 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
-