Java Reference

Java Reference

Detailed Description

A specialized linear expression: sum(ai * xi) + b.

Definition at line 17 of file modelbuilder/WeightedSumExpression.java.

Public Member Functions

 WeightedSumExpression (int[] variablesIndices, double[] coefficients, double offset)
 
LinearExpr build ()
 Builds a linear expression. More...
 
int numElements ()
 Returns the number of terms (excluding the constant one) in this expression. More...
 
int getVariableIndex (int index)
 Returns the index of the ith variable. More...
 
double getCoefficient (int index)
 Returns the ith coefficient. More...
 
double getOffset ()
 Returns the constant part of the expression. More...
 

Static Public Member Functions

static LinearExprBuilder newBuilder ()
 Returns a builder. More...
 
static LinearExpr constant (double value)
 Shortcut for newBuilder().add(value).build() More...
 
static LinearExpr term (LinearArgument expr, double coeff)
 Shortcut for newBuilder().addTerm(expr, coeff).build() More...
 
static LinearExpr affine (LinearArgument expr, double coeff, double offset)
 Shortcut for newBuilder().addTerm(expr, coeff).add(offset).build() More...
 
static LinearExpr sum (LinearArgument[] exprs)
 Shortcut for newBuilder().addSum(exprs).build() More...
 
static LinearExpr weightedSum (LinearArgument[] exprs, double[] coeffs)
 Shortcut for newBuilder().addWeightedSum(exprs, coeffs).build() More...
 

Constructor & Destructor Documentation

◆ WeightedSumExpression()

WeightedSumExpression ( int[]  variablesIndices,
double[]  coefficients,
double  offset 
)

Definition at line 22 of file modelbuilder/WeightedSumExpression.java.

Member Function Documentation

◆ affine()

static LinearExpr affine ( LinearArgument  expr,
double  coeff,
double  offset 
)
staticinherited

Shortcut for newBuilder().addTerm(expr, coeff).add(offset).build()

Definition at line 46 of file modelbuilder/LinearExpr.java.

◆ build()

LinearExpr build ( )

Builds a linear expression.

Implements LinearArgument.

Definition at line 29 of file modelbuilder/WeightedSumExpression.java.

◆ constant()

static LinearExpr constant ( double  value)
staticinherited

Shortcut for newBuilder().add(value).build()

Definition at line 36 of file modelbuilder/LinearExpr.java.

◆ getCoefficient()

double getCoefficient ( int  index)

Returns the ith coefficient.

Implements LinearExpr.

Definition at line 47 of file modelbuilder/WeightedSumExpression.java.

◆ getOffset()

double getOffset ( )

Returns the constant part of the expression.

Implements LinearExpr.

Definition at line 55 of file modelbuilder/WeightedSumExpression.java.

◆ getVariableIndex()

int getVariableIndex ( int  index)

Returns the index of the ith variable.

Implements LinearExpr.

Definition at line 39 of file modelbuilder/WeightedSumExpression.java.

◆ newBuilder()

static LinearExprBuilder newBuilder ( )
staticinherited

Returns a builder.

Definition at line 31 of file modelbuilder/LinearExpr.java.

◆ numElements()

int numElements ( )

Returns the number of terms (excluding the constant one) in this expression.

Implements LinearExpr.

Definition at line 34 of file modelbuilder/WeightedSumExpression.java.

◆ sum()

static LinearExpr sum ( LinearArgument[]  exprs)
staticinherited

Shortcut for newBuilder().addSum(exprs).build()

Definition at line 51 of file modelbuilder/LinearExpr.java.

◆ term()

static LinearExpr term ( LinearArgument  expr,
double  coeff 
)
staticinherited

Shortcut for newBuilder().addTerm(expr, coeff).build()

Definition at line 41 of file modelbuilder/LinearExpr.java.

◆ weightedSum()

static LinearExpr weightedSum ( LinearArgument[]  exprs,
double[]  coeffs 
)
staticinherited

Shortcut for newBuilder().addWeightedSum(exprs, coeffs).build()

Definition at line 56 of file modelbuilder/LinearExpr.java.


The documentation for this class was generated from the following file: