Java Reference

Java Reference

Detailed Description

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

It specifies methods to help parsing the expression.

Definition at line 19 of file sat/LinearExpr.java.

Public Member Functions

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...
 
LinearExpr build ()
 Builds a linear 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)
 

Member Function Documentation

◆ affine()

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

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

Definition at line 48 of file sat/LinearExpr.java.

◆ build()

LinearExpr build ( )
inherited

Builds a linear expression.

Implemented in WeightedSumExpression, NotBoolVar, LinearExprBuilder, IntVar, ConstantExpression, and AffineExpression.

◆ constant()

static LinearExpr constant ( long  value)
static

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

Definition at line 38 of file sat/LinearExpr.java.

◆ getCoefficient()

long getCoefficient ( int  index)

Returns the ith coefficient.

Implemented in WeightedSumExpression, ConstantExpression, and AffineExpression.

◆ getOffset()

long getOffset ( )

Returns the constant part of the expression.

Implemented in WeightedSumExpression, ConstantExpression, and AffineExpression.

◆ getVariableIndex()

int getVariableIndex ( int  index)

Returns the index of the ith variable.

Implemented in WeightedSumExpression, ConstantExpression, and AffineExpression.

◆ newBuilder()

static LinearExprBuilder newBuilder ( )
static

Returns a builder.

Definition at line 33 of file sat/LinearExpr.java.

◆ numElements()

int numElements ( )

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

Implemented in WeightedSumExpression, ConstantExpression, and AffineExpression.

◆ rebuildFromLinearExpressionProto()

static LinearExpr rebuildFromLinearExpressionProto ( LinearExpressionProto  proto)
static

Definition at line 62 of file sat/LinearExpr.java.

◆ sum()

static LinearExpr sum ( LinearArgument[]  exprs)
static

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

Definition at line 53 of file sat/LinearExpr.java.

◆ term()

static LinearExpr term ( LinearArgument  expr,
long  coeff 
)
static

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

Definition at line 43 of file sat/LinearExpr.java.

◆ weightedSum()

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

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

Definition at line 58 of file sat/LinearExpr.java.


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