Limbo 3.5.4
Loading...
Searching...
No Matches
limbo::solvers::LinearTerm< T > Class Template Reference

Linear term. More...

#include <Solvers.h>

Public Types

typedef T coefficient_value_type
 coefficient type
typedef Variable< coefficient_value_typevariable_type
 variable type

Public Member Functions

 LinearTerm (variable_type var=variable_type(), coefficient_value_type coef=1)
 constructor
 LinearTerm (LinearTerm const &rhs)
 copy constructor
LinearTermoperator= (LinearTerm const &rhs)
 assignment
 ~LinearTerm ()
 destructor
variable_type const & variable () const
void setVariable (variable_type const &var)
coefficient_value_type coefficient () const
void setCoefficient (coefficient_value_type coef)
LinearTerm operator- () const
LinearTermnegate ()
LinearTermoperator*= (coefficient_value_type coef)
LinearTermoperator/= (coefficient_value_type coef)
bool operator== (LinearTerm const &rhs) const

Protected Member Functions

void copy (LinearTerm const &rhs)
 copy object

Protected Attributes

variable_type m_var
 variable
coefficient_value_type m_coef
 coefficient

Friends

LinearTerm operator* (LinearTerm const &term, coefficient_value_type coef)
LinearTerm operator* (coefficient_value_type coef, LinearTerm const &term)
LinearTerm operator/ (LinearTerm const &term, coefficient_value_type coef)
LinearExpression< coefficient_value_typeoperator+ (LinearTerm const &term, coefficient_value_type constant)
LinearExpression< coefficient_value_typeoperator+ (LinearTerm const &term, variable_type const &var)
LinearExpression< coefficient_value_typeoperator+ (coefficient_value_type constant, LinearTerm const &term)
LinearExpression< coefficient_value_typeoperator+ (variable_type const &var, LinearTerm const &term)
LinearExpression< coefficient_value_typeoperator+ (LinearTerm const &term1, LinearTerm const &term2)
LinearExpression< coefficient_value_typeoperator- (LinearTerm const &term, coefficient_value_type constant)
LinearExpression< coefficient_value_typeoperator- (LinearTerm const &term, variable_type const &var)
LinearExpression< coefficient_value_typeoperator- (variable_type const &var, LinearTerm const &term)
LinearExpression< coefficient_value_typeoperator- (coefficient_value_type constant, LinearTerm const &term)
LinearExpression< coefficient_value_typeoperator- (LinearTerm const &term1, LinearTerm const &term2)
LinearConstraint< coefficient_value_typeoperator< (LinearTerm const &term, coefficient_value_type rhs)
 overload <
LinearConstraint< coefficient_value_typeoperator<= (LinearTerm const &term, coefficient_value_type rhs)
 overload <=, same as <
LinearConstraint< coefficient_value_typeoperator> (LinearTerm const &term, coefficient_value_type rhs)
 overload >
LinearConstraint< coefficient_value_typeoperator>= (LinearTerm const &term, coefficient_value_type rhs)
 overload >=, same as >
LinearConstraint< coefficient_value_typeoperator== (LinearTerm const &term, coefficient_value_type rhs)

Detailed Description

template<typename T>
class limbo::solvers::LinearTerm< T >

Linear term.

Template Parameters
Tcoefficient type

Definition at line 348 of file Solvers.h.

Member Typedef Documentation

◆ coefficient_value_type

template<typename T>
typedef T limbo::solvers::LinearTerm< T >::coefficient_value_type

coefficient type

Definition at line 352 of file Solvers.h.

◆ variable_type

template<typename T>
typedef Variable<coefficient_value_type> limbo::solvers::LinearTerm< T >::variable_type

variable type

Definition at line 354 of file Solvers.h.

Constructor & Destructor Documentation

◆ LinearTerm() [1/2]

template<typename T>
limbo::solvers::LinearTerm< T >::LinearTerm ( variable_type var = variable_type(),
coefficient_value_type coef = 1 )
inline

constructor

