aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::ActionSet Class Reference

A class to store the optimal actions. More...

#include <agrum/FMDP/planning/actionSet.h>

Collaboration diagram for gum::ActionSet:

Public Member Functions

Size size () const
 Gives the size.
bool exists (const Idx &elem) const
CNL
 ActionSet ()
 Constructor.
 ActionSet (const ActionSet &src)
 Constructor.
ActionSetoperator= (const ActionSet &src)
 Constructor.
 ~ActionSet ()
 Destructor.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Constructor.
Iterators
SequenceIteratorSafe< IdxbeginSafe () const
 Iterator beginning.
SequenceIteratorSafe< IdxendSafe () const
 Iterator end.
Operators
ActionSetoperator+= (const Idx &elem)
 Ajout d'un élément.
ActionSetoperator+= (const ActionSet &src)
 Use to insert the content of another set inside this one.
ActionSetoperator-= (const ActionSet &src)
 Use to insert the content of another set inside this one.
const Idxoperator[] (const Idx i) const
 Gives the ith element.
bool operator== (const ActionSet &compared) const
 Compares two ActionSet to check if they are equals.

Private Attributes

Sequence< Idx > * _actionSeq_
 The very bone of the ActionSet.

Friends

std::ostream & operator<< (std::ostream &streamy, const ActionSet &objy)

Detailed Description

A class to store the optimal actions.

Stores the ids of optimal actions. To be used as leaves on optimal policy tree or function graph

Definition at line 98 of file actionSet.h.

Constructor & Destructor Documentation

◆ ActionSet() [1/2]

INLINE gum::ActionSet::ActionSet ( )

Constructor.

Definition at line 48 of file actionSet_inl.h.

48 {
49 GUM_CONSTRUCTOR(ActionSet);
50 _actionSeq_ = new Sequence< Idx >();
51 }
ActionSet()
Constructor.
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition actionSet.h:186

References ActionSet(), and _actionSeq_.

Referenced by ActionSet(), ActionSet(), ~ActionSet(), operator delete(), operator+=(), operator+=(), operator-=(), operator<<, operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ActionSet() [2/2]

INLINE gum::ActionSet::ActionSet ( const ActionSet & src)

Constructor.

Definition at line 53 of file actionSet_inl.h.

53 {
54 GUM_CONSTRUCTOR(ActionSet);
55 _actionSeq_ = new Sequence< Idx >();
56 for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
57 _actionSeq_->insert(*idi);
58 }

References ActionSet(), _actionSeq_, beginSafe(), and endSafe().

Here is the call graph for this function:

◆ ~ActionSet()

INLINE gum::ActionSet::~ActionSet ( )

Destructor.

Definition at line 67 of file actionSet_inl.h.

67 {
68 GUM_DESTRUCTOR(ActionSet);
69 delete _actionSeq_;
70 }

References ActionSet(), and _actionSeq_.

Here is the call graph for this function:

Member Function Documentation

◆ beginSafe()

INLINE SequenceIteratorSafe< Idx > gum::ActionSet::beginSafe ( ) const

Iterator beginning.

Definition at line 80 of file actionSet_inl.h.

80 {
81 return _actionSeq_->beginSafe();
82 }

References _actionSeq_.

Referenced by ActionSet(), operator+=(), operator-=(), operator=(), operator==(), and gum::StructuredPlaner< double >::optimalPolicy2String().

Here is the caller graph for this function:

◆ endSafe()

INLINE SequenceIteratorSafe< Idx > gum::ActionSet::endSafe ( ) const

Iterator end.

Definition at line 84 of file actionSet_inl.h.

84{ return _actionSeq_->endSafe(); }

References _actionSeq_.

Referenced by ActionSet(), operator+=(), operator-=(), operator=(), operator==(), and gum::StructuredPlaner< double >::optimalPolicy2String().

Here is the caller graph for this function:

◆ exists()

INLINE bool gum::ActionSet::exists ( const Idx & elem) const

Definition at line 113 of file actionSet_inl.h.

113{ return _actionSeq_->exists(elem); }

References _actionSeq_.

