Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::mb::FlatExpr Class Reference

A flat linear expression sum(vars[i] * coeffs[i]) + offset. More...

Detailed Description

A flat linear expression sum(vars[i] * coeffs[i]) + offset.

Definition at line 123 of file model_builder_helper.h.

#include <model_builder_helper.h>

Inheritance diagram for operations_research::mb::FlatExpr:
operations_research::mb::LinearExpr

Public Member Functions

 FlatExpr (std::shared_ptr< LinearExpr > expr)
 FlatExpr (std::shared_ptr< LinearExpr > pos, std::shared_ptr< LinearExpr > neg)
 Flatten pos - neg.
 FlatExpr (const std::vector< std::shared_ptr< Variable > > &, const std::vector< double > &, double)
 FlatExpr (double offset)
const std::vector< std::shared_ptr< Variable > > & vars () const
std::vector< int > VarIndices () const
const std::vector< double > & coeffs () const
double offset () const
void Visit (ExprVisitor &lin, double c) override
std::string ToString () const override
std::string DebugString () const override
Public Member Functions inherited from operations_research::mb::LinearExpr
virtual ~LinearExpr ()=default
std::shared_ptr< LinearExprAdd (std::shared_ptr< LinearExpr > expr)
virtual std::shared_ptr< LinearExprAddFloat (double cst)
std::shared_ptr< LinearExprSub (std::shared_ptr< LinearExpr > expr)
virtual std::shared_ptr< LinearExprSubFloat (double cst)
virtual std::shared_ptr< LinearExprRSubFloat (double cst)
virtual std::shared_ptr< LinearExprMulFloat (double cst)
virtual std::shared_ptr< LinearExprNeg ()
std::shared_ptr< BoundedLinearExpressionEq (std::shared_ptr< LinearExpr > rhs)
std::shared_ptr< BoundedLinearExpressionEqCst (double rhs)
std::shared_ptr< BoundedLinearExpressionGe (std::shared_ptr< LinearExpr > rhs)
std::shared_ptr< BoundedLinearExpressionGeCst (double rhs)
std::shared_ptr< BoundedLinearExpressionLe (std::shared_ptr< LinearExpr > rhs)
std::shared_ptr< BoundedLinearExpressionLeCst (double rhs)

Additional Inherited Members

Static Public Member Functions inherited from operations_research::mb::LinearExpr
static std::shared_ptr< LinearExprTerm (std::shared_ptr< LinearExpr > expr, double coeff)
 Expressions.
static std::shared_ptr< LinearExprAffine (std::shared_ptr< LinearExpr > expr, double coeff, double constant)
static std::shared_ptr< LinearExprAffineCst (double value, double coeff, double constant)
static std::shared_ptr< LinearExprConstant (double value)

Constructor & Destructor Documentation

◆ FlatExpr() [1/4]

operations_research::mb::FlatExpr::FlatExpr ( std::shared_ptr< LinearExpr > expr)
explicit

Definition at line 892 of file model_builder_helper.cc.

◆ FlatExpr() [2/4]

operations_research::mb::FlatExpr::FlatExpr ( std::shared_ptr< LinearExpr > pos,
std::shared_ptr< LinearExpr > neg )

Flatten pos - neg.

Definition at line 898 of file model_builder_helper.cc.

◆ FlatExpr() [3/4]

operations_research::mb::FlatExpr::FlatExpr ( const std::vector< std::shared_ptr< Variable > > & vars,
const std::vector< double > & coeffs,
double offset )

Definition at line 906 of file model_builder_helper.cc.

◆ FlatExpr() [4/4]

operations_research::mb::FlatExpr::FlatExpr ( double offset)
explicit

Definition at line 910 of file model_builder_helper.cc.

Member Function Documentation

◆ coeffs()

const std::vector< double > & operations_research::mb::FlatExpr::coeffs ( ) const
inline

Definition at line 133 of file model_builder_helper.h.

◆ DebugString()

std::string operations_research::mb::FlatExpr::DebugString ( ) const
overridevirtual

Implements operations_research::mb::LinearExpr.

Definition at line 977 of file model_builder_helper.cc.

◆ offset()

double operations_research::mb::FlatExpr::offset ( ) const
inline

Definition at line 134 of file model_builder_helper.h.

◆ ToString()

std::string operations_research::mb::FlatExpr::ToString ( ) const
overridevirtual

If there are no terms, just print the offset.

If there is an offset, print it.

Implements operations_research::mb::LinearExpr.

Definition at line 928 of file model_builder_helper.cc.

◆ VarIndices()

std::vector< int > operations_research::mb::FlatExpr::VarIndices ( ) const

Definition at line 912 of file model_builder_helper.cc.

◆ vars()

const std::vector< std::shared_ptr< Variable > > & operations_research::mb::FlatExpr::vars ( ) const
inline

Definition at line 131 of file model_builder_helper.h.

◆ Visit()

void operations_research::mb::FlatExpr::Visit ( ExprVisitor & lin,
double c )
overridevirtual

Implements operations_research::mb::LinearExpr.

Definition at line 921 of file model_builder_helper.cc.


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