Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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_type
variable_type
 variable type
 
typedef LinearTerm
< coefficient_value_type
term_type
 term type
 
typedef LinearExpression
< coefficient_value_type
expression_type
 expression type
 

Public Member Functions

 LinearConstraint (expression_type expr=expression_type(), coefficient_value_type rhs=0, char s= '<')
 constructor More...
 
 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 More...
 
void simplify ()
 simplify expression by merge terms of the same variables
 
void normalize (char s)
 normalize sense More...
 
void scale (coefficient_value_type factor)
 scale constraint by a scaling factor More...
 
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 More...
 
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 More...
 

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 78 of file Solvers.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

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

Definition at line 1032 of file Solvers.h.

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

Definition at line 1028 of file Solvers.h.

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

Definition at line 1024 of file Solvers.h.

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.

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.

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.

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.

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.

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.

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.

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.

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

Definition at line 1038 of file Solvers.h.

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

Definition at line 1030 of file Solvers.h.

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

Definition at line 1026 of file Solvers.h.

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.

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

Definition at line 1040 of file Solvers.h.

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.


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