Class WeightedSumExpression
java.lang.Object
com.google.ortools.modelbuilder.WeightedSumExpression
- All Implemented Interfaces:
LinearArgument,LinearExpr
A specialized linear expression: sum(ai * xi) + b.
-
Constructor Summary
ConstructorsConstructorDescriptionWeightedSumExpression(int[] variablesIndices, double[] coefficients, double offset) -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a linear expression.doublegetCoefficient(int index) Returns the ith coefficient.doubleReturns 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
-
WeightedSumExpression
public WeightedSumExpression(int[] variablesIndices, double[] coefficients, double 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 double getCoefficient(int index) Description copied from interface:LinearExprReturns the ith coefficient.- Specified by:
getCoefficientin interfaceLinearExpr
-
getOffset
public double getOffset()Description copied from interface:LinearExprReturns the constant part of the expression.- Specified by:
getOffsetin interfaceLinearExpr
-