public interface LinearExpr extends LinearArgument
Modifier and Type | Method and Description |
---|---|
static LinearExpr |
affine(LinearArgument expr,
double coeff,
double offset)
Shortcut for newBuilder().addTerm(expr, coeff).add(offset).build()
|
static LinearExpr |
constant(double value)
Shortcut for newBuilder().add(value).build()
|
double |
getCoefficient(int index)
Returns the ith coefficient.
|
double |
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 |
sum(LinearArgument[] exprs)
Shortcut for newBuilder().addSum(exprs).build()
|
static LinearExpr |
term(LinearArgument expr,
double coeff)
Shortcut for newBuilder().addTerm(expr, coeff).build()
|
static LinearExpr |
weightedSum(LinearArgument[] exprs,
double[] coeffs)
Shortcut for newBuilder().addWeightedSum(exprs, coeffs).build()
|
build
int numElements()
int getVariableIndex(int index)
double getCoefficient(int index)
double getOffset()
static LinearExprBuilder newBuilder()
static LinearExpr constant(double value)
static LinearExpr term(LinearArgument expr, double coeff)
static LinearExpr affine(LinearArgument expr, double coeff, double offset)
static LinearExpr sum(LinearArgument[] exprs)
static LinearExpr weightedSum(LinearArgument[] exprs, double[] coeffs)
Copyright © 2025. All rights reserved.