Parameters
varvariable
coefcoefficient

Definition at line 359 of file Solvers.h.

◆ LinearTerm() [2/2]

template<typename T>
limbo::solvers::LinearTerm< T >::LinearTerm ( LinearTerm< T > const & rhs)
inline

copy constructor

Parameters
rhsright hand side

Definition at line 366 of file Solvers.h.

◆ ~LinearTerm()

template<typename T>
limbo::solvers::LinearTerm< T >::~LinearTerm ( )
inline

destructor

Definition at line 379 of file Solvers.h.

Member Function Documentation

◆ coefficient()

template<typename T>
coefficient_value_type limbo::solvers::LinearTerm< T >::coefficient ( ) const
inline
Returns
coefficient

Definition at line 388 of file Solvers.h.

◆ copy()

template<typename T>
void limbo::solvers::LinearTerm< T >::copy ( LinearTerm< T > const & rhs)
inlineprotected

copy object

Parameters
rhsright hand side

Definition at line 579 of file Solvers.h.

◆ negate()

template<typename T>
LinearTerm & limbo::solvers::LinearTerm< T >::negate ( )
inline

self-negation

Returns
the object

Definition at line 401 of file Solvers.h.

◆ operator*=()

template<typename T>
LinearTerm & limbo::solvers::LinearTerm< T >::operator*= ( coefficient_value_type coef)
inline

overload multiply and assignment

Parameters
coefcoefficient
Returns
reference to the object

Definition at line 427 of file Solvers.h.

◆ operator-()

template<typename T>
LinearTerm limbo::solvers::LinearTerm< T >::operator- ( ) const
inline

overload negation

Returns
a copy of new object

Definition at line 394 of file Solvers.h.

◆ operator/=()

template<typename T>
LinearTerm & limbo::solvers::LinearTerm< T >::operator/= ( coefficient_value_type coef)
inline

overload divide and assignment

Parameters
coefcoefficient
Returns
reference to the object

Definition at line 445 of file Solvers.h.

◆ operator=()

template<typename T>
LinearTerm & limbo::solvers::LinearTerm< T >::operator= ( LinearTerm< T > const & rhs)
inline

assignment

Parameters
rhsright hand side

Definition at line 372 of file Solvers.h.

◆ operator==()

template<typename T>
bool limbo::solvers::LinearTerm< T >::operator== ( LinearTerm< T > const & rhs) const
inline

overload equal

Parameters
rhsright hand side
Returns
true if two terms are equal

Definition at line 572 of file Solvers.h.

◆ setCoefficient()

template<typename T>
void limbo::solvers::LinearTerm< T >::setCoefficient ( coefficient_value_type coef)
inline
Parameters
coefcoefficient

Definition at line 390 of file Solvers.h.

◆ setVariable()

template<typename T>
void limbo::solvers::LinearTerm< T >::setVariable ( variable_type const & var)
inline
Parameters
varvariable

Definition at line 386 of file Solvers.h.

◆ variable()

template<typename T>
variable_type const & limbo::solvers::LinearTerm< T >::variable ( ) const
inline
Returns
variable

Definition at line 384 of file Solvers.h.

◆ operator* [1/2]

template<typename T>
LinearTerm operator* ( coefficient_value_type coef,
LinearTerm< T > const & term )
friend

overload a value multiply a term

Parameters
coefcoefficient
termterm
Returns
result object

Definition at line 420 of file Solvers.h.

◆ operator* [2/2]

template<typename T>
LinearTerm operator* ( LinearTerm< T > const & term,
coefficient_value_type coef )
friend

overload multiply by a value

Parameters
termterm
coefcoefficient
Returns
result object

Definition at line 410 of file Solvers.h.

◆ operator+ [1/5]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( coefficient_value_type constant,
LinearTerm< T > const & term )
friend

overload plus constant+term

Parameters
constantconstant
termterm
Returns
expression

Definition at line 470 of file Solvers.h.

◆ operator+ [2/5]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( LinearTerm< T > const & term,
coefficient_value_type constant )
friend

