SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
smtrat::vb::Bound< T > Class Template Reference

Class for the bound of a variable. More...

#include <VariableBounds.h>

Collaboration diagram for smtrat::vb::Bound< T >:

Public Types

enum  Type {
  STRICT_LOWER_BOUND = 0 , WEAK_LOWER_BOUND = 1 , EQUAL_BOUND = 2 , WEAK_UPPER_BOUND = 3 ,
  STRICT_UPPER_BOUND = 4
}
 The type of a bounds. More...
 

Public Member Functions

 Bound (Rational *const _limit, Variable< T > *const _variable, Type _type)
 Constructs this bound. More...
 
 ~Bound ()
 Destructs this bound. More...
 
bool operator< (const Bound< T > &_bound) const
 Checks whether the this bound is smaller than the given one. More...
 
void print (std::ostream &_out, bool _withRelation=false) const
 Prints this bound on the given stream. More...
 
const Rationallimit () const
 
const RationalpLimit () const
 
bool isInfinite () const
 
Type type () const
 
bool isUpperBound () const
 
bool isLowerBound () const
 
Variable< T > * pVariable () const
 
const Variable< T > & variable () const
 
bool isActive () const
 
bool activate (const T &_origin) const
 Adds an origin to this bound. More...
 
bool deactivate (const T &_origin) const
 Removes an origin from this bound. More...
 
const std::set< T, carl::less< T, false > > & origins () const
 

Private Attributes

Type mType
 The type of this bound. More...
 
RationalmpLimit
 A pointer to bound value, which is plus or minus infinity if the pointer is NULL. More...
 
Variable< T > *const mpVariable
 The variable for which the bound is declared. More...
 
std::set< T, carl::less< T, false > > *const mpOrigins
 A set of origins of the bound, e.g., x-3<0 is the origin of the bound <3. More...
 

Friends

template<typename T1 >
std::ostream & operator<< (std::ostream &_out, const Bound< T1 > &_bound)
 Prints the bound on the given output stream. More...
 

Detailed Description

template<typename T>
class smtrat::vb::Bound< T >

Class for the bound of a variable.

Definition at line 23 of file VariableBounds.h.

Member Enumeration Documentation

◆ Type

template<typename T >
enum smtrat::vb::Bound::Type

The type of a bounds.

Enumerator
STRICT_LOWER_BOUND 
WEAK_LOWER_BOUND 
EQUAL_BOUND 
WEAK_UPPER_BOUND 
STRICT_UPPER_BOUND 

Definition at line 27 of file VariableBounds.h.

Constructor & Destructor Documentation

◆ Bound()

template<typename T >
smtrat::vb::Bound< T >::Bound ( Rational *const  _limit,
Variable< T > *const  _variable,
Type  _type 
)

Constructs this bound.

Parameters
_limitA pointer to the limit (rational) of the bound. It is NULL, if the limit is not finite.
_variableThe variable to which this bound belongs.
_typeThe type of the bound (either it is an equal bound or it is weak resp. strict and upper resp. lower)

◆ ~Bound()

template<typename T >
smtrat::vb::Bound< T >::~Bound ( )

Destructs this bound.

Member Function Documentation

◆ activate()

template<typename T >
bool smtrat::vb::Bound< T >::activate ( const T &  _origin) const
inline

Adds an origin to this bound.

Parameters
_originThe origin to add.
Returns
true, if this has activated this bound; false, if the bound was already active before.

Definition at line 166 of file VariableBounds.h.

◆ deactivate()

template<typename T >
bool smtrat::vb::Bound< T >::deactivate ( const T &  _origin) const
inline

Removes an origin from this bound.

Parameters
_originThe origin to add.
Returns
true, if this has deactivated this bound; false, if the bound was already inactive before.

Definition at line 179 of file VariableBounds.h.

◆ isActive()

template<typename T >
bool smtrat::vb::Bound< T >::isActive ( ) const
inline
Returns
true, if this bound is active, which means that there is at least one origin for it left. Note, that origins can be removed belatedly. false, otherwise.

Definition at line 155 of file VariableBounds.h.

◆ isInfinite()

template<typename T >
bool smtrat::vb::Bound< T >::isInfinite ( ) const
inline
Returns
true, if the bound infinite; false, otherwise.

Definition at line 103 of file VariableBounds.h.

◆ isLowerBound()

template<typename T >
bool smtrat::vb::Bound< T >::isLowerBound ( ) const
inline
Returns
true, if the bound is a lower bound; false, otherwise.

Definition at line 129 of file VariableBounds.h.

◆ isUpperBound()

template<typename T >
bool smtrat::vb::Bound< T >::isUpperBound ( ) const
inline
Returns
true, if the bound is an upper bound; false, otherwise.

Definition at line 120 of file VariableBounds.h.

◆ limit()

template<typename T >
const Rational& smtrat::vb::Bound< T >::limit ( ) const
inline
Returns
A constant reference to the value of the limit. Note, that it must be ensured that the bound is finite before calling this method.

Definition at line 86 of file VariableBounds.h.

◆ operator<()

template<typename T >
bool smtrat::vb::Bound< T >::operator< ( const Bound< T > &  _bound) const

Checks whether the this bound is smaller than the given one.

Parameters
_boundThe bound to compare with.
Returns
true, if for this bound (A) and the given bound (B) it holds that: A is not inf and B is inf, A smaller than B, where A and B are rationals, A equals B, where A and B are rationals, but A is an equal bound but B is not; false, otherwise.

◆ origins()

template<typename T >
const std::set<T,carl::less<T,false> >& smtrat::vb::Bound< T >::origins ( ) const
inline
Returns
A constant reference to the set of origins of this bound.

Definition at line 189 of file VariableBounds.h.

◆ pLimit()

template<typename T >
const Rational* smtrat::vb::Bound< T >::pLimit ( ) const
inline
Returns
A pointer to the limit of this bound.

Definition at line 94 of file VariableBounds.h.

◆ print()

template<typename T >
void smtrat::vb::Bound< T >::print ( std::ostream &  _out,
bool  _withRelation = false 
) const

Prints this bound on the given stream.

Parameters
_outThe stream to print on.
_withRelationA flag indicating whether to print also a relation symbol in front of the bound value.

◆ pVariable()

template<typename T >
Variable<T>* smtrat::vb::Bound< T >::pVariable ( ) const
inline
Returns
A pointer to the variable wrapper considered by this bound.

Definition at line 137 of file VariableBounds.h.

◆ type()

template<typename T >
Type smtrat::vb::Bound< T >::type ( ) const
inline
Returns
The type of this bound.

Definition at line 111 of file VariableBounds.h.

◆ variable()

template<typename T >
const Variable<T>& smtrat::vb::Bound< T >::variable ( ) const
inline
Returns
A constant reference to the variable wrapper considered by this bound.

Definition at line 145 of file VariableBounds.h.

Friends And Related Function Documentation

◆ operator<<

template<typename T >
template<typename T1 >
std::ostream& operator<< ( std::ostream &  _out,
const Bound< T1 > &  _bound 
)
friend

Prints the bound on the given output stream.

Parameters
_outThe output stream to print on.
_boundThe bound to print.
Returns
The output stream after printing the bound on it.

Field Documentation

◆ mpLimit

template<typename T >
Rational* smtrat::vb::Bound< T >::mpLimit
private

A pointer to bound value, which is plus or minus infinity if the pointer is NULL.

Definition at line 33 of file VariableBounds.h.

◆ mpOrigins

template<typename T >
std::set<T,carl::less<T,false> >* const smtrat::vb::Bound< T >::mpOrigins
private

A set of origins of the bound, e.g., x-3<0 is the origin of the bound <3.

Definition at line 37 of file VariableBounds.h.

◆ mpVariable

template<typename T >
Variable<T>* const smtrat::vb::Bound< T >::mpVariable
private

The variable for which the bound is declared.

Definition at line 35 of file VariableBounds.h.

◆ mType

template<typename T >
Type smtrat::vb::Bound< T >::mType
private

The type of this bound.

Definition at line 31 of file VariableBounds.h.


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