OR-Tools  9.6
LinearExpression

Detailed Description

Definition at line 200 of file variable_and_expressions.h.

Public Member Functions

 LinearExpression ()=default
 
 LinearExpression (std::initializer_list< LinearTerm > terms, double offset)
 
 LinearExpression (double offset)
 
 LinearExpression (Variable variable)
 
 LinearExpression (const LinearTerm &term)
 
LinearExpressionoperator+= (const LinearExpression &other)
 
LinearExpressionoperator+= (const LinearTerm &term)
 
LinearExpressionoperator+= (Variable variable)
 
LinearExpressionoperator+= (double value)
 
LinearExpressionoperator-= (const LinearExpression &other)
 
LinearExpressionoperator-= (const LinearTerm &term)
 
LinearExpressionoperator-= (Variable variable)
 
LinearExpressionoperator-= (double value)
 
LinearExpressionoperator*= (double value)
 
LinearExpressionoperator/= (double value)
 
template<typename Iterable >
void AddSum (const Iterable &items)
 
template<typename LeftIterable , typename RightIterable >
void AddInnerProduct (const LeftIterable &left, const RightIterable &right)
 
const VariableMap< double > & terms () const
 
double offset () const
 
double Evaluate (const VariableMap< double > &variable_values) const
 
double EvaluateWithDefaultZero (const VariableMap< double > &variable_values) const
 
const ModelStoragestorage () const
 
const absl::flat_hash_map< VariableId, double > & raw_terms () const
 

Static Public Member Functions

template<typename Iterable >
static LinearExpression Sum (const Iterable &items)
 
template<typename LeftIterable , typename RightIterable >
static LinearExpression InnerProduct (const LeftIterable &left, const RightIterable &right)
 

Constructor & Destructor Documentation

◆ LinearExpression() [1/5]

LinearExpression ( )
default

◆ LinearExpression() [2/5]

LinearExpression ( std::initializer_list< LinearTerm terms,
double  offset 
)
inline

Definition at line 1345 of file variable_and_expressions.h.

◆ LinearExpression() [3/5]

LinearExpression ( double  offset)
inline

Definition at line 1358 of file variable_and_expressions.h.

◆ LinearExpression() [4/5]

LinearExpression ( Variable  variable)
inline

Definition at line 1361 of file variable_and_expressions.h.

◆ LinearExpression() [5/5]

LinearExpression ( const LinearTerm term)
inline

Definition at line 1364 of file variable_and_expressions.h.

Member Function Documentation

◆ AddInnerProduct()

void AddInnerProduct ( const LeftIterable &  left,
const RightIterable &  right 
)
inline

Definition at line 1620 of file variable_and_expressions.h.

◆ AddSum()

void AddSum ( const Iterable &  items)
inline

Definition at line 1579 of file variable_and_expressions.h.

◆ Evaluate()

double Evaluate ( const VariableMap< double > &  variable_values) const

Definition at line 71 of file variable_and_expressions.cc.

◆ EvaluateWithDefaultZero()

double EvaluateWithDefaultZero ( const VariableMap< double > &  variable_values) const

Definition at line 85 of file variable_and_expressions.cc.

◆ InnerProduct()

LinearExpression InnerProduct ( const LeftIterable &  left,
const RightIterable &  right 
)
inlinestatic

Definition at line 1626 of file variable_and_expressions.h.

◆ offset()

double offset ( ) const
inline

Definition at line 1641 of file variable_and_expressions.h.

◆ operator*=()

LinearExpression & operator*= ( double  value)
inline

Definition at line 1562 of file variable_and_expressions.h.

◆ operator+=() [1/4]

LinearExpression & operator+= ( const LinearExpression other)
inline

Definition at line 1522 of file variable_and_expressions.h.

◆ operator+=() [2/4]

LinearExpression & operator+= ( const LinearTerm term)
inline

Definition at line 1528 of file variable_and_expressions.h.

◆ operator+=() [3/4]

LinearExpression & operator+= ( double  value)
inline

Definition at line 1537 of file variable_and_expressions.h.

◆ operator+=() [4/4]

LinearExpression & operator+= ( Variable  variable)
inline

Definition at line 1533 of file variable_and_expressions.h.

◆ operator-=() [1/4]

LinearExpression & operator-= ( const LinearExpression other)
inline

Definition at line 1542 of file variable_and_expressions.h.

◆ operator-=() [2/4]

LinearExpression & operator-= ( const LinearTerm term)
inline

Definition at line 1548 of file variable_and_expressions.h.

◆ operator-=() [3/4]

LinearExpression & operator-= ( double  value)
inline

Definition at line 1557 of file variable_and_expressions.h.

◆ operator-=() [4/4]

LinearExpression & operator-= ( Variable  variable)
inline

Definition at line 1553 of file variable_and_expressions.h.

◆ operator/=()

LinearExpression & operator/= ( double  value)
inline

Definition at line 1570 of file variable_and_expressions.h.

◆ raw_terms()

const absl::flat_hash_map< VariableId, double > & raw_terms ( ) const
inline

Definition at line 1647 of file variable_and_expressions.h.

◆ storage()

const ModelStorage * storage ( ) const
inline

Definition at line 1643 of file variable_and_expressions.h.

◆ Sum()

LinearExpression Sum ( const Iterable &  items)
inlinestatic

Definition at line 1586 of file variable_and_expressions.h.

◆ terms()

const VariableMap< double > & terms ( ) const
inline

Definition at line 1639 of file variable_and_expressions.h.


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