overload plus term+constant

Parameters
termterm
constantconstant
Returns
expression

Definition at line 454 of file Solvers.h.

◆ operator+ [3/5]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( LinearTerm< T > const & term,
variable_type const & var )
friend

overload plus term+var

Parameters
termterm
varvariable
Returns
expression

Definition at line 462 of file Solvers.h.

◆ operator+ [4/5]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( LinearTerm< T > const & term1,
LinearTerm< T > const & term2 )
friend

overload plus for two terms

Parameters
term1term
term2term
Returns
result expression

Definition at line 486 of file Solvers.h.

◆ operator+ [5/5]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( variable_type const & var,
LinearTerm< T > const & term )
friend

overload plus term+var

Parameters
termterm
varvariable
Returns
expression

Definition at line 478 of file Solvers.h.

◆ operator- [1/5]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( coefficient_value_type constant,
LinearTerm< T > const & term )
friend

overload minus constant-term

Parameters
constantconstant
termterm
Returns
expression

Definition at line 520 of file Solvers.h.

◆ operator- [2/5]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( LinearTerm< T > const & term,
coefficient_value_type constant )
friend

overload minus term-constant

Parameters
termterm
constantconstant
Returns
expression

Definition at line 496 of file Solvers.h.

◆ operator- [3/5]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( LinearTerm< T > const & term,
variable_type const & var )
friend

overload minus term-var

Parameters
termterm
varvariable
Returns
expression

Definition at line 504 of file Solvers.h.

◆ operator- [4/5]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( LinearTerm< T > const & term1,
LinearTerm< T > const & term2 )
friend

overload minus for two terms

Parameters
term1term
term2term
Returns
result expression

Definition at line 528 of file Solvers.h.

◆ operator- [5/5]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( variable_type const & var,
LinearTerm< T > const & term )
friend

overload minus var-term

Parameters
varvariable
termterm
Returns
expression

Definition at line 512 of file Solvers.h.

◆ operator/

template<typename T>
LinearTerm operator/ ( LinearTerm< T > const & term,
coefficient_value_type coef )
friend

overload divide by a value

Parameters
termterm
coefcoefficient
Returns
reference to the object

Definition at line 436 of file Solvers.h.

◆ operator<

template<typename T>
LinearConstraint< coefficient_value_type > operator< ( LinearTerm< T > const & term,
coefficient_value_type rhs )
friend

overload <

Parameters
termlinear term
rhsright hand side constant

Definition at line 537 of file Solvers.h.

◆ operator<=

template<typename T>
LinearConstraint< coefficient_value_type > operator<= ( LinearTerm< T > const & term,
coefficient_value_type rhs )
friend

overload <=, same as <

Parameters
termlinear term
rhsright hand side constant

Definition at line 544 of file Solvers.h.

◆ operator==

template<typename T>
LinearConstraint< coefficient_value_type > operator== ( LinearTerm< T > const & term,
coefficient_value_type rhs )
friend

overload ==

Parameters
termlinear term
rhsright hand side constant

Definition at line 565 of file Solvers.h.

◆ operator>

template<typename T>
LinearConstraint< coefficient_value_type > operator> ( LinearTerm< T > const & term,
coefficient_value_type rhs )
friend

overload >

Parameters
termlinear term
rhsright hand side constant

Definition at line 551 of file Solvers.h.

◆ operator>=

template<typename T>
LinearConstraint< coefficient_value_type > operator>= ( LinearTerm< T > const & term,
coefficient_value_type rhs )
friend

overload >=, same as >

Parameters
termlinear term
rhsright hand side constant

Definition at line 558 of file Solvers.h.

Member Data Documentation

◆ m_coef

template<typename T>
coefficient_value_type limbo::solvers::LinearTerm< T >::m_coef
protected

coefficient

Definition at line 586 of file Solvers.h.

◆ m_var

template<typename T>
variable_type limbo::solvers::LinearTerm< T >::m_var
protected

variable

Definition at line 585 of file Solvers.h.


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