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

Describe linear constraint. More...

#include <Solvers.h>

Public Types

typedef T coefficient_value_type
 coefficient type
typedef Variable< coefficient_value_typevariable_type
 variable type
typedef LinearTerm< coefficient_value_typeterm_type
 term type
typedef LinearExpression< coefficient_value_typeexpression_type
 expression type

Public Member Functions

 LinearConstraint (expression_type expr=expression_type(), coefficient_value_type rhs=0, char s='<')
 constructor
 LinearConstraint (LinearConstraint const &rhs)
 copy constructor
LinearConstraintoperator= (LinearConstraint const &rhs)
 assignment
 ~LinearConstraint ()
 destructor
unsigned int id () const
void setId (unsigned int i)
expression_type const & expression () const
void setExpression (expression_type const &expr)
void emplaceExpression (expression_type &expr)
coefficient_value_type rightHandSide () const
void setRightHandSide (coefficient_value_type rhs)
char sense () const
void setSense (char s)
void swap (LinearConstraint &rhs)
 swap with a constraint
void simplify ()
 simplify expression by merge terms of the same variables
void normalize (char s)
 normalize sense
void scale (coefficient_value_type factor)
 scale constraint by a scaling factor
void clearConstant ()
 move the constant in the expression to rhs For example, x + 5 < 10 will become x < 5
void reserve (unsigned int n)
 reserve space for expression terms
LinearConstraintoperator+= (term_type const &term)
LinearConstraintoperator+= (expression_type const &expr)
LinearConstraintoperator-= (term_type term)
LinearConstraintoperator-= (expression_type const &expr)

Protected Member Functions

void copy (LinearConstraint const &rhs)
 copy object

Protected Attributes

unsigned int m_id
 constraint index
expression_type m_expr
 linear expression
coefficient_value_type m_rhs
 constant at the right hand side
char m_sense
 sign of operator, < (<=), > (>=), = (==)

Detailed Description

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

Describe linear constraint.

Template Parameters
Tcoefficient type

Definition at line 982 of file Solvers.h.

Member Typedef Documentation

◆ coefficient_value_type

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

coefficient type

Definition at line 986 of file Solvers.h.

◆ expression_type

template<typename T>
typedef LinearExpression<coefficient_value_type> limbo::solvers::LinearConstraint< T >::expression_type

expression type

Definition at line 992 of file Solvers.h.

◆ term_type

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

term type

Definition at line 990 of file Solvers.h.

◆ variable_type

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

variable type

Definition at line 988 of file Solvers.h.

Constructor & Destructor Documentation

◆ LinearConstraint() [1/2]

template<typename T>
limbo::solvers::LinearConstraint< T >::LinearConstraint ( expression_type expr = expression_type(),
coefficient_value_type rhs = 0,
char s = '<' )
inline

constructor

Parameters
exprexpression
rhsright hand side
ssense

Definition at line 998 of file Solvers.h.

◆ LinearConstraint() [2/2]

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

copy constructor

Definition at line 1007 of file Solvers.h.

◆ ~LinearConstraint()

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

destructor

Definition at line 1019 of file Solvers.h.

Member Function Documentation

◆ clearConstant()

template<typename T>
void limbo::solvers::LinearConstraint< T >::clearConstant ( )
inline

move the constant in the expression to rhs For example, x + 5 < 10 will become x < 5

Definition at line 1094 of file Solvers.h.

◆ copy()

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

copy object

Parameters
rhsright hand side

Definition at line 1141 of file Solvers.h.

◆ emplaceExpression()

template<typename T>
void limbo::solvers::LinearConstraint< T >::emplaceExpression ( expression_type & expr)
inline
Parameters
exprexpression

Definition at line 1032 of file Solvers.h.

◆ expression()

template<typename T>
expression_type const & limbo::solvers::LinearConstraint< T >::expression ( ) const
inline
Returns
linear expression

Definition at line 1028 of file Solvers.h.

◆ id()

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

Definition at line 1024 of file Solvers.h.

◆ normalize()

template<typename T>
void limbo::solvers::LinearConstraint< T >::normalize ( char s)
inline

normalize sense

Parameters
starget sense

