Java Reference

Java Reference

Detailed Description

A specialized linear expression: a * x + b.

Definition at line 17 of file

Public Member Functions

 AffineExpression (int varIndex, long coefficient, long 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...
long getCoefficient (int index)
 Returns the ith coefficient. More...
long getOffset ()
 Returns the constant part of the expression. More...

Static Public Member Functions

static LinearExprBuilder newBuilder ()
 Returns a builder. More...
static LinearExpr constant (long value)
 Shortcut for newBuilder().add(value).build() More...
static LinearExpr term (LinearArgument expr, long coeff)
 Shortcut for newBuilder().addTerm(expr, coeff).build() More...
static LinearExpr affine (LinearArgument expr, long coeff, long 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, long[] coeffs)
 Shortcut for newBuilder().addWeightedSum(exprs, coeffs).build() More...
static LinearExpr rebuildFromLinearExpressionProto (LinearExpressionProto proto)

Constructor & Destructor Documentation

◆ AffineExpression()

AffineExpression ( int  varIndex,
long  coefficient,
long  offset 

Definition at line 22 of file

Member Function Documentation

◆ affine()

static LinearExpr affine ( LinearArgument  expr,
long  coeff,
long  offset 

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

Definition at line 48 of file

◆ build()

LinearExpr build ( )

Builds a linear expression.

Implements LinearArgument.

Definition at line 30 of file

◆ constant()

static LinearExpr constant ( long  value)

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

Definition at line 38 of file

◆ getCoefficient()

long getCoefficient ( int  index)

Returns the ith coefficient.

Implements LinearExpr.

Definition at line 49 of file

◆ getOffset()

long getOffset ( )

Returns the constant part of the expression.

Implements LinearExpr.

Definition at line 57 of file

◆ getVariableIndex()

int getVariableIndex ( int  index)

Returns the index of the ith variable.

Implements LinearExpr.

Definition at line 41 of file

◆ newBuilder()

static LinearExprBuilder newBuilder ( )

Returns a builder.

Definition at line 33 of file

◆ numElements()

int numElements ( )

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

Implements LinearExpr.

Definition at line 36 of file

◆ rebuildFromLinearExpressionProto()

static LinearExpr rebuildFromLinearExpressionProto ( LinearExpressionProto  proto)

Definition at line 62 of file

◆ sum()

static LinearExpr sum ( LinearArgument[]  exprs)

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

Definition at line 53 of file

◆ term()

static LinearExpr term ( LinearArgument  expr,
long  coeff 

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

Definition at line 43 of file

◆ weightedSum()

static LinearExpr weightedSum ( LinearArgument[]  exprs,
long[]  coeffs 

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

Definition at line 58 of file

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