public interface LinearExpr extends LinearArgument
Modifier and Type | Method and Description |
---|---|
static LinearExpr |
affine(LinearArgument expr,
long coeff,
long offset)
Shortcut for newBuilder().addTerm(expr, coeff).add(offset).build()
|
static LinearExpr |
constant(long value)
Shortcut for newBuilder().add(value).build()
|
long |
getCoefficient(int index)
Returns the ith coefficient.
|
long |
getOffset()
Returns the constant part of the expression.
|
int |
getVariableIndex(int index)
Returns the index of the ith variable.
|
static LinearExprBuilder |
newBuilder()
Returns a builder
|
int |
numElements()
Returns the number of terms (excluding the constant one) in this expression.
|
static LinearExpr |
rebuildFromLinearExpressionProto(LinearExpressionProto proto) |
static LinearExpr |
sum(LinearArgument[] exprs)
Shortcut for newBuilder().addSum(exprs).build()
|
static LinearExpr |
term(LinearArgument expr,
long coeff)
Shortcut for newBuilder().addTerm(expr, coeff).build()
|
static LinearExpr |
weightedSum(LinearArgument[] exprs,
long[] coeffs)
Shortcut for newBuilder().addWeightedSum(exprs, coeffs).build()
|
build
int numElements()
int getVariableIndex(int index)
long getCoefficient(int index)
long getOffset()
static LinearExprBuilder newBuilder()
static LinearExpr constant(long value)
static LinearExpr term(LinearArgument expr, long coeff)
static LinearExpr affine(LinearArgument expr, long coeff, long offset)
static LinearExpr sum(LinearArgument[] exprs)
static LinearExpr weightedSum(LinearArgument[] exprs, long[] coeffs)
static LinearExpr rebuildFromLinearExpressionProto(LinearExpressionProto proto)
Copyright © 2025. All rights reserved.