Definition at line 1063 of file Solvers.h.

◆ operator+=() [1/2]

template<typename T>
LinearConstraint & limbo::solvers::LinearConstraint< T >::operator+= ( expression_type const & expr)
inline

overload plus assignment for expression

Parameters
exprright hand side is an expression
Returns
the object

Definition at line 1115 of file Solvers.h.

◆ operator+=() [2/2]

template<typename T>
LinearConstraint & limbo::solvers::LinearConstraint< T >::operator+= ( term_type const & term)
inline

overload plus assignment

Parameters
termright hand side is a term
Returns
the object

Definition at line 1107 of file Solvers.h.

◆ operator-=() [1/2]

template<typename T>
LinearConstraint & limbo::solvers::LinearConstraint< T >::operator-= ( expression_type const & expr)
inline

overload minus assignment for expression

Parameters
exprright hand side is an expression
Returns
the object

Definition at line 1132 of file Solvers.h.

◆ operator-=() [2/2]

template<typename T>
LinearConstraint & limbo::solvers::LinearConstraint< T >::operator-= ( term_type term)
inline

overload minus assignment

Parameters
termright hand side is a term
Returns
the object

Definition at line 1124 of file Solvers.h.

◆ operator=()

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

assignment

Definition at line 1012 of file Solvers.h.

◆ reserve()

template<typename T>
void limbo::solvers::LinearConstraint< T >::reserve ( unsigned int n)
inline

reserve space for expression terms

Parameters
nnumber of terms in expression

Definition at line 1102 of file Solvers.h.

◆ rightHandSide()

template<typename T>
coefficient_value_type limbo::solvers::LinearConstraint< T >::rightHandSide ( ) const
inline
Returns
right hand side constant

Definition at line 1034 of file Solvers.h.

◆ scale()

template<typename T>
void limbo::solvers::LinearConstraint< T >::scale ( coefficient_value_type factor)
inline

scale constraint by a scaling factor

Parameters
factorscaling factor

Definition at line 1076 of file Solvers.h.

◆ sense()

template<typename T>
char limbo::solvers::LinearConstraint< T >::sense ( ) const
inline
Returns
sense

Definition at line 1038 of file Solvers.h.

◆ setExpression()

template<typename T>
void limbo::solvers::LinearConstraint< T >::setExpression ( expression_type const & expr)
inline
Parameters
exprexpression

Definition at line 1030 of file Solvers.h.

◆ setId()

template<typename T>
void limbo::solvers::LinearConstraint< T >::setId ( unsigned int i)
inline
Parameters
iindex

Definition at line 1026 of file Solvers.h.

◆ setRightHandSide()

template<typename T>
void limbo::solvers::LinearConstraint< T >::setRightHandSide ( coefficient_value_type rhs)
inline
Parameters
rhsright hand side

Definition at line 1036 of file Solvers.h.

◆ setSense()

template<typename T>
void limbo::solvers::LinearConstraint< T >::setSense ( char s)
inline
Parameters
ssense

Definition at line 1040 of file Solvers.h.

◆ simplify()

template<typename T>
void limbo::solvers::LinearConstraint< T >::simplify ( )
inline

simplify expression by merge terms of the same variables

Definition at line 1054 of file Solvers.h.

◆ swap()

template<typename T>
void limbo::solvers::LinearConstraint< T >::swap ( LinearConstraint< T > & rhs)
inline

swap with a constraint

Parameters
rhsconstraint at right hand side

Definition at line 1043 of file Solvers.h.

Member Data Documentation

◆ m_expr

template<typename T>
expression_type limbo::solvers::LinearConstraint< T >::m_expr
protected

linear expression

Definition at line 1151 of file Solvers.h.

◆ m_id

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

constraint index

Definition at line 1150 of file Solvers.h.

◆ m_rhs

template<typename T>
coefficient_value_type limbo::solvers::LinearConstraint< T >::m_rhs
protected

constant at the right hand side

Definition at line 1152 of file Solvers.h.

◆ m_sense

template<typename T>
char limbo::solvers::LinearConstraint< T >::m_sense
protected

sign of operator, < (<=), > (>=), = (==)

Definition at line 1153 of file Solvers.h.


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