C++ Reference: class LinearExpr

This documentation is automatically generated.

Method
AddConstant

Return type: LinearExpr&

Arguments: int64_t value

Adds a constant value to the linear expression.

AddTerm

Return type: void

Arguments: IntVar var, int64_t coeff

Adds a term (var * coeff) to the linear expression.

AddVar

Return type: void

Arguments: IntVar var

Adds a single integer variable to the linear expression.

BooleanScalProd

Return type: static LinearExpr

Arguments: absl::Span<const BoolVar> vars, absl::Span<const int64_t> coeffs

Constructs the scalar product of Booleans and coefficients.

BooleanSum

Return type: static LinearExpr

Arguments: absl::Span<const BoolVar> vars

Constructs the sum of a list of Booleans.

coefficients

Return type: const std::vector<int64_t>&

Returns the vector of coefficients.

constant

Return type: int64_t

Returns the constant term.

LinearExpr

LinearExpr

Arguments: BoolVar var

LinearExpr

Arguments: IntVar var

Constructs a linear expression from an integer variable.

LinearExpr

Arguments: int64_t constant

Constructs a constant linear expression.

ScalProd

Return type: static LinearExpr

Arguments: absl::Span<const IntVar> vars, absl::Span<const int64_t> coeffs

Constructs the scalar product of variables and coefficients.

Sum

Return type: static LinearExpr

Arguments: absl::Span<const IntVar> vars

Constructs the sum of a list of variables.

Term

Return type: static LinearExpr

Arguments: IntVar var, int64_t coefficient

Construncts var * coefficient.

variables

Return type: const std::vector<IntVar>&

Returns the vector of variables.