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

Describe variables in optimization problem. More...

#include <Solvers.h>

Public Types

typedef T coefficient_value_type
 coefficient type

Public Member Functions

 Variable (unsigned int id=std::numeric_limits< unsigned int >::max())
 constructor
 Variable (Variable const &rhs)
 copy constructor
Variableoperator= (Variable const &rhs)
 assignment
 ~Variable ()
 destructor
unsigned int id () const
void setId (unsigned int id)
 set variable index
bool valid () const
bool operator== (Variable const &rhs) const
bool operator!= (Variable const &rhs) const
LinearTerm< coefficient_value_typeoperator- () const

Protected Member Functions

void copy (Variable const &rhs)
 copy object

Protected Attributes

unsigned int m_id
 variable index

Friends

LinearTerm< coefficient_value_typeoperator* (Variable const &var, coefficient_value_type coef)
LinearTerm< coefficient_value_typeoperator* (coefficient_value_type coef, Variable const &var)
LinearTerm< coefficient_value_typeoperator/ (Variable const &var, coefficient_value_type coef)
LinearExpression< coefficient_value_typeoperator+ (Variable const &var, coefficient_value_type constant)
LinearExpression< coefficient_value_typeoperator+ (coefficient_value_type constant, Variable const &var)
LinearExpression< coefficient_value_typeoperator+ (Variable const &var1, Variable const &var2)
LinearExpression< coefficient_value_typeoperator- (Variable const &var, coefficient_value_type constant)
LinearExpression< coefficient_value_typeoperator- (coefficient_value_type constant, Variable const &var)
LinearExpression< coefficient_value_typeoperator- (Variable const &var1, Variable const &var2)
LinearConstraint< coefficient_value_typeoperator< (Variable const &var, coefficient_value_type rhs)
 overload <
LinearConstraint< coefficient_value_typeoperator<= (Variable const &var, coefficient_value_type rhs)
 overload <=
LinearConstraint< coefficient_value_typeoperator> (Variable const &var, coefficient_value_type rhs)
 overload >
LinearConstraint< coefficient_value_typeoperator>= (Variable const &var, coefficient_value_type rhs)
 overload >=
LinearConstraint< coefficient_value_typeoperator== (Variable const &var, coefficient_value_type rhs)
 overload ==

Detailed Description

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

Describe variables in optimization problem.

Template Parameters
Tcoefficient type of the variable, not the value type of variable itself. It is necessary for operator overloading

Definition at line 87 of file Solvers.h.

Member Typedef Documentation

◆ coefficient_value_type

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

coefficient type

Definition at line 91 of file Solvers.h.

Constructor & Destructor Documentation

◆ Variable() [1/2]

template<typename T>
limbo::solvers::Variable< T >::Variable ( unsigned int id = std::numeric_limits<unsigned int>::max())
inlineexplicit

constructor

Parameters
idvariable index

Definition at line 95 of file Solvers.h.

◆ Variable() [2/2]

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

copy constructor

Parameters
rhsright hand side

Definition at line 101 of file Solvers.h.

◆ ~Variable()

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

destructor

Definition at line 114 of file Solvers.h.

Member Function Documentation

◆ copy()

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

copy object

Definition at line 255 of file Solvers.h.

◆ id()

template<typename T>
unsigned int limbo::solvers::Variable< T >::id ( ) const
inline
Returns
variable index

Definition at line 117 of file Solvers.h.

◆ operator!=()

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

overload inequal

Parameters
rhsright hand side
Returns
true if the indices of variables are equal

Definition at line 135 of file Solvers.h.

◆ operator-()

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

overload negation

Returns
a copy of new object

Definition at line 141 of file Solvers.h.

◆ operator=()

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

assignment

Parameters
rhsright hand side

Definition at line 107 of file Solvers.h.

◆ operator==()

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

overload equal

Parameters
rhsright hand side
Returns
true if the indices of variables are equal

Definition at line 128 of file Solvers.h.

◆ setId()

template<typename T>
void limbo::solvers::Variable< T >::setId ( unsigned int id)
inline

set variable index

Parameters
idindex

Definition at line 120 of file Solvers.h.

◆ valid()

template<typename T>
bool limbo::solvers::Variable< T >::valid ( ) const
inline
Returns
true if the variable is valid

Definition at line 123 of file Solvers.h.

◆ operator* [1/2]

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

overload multiply coef*var

Parameters
varvariable
coefcoefficient
Returns
result object

Definition at line 158 of file Solvers.h.

◆ operator* [2/2]

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

overload multiply var*coef

Parameters
varvariable
coefcoefficient
Returns
result object

Definition at line 150 of file Solvers.h.

◆ operator+ [1/3]

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

overload plus constant+var

Parameters
constantcoefficient
varvariable
Returns
result object

Definition at line 182 of file Solvers.h.

◆ operator+ [2/3]

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

overload plus var+constant

Parameters
varvariable
constantconstant
Returns
result object

Definition at line 174 of file Solvers.h.

◆ operator+ [3/3]

template<typename T>
LinearExpression< coefficient_value_type > operator+ ( Variable< T > const & var1,
Variable< T > const & var2 )
friend

overload plus var+var

Parameters
var1variable
var2variable
Returns
result object

Definition at line 190 of file Solvers.h.

◆ operator- [1/3]

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

overload minus constant-var

Parameters
constantcoefficient
varvariable
Returns
result object

Definition at line 206 of file Solvers.h.

◆ operator- [2/3]

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

overload minus var-constant

Parameters
varvariable
constantcoefficient
Returns
result object

Definition at line 198 of file Solvers.h.

◆ operator- [3/3]

template<typename T>
LinearExpression< coefficient_value_type > operator- ( Variable< T > const & var1,
Variable< T > const & var2 )
friend

overload minus var-var

Parameters
var1variable
var2variable
Returns
result object

Definition at line 214 of file Solvers.h.

◆ operator/

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

overload divide var/coef

Parameters
varvariable
coefcoefficient
Returns
result object

Definition at line 166 of file Solvers.h.

◆ operator<

template<typename T>
LinearConstraint< coefficient_value_type > operator< ( Variable< T > const & var,
coefficient_value_type rhs )
friend

overload <

Parameters
varvariable
rhsright hand side constant

Definition at line 221 of file Solvers.h.

◆ operator<=

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

overload <=

Parameters
varvariable
rhsright hand side constant

Definition at line 228 of file Solvers.h.

◆ operator==

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

overload ==

Parameters
varvariable
rhsright hand side constant

Definition at line 249 of file Solvers.h.

◆ operator>

template<typename T>
LinearConstraint< coefficient_value_type > operator> ( Variable< T > const & var,
coefficient_value_type rhs )
friend

overload >

Parameters
varvariable
rhsright hand side constant

Definition at line 235 of file Solvers.h.

◆ operator>=

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

overload >=

Parameters
varvariable
rhsright hand side constant

Definition at line 242 of file Solvers.h.

Member Data Documentation

◆ m_id

template<typename T>
unsigned int limbo::solvers::Variable< T >::m_id
protected

variable index

Definition at line 260 of file Solvers.h.


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