Referenced by operator==().

Here is the caller graph for this function:

◆ operator delete()

INLINE void gum::ActionSet::operator delete ( void * p)

Constructor.

Definition at line 76 of file actionSet_inl.h.

76 {
78 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References ActionSet(), gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator new()

INLINE void * gum::ActionSet::operator new ( size_t s)

Allocators and Deallocators redefinition.

Definition at line 72 of file actionSet_inl.h.

72 {
74 }
void * allocate(const size_t &objectSize)
Allocates a block.

References gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator+=() [1/2]

INLINE ActionSet & gum::ActionSet::operator+= ( const ActionSet & src)

Use to insert the content of another set inside this one.

Definition at line 91 of file actionSet_inl.h.

91 {
92 for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
93 if (!_actionSeq_->exists(*iter)) _actionSeq_->insert(*iter);
94 return *this;
95 }

References ActionSet(), _actionSeq_, beginSafe(), and endSafe().

Here is the call graph for this function:

◆ operator+=() [2/2]

INLINE ActionSet & gum::ActionSet::operator+= ( const Idx & elem)

Ajout d'un élément.

Definition at line 86 of file actionSet_inl.h.

86 {
87 _actionSeq_->insert(elem);
88 return *this;
89 }

References ActionSet(), and _actionSeq_.

Here is the call graph for this function:

◆ operator-=()

INLINE ActionSet & gum::ActionSet::operator-= ( const ActionSet & src)

Use to insert the content of another set inside this one.

Definition at line 97 of file actionSet_inl.h.

97 {
98 for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
99 if (_actionSeq_->exists(*iter)) _actionSeq_->erase(*iter);
100 return *this;
101 }

References ActionSet(), _actionSeq_, beginSafe(), and endSafe().

Here is the call graph for this function:

◆ operator=()

INLINE ActionSet & gum::ActionSet::operator= ( const ActionSet & src)

Constructor.

Definition at line 60 of file actionSet_inl.h.

60 {
61 _actionSeq_ = new Sequence< Idx >();
62 for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
63 _actionSeq_->insert(*idi);
64 return *this;
65 }

References ActionSet(), _actionSeq_, beginSafe(), and endSafe().

Here is the call graph for this function:

◆ operator==()

INLINE bool gum::ActionSet::operator== ( const ActionSet & compared) const

Compares two ActionSet to check if they are equals.

Definition at line 103 of file actionSet_inl.h.

103 {
104 for (auto iter = compared.beginSafe(); iter != compared.endSafe(); ++iter)
105 if (!_actionSeq_->exists(*iter)) return false;
106 for (auto iter = this->beginSafe(); iter != this->endSafe(); ++iter)
107 if (!compared.exists(*iter)) return false;
108 return true;
109 }
SequenceIteratorSafe< Idx > beginSafe() const
Iterator beginning.
SequenceIteratorSafe< Idx > endSafe() const
Iterator end.

References ActionSet(), _actionSeq_, beginSafe(), endSafe(), and exists().

Here is the call graph for this function:

◆ operator[]()

const Idx & gum::ActionSet::operator[] ( const Idx i) const
inline

Gives the ith element.

Definition at line 168 of file actionSet.h.

168{ return _actionSeq_->atPos(i); }

References _actionSeq_.

◆ size()

INLINE Size gum::ActionSet::size ( ) const

Gives the size.

Definition at line 111 of file actionSet_inl.h.

111{ return _actionSeq_->size(); }

References _actionSeq_.

Referenced by gum::E_GreedyDecider::stateOptimalPolicy(), and gum::SDYNA::takeAction().

Here is the caller graph for this function:

◆ operator<<

std::ostream & operator<< ( std::ostream & streamy,
const ActionSet & objy )
friend

Definition at line 115 of file actionSet_inl.h.

115 {
116 streamy << objy._actionSeq_->toString();
117 return streamy;
118 }

References ActionSet(), _actionSeq_, and gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::toString().

Member Data Documentation

◆ _actionSeq_

Sequence< Idx >* gum::ActionSet::_actionSeq_
private

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