aGrUM 2.3.2
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.
bool operator!= (const ActionSet &compared) const
 Ajout d'un élément.

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 105 of file actionSet.h.

Constructor & Destructor Documentation

◆ ActionSet() [1/2]

gum::ActionSet::ActionSet ( )
inline

Constructor.

Definition at line 115 of file actionSet.h.

115 {
116 GUM_CONSTRUCTOR(ActionSet);
117 _actionSeq_ = new Sequence< Idx >();
118 }
ActionSet()
Constructor.
Definition actionSet.h:115
Sequence< Idx > * _actionSeq_
The very bone of the ActionSet.
Definition actionSet.h:230

References ActionSet(), and _actionSeq_.

Referenced by ActionSet(), ActionSet(), ~ActionSet(), operator delete(), operator!=(), 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]

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

Constructor.

Definition at line 120 of file actionSet.h.

120 {
121 GUM_CONSTRUCTOR(ActionSet);
122 _actionSeq_ = new Sequence< Idx >();
123 for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
124 _actionSeq_->insert(*idi);
125 }

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

Here is the call graph for this function:

◆ ~ActionSet()

gum::ActionSet::~ActionSet ( )
inline

Destructor.

Definition at line 137 of file actionSet.h.

137 {
138 GUM_DESTRUCTOR(ActionSet);
139 delete _actionSeq_;
140 }

References ActionSet(), and _actionSeq_.

Here is the call graph for this function:

Member Function Documentation

◆ beginSafe()

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

Iterator beginning.

Definition at line 161 of file actionSet.h.

161{ return _actionSeq_->beginSafe(); }

References _actionSeq_.

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

Here is the caller graph for this function:

◆ endSafe()

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

Iterator end.

Definition at line 166 of file actionSet.h.

166{ return _actionSeq_->endSafe(); }

References _actionSeq_.

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

Here is the caller graph for this function:

◆ exists()

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

Definition at line 226 of file actionSet.h.

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

References _actionSeq_.

Referenced by operator==().

Here is the caller graph for this function:

◆ operator delete()

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

Constructor.

Definition at line 147 of file actionSet.h.

147 {
149 }
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()

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

Allocators and Deallocators redefinition.

Definition at line 145 of file actionSet.h.

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!=()

bool gum::ActionSet::operator!= ( const ActionSet & compared) const
inline

Ajout d'un élément.

Definition at line 217 of file actionSet.h.

217{ return !(*this == compared); }

References ActionSet().

Here is the call graph for this function:

◆ operator+=() [1/2]

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

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

Definition at line 186 of file actionSet.h.

186 {
187 for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
188 if (!_actionSeq_->exists(*iter)) _actionSeq_->insert(*iter);
189 return *this;
190 }

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

Here is the call graph for this function:

◆ operator+=() [2/2]

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

Ajout d'un élément.

Definition at line 178 of file actionSet.h.

178 {
179 _actionSeq_->insert(elem);
180 return *this;
181 }

References ActionSet(), and _actionSeq_.

Here is the call graph for this function:

◆ operator-=()

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

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

Definition at line 195 of file actionSet.h.

195 {
196 for (auto iter = src.beginSafe(); iter != src.endSafe(); ++iter)
197 if (_actionSeq_->exists(*iter)) _actionSeq_->erase(*iter);
198 return *this;
199 }

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

Here is the call graph for this function:

◆ operator=()

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

Constructor.

Definition at line 127 of file actionSet.h.

127 {
128 _actionSeq_ = new Sequence< Idx >();
129 for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
130 _actionSeq_->insert(*idi);
131 return *this;
132 }

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

Here is the call graph for this function:

◆ operator==()

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

Compares two ActionSet to check if they are equals.

Definition at line 209 of file actionSet.h.

209 {
210 for (auto iter = compared.beginSafe(); iter != compared.endSafe(); ++iter)
211 if (!_actionSeq_->exists(*iter)) return false;
212 for (auto iter = this->beginSafe(); iter != this->endSafe(); ++iter)
213 if (!compared.exists(*iter)) return false;
214 return true;
215 }
SequenceIteratorSafe< Idx > endSafe() const
Iterator end.
Definition actionSet.h:166
SequenceIteratorSafe< Idx > beginSafe() const
Iterator beginning.
Definition actionSet.h:161

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 204 of file actionSet.h.

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

References _actionSeq_.

◆ size()

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

Gives the size.

Definition at line 224 of file actionSet.h.

224{ 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 232 of file actionSet.h.

232 {
233 streamy << objy._actionSeq_->toString();
234 return streamy;
235 }

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 file: