Class sdm::HistoryTree
Class List > sdm > HistoryTree
History class that use a representation by tree. More...
#include <history_tree.hpp>
Inherits the following classes: sdm::HistoryInterface, sdm::Tree
Inherited by the following classes: sdm::JointHistoryTree
Public Types
| Type | Name |
|---|---|
| typedef typename Tree< std::shared_ptr< Observation > >::value_type | value_type |
Public Types inherited from sdm::Tree
See sdm::Tree
| Type | Name |
|---|---|
| typedef T | value_type |
Public Functions
| Type | Name |
|---|---|
| HistoryTree () Default constructor. This constructor builds a default and empty tree. | |
| HistoryTree (number max_depth) Construct a new truncated tree object. | |
| HistoryTree (std::shared_ptr< HistoryTree > parent, const std::shared_ptr< Observation > & item) Construct a history tree iteratively. | |
| virtual std::shared_ptr< output > | expand (const std::shared_ptr< Observation > & observation, bool backup=true) Expands the history. |
| virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Observation > & observation, bool backup=true) Expands the history. |
| std::shared_ptr< HistoryTree > | getChild (const std::shared_ptr< Observation > & child_item) const |
| std::vector< std::shared_ptr< HistoryTree > > | getChildren () const |
| const std::shared_ptr< Observation > & | getData () const |
| virtual number | getHorizon () const Get the horizon of the history. |
| virtual std::shared_ptr< Observation > | getLastObservation () Get the last observation. |
| std::shared_ptr< HistoryTree > | getOrigin () |
| std::shared_ptr< HistoryTree > | getParent () const |
| virtual std::shared_ptr< Item > | getPointer () Get the shared_ptr on current (this) item. |
| virtual std::shared_ptr< HistoryInterface > | getPreviousHistory () Get the previous history. |
| std::shared_ptr< HistoryTree > | getptr () |
| void | serialize (Archive & archive, const unsigned int) |
| virtual std::string | short_str () const |
| virtual std::string | str () const Get a string describing the current item. |
Public Functions inherited from sdm::HistoryInterface
| Type | Name |
|---|---|
| virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Observation > & observation, bool backup=true) = 0 Expands the history. |
| virtual number | getHorizon () const = 0 Get the horizon of the history. |
| virtual std::shared_ptr< Observation > | getLastObservation () = 0 Get the last observation. |
| virtual std::shared_ptr< HistoryInterface > | getPreviousHistory () = 0 Get the previous history. |
| virtual TypeState | getTypeState () const |
| virtual std::string | short_str () const = 0 |
| virtual std::string | str () const = 0 Get a string describing the current item. |
| std::shared_ptr< JointHistoryInterface > | toJointHistory () Transform the HistoryInterface in aJointHistoryInterface . |
Public Functions inherited from sdm::State
See sdm::State
| Type | Name |
|---|---|
| virtual TypeState | getTypeState () const |
| virtual size_t | hash () const Get the hash of the state. The hash is used in tabular value functions in order to compare efficiently two states. This function must be reimplemented in inherited classes. |
| virtual bool | operator== (const std::shared_ptr< State > & other) const Check equality between two states. This function must be implemented in inherited classes. |
| virtual std::string | str () const = 0 Get a string describing the current item. |
| virtual std::shared_ptr< BeliefInterface > | toBelief () Cast the state into a belief. |
| virtual std::shared_ptr< HistoryInterface > | toHistory () Cast the state into a history. |
| virtual std::shared_ptr< OccupancyStateInterface > | toOccupancyState () Cast the state into an occupancy state. |
| virtual std::shared_ptr< BaseSerialInterface > | toSerial () Cast the state into a serial interface. |
| virtual std::shared_ptr< SerialOccupancyInterface > | toSerialOccupancyState () Cast the state into a serial occupancy state. |
| virtual | ~State () |
Public Functions inherited from sdm::Observation
See sdm::Observation
| Type | Name |
|---|---|
| virtual std::string | str () const = 0 Get a string describing the current item. |
| virtual | ~Observation () |
Public Functions inherited from sdm::Item
See sdm::Item
| Type | Name |
|---|---|
| virtual std::shared_ptr< Item > | getPointer () Get the shared_ptr on current (this) item. |
| virtual bool | isBaseItem () |
| virtual std::string | str () const = 0 Get a string describing the current item. |
| std::shared_ptr< T > | to () |
| virtual std::shared_ptr< Action > | toAction () Cast the item into a pointer on action. |
| virtual std::shared_ptr< Item > | toItem () Cast the item into a pointer on item. |
| virtual std::shared_ptr< Observation > | toObservation () Cast the item into a pointer on observation. |
| virtual std::shared_ptr< State > | toState () Cast the item into a pointer on state. |
Public Functions inherited from std::inheritable_enable_shared_from_this
See std::inheritable_enable_shared_from_this
| Type | Name |
|---|---|
| std::shared_ptr< Down > | downcasted_shared_from_this () |
| std::shared_ptr< T > | shared_from_this () |
Public Functions inherited from std::MultipleInheritableEnableSharedFromThis
See std::MultipleInheritableEnableSharedFromThis
| Type | Name |
|---|---|
| virtual | ~MultipleInheritableEnableSharedFromThis () |
Public Functions inherited from sdm::Tree
See sdm::Tree
| Type | Name |
|---|---|
| Tree () Default constructor object. | |
| Tree (number max_depth) Construct a new Tree object (the origin) | |
| Tree (std::shared_ptr< Tree< T >> parent, const T & data) Construct a new Tree object. | |
| void | addChild (const T & child_item) |
| void | addChildren (const std::vector< T > & child_items) |
| std::shared_ptr< Tree< T > > | getChild (const T & child_item) const |
| std::vector< std::shared_ptr< Tree< T > > > | getChildren () const |
| const T & | getData () const |
| number | getDepth () const |
| number | getMaxDepth () const |
| number | getNumChildren () const |
| std::shared_ptr< Tree< T > > | getOrigin () |
| std::shared_ptr< Tree< T > > | getParent () const |
| std::shared_ptr< Tree< T > > | getptr () |
| bool | isOrigin () const |
| void | serialize (Archive & archive, const unsigned int) |
| void | setMaxDepth (number) const |
| std::string | str () const |
| virtual | ~Tree () Destructor of Tree (that's bad). |
Public Functions inherited from std::inheritable_enable_shared_from_this
See std::inheritable_enable_shared_from_this
| Type | Name |
|---|---|
| std::shared_ptr< Down > | downcasted_shared_from_this () |
| std::shared_ptr< T > | shared_from_this () |
Public Functions inherited from std::MultipleInheritableEnableSharedFromThis
See std::MultipleInheritableEnableSharedFromThis
| Type | Name |
|---|---|
| virtual | ~MultipleInheritableEnableSharedFromThis () |
Protected Attributes inherited from sdm::Tree
See sdm::Tree
| Type | Name |
|---|---|
| std::map< T, std::shared_ptr< Tree< T > > > | children_ mapping of items to successor trees |
| T | data_ data of the current node |
| number | depth_ = = 0 depth of the tree |
| bool | is_origin = = false |
| number | max_depth_ = = std::numeric_limits<number>::max() maximum length of the tree |
| std::weak_ptr< Tree< T > > | origin_ the root of the tree |
| std::weak_ptr< Tree< T > > | parent_ the parent node |
Protected Functions
| Type | Name |
|---|---|
| std::shared_ptr< output > | truncatedExpand (const std::shared_ptr< Observation > & observation, bool backup) Expands the tree using truncated expand method. |
Detailed Description
Each node in the tree represent an action-observation pair. Let consider nodes above a given node as the list of actions and observations at previous timesteps.
Public Types Documentation
typedef value_type
using sdm::HistoryTree::value_type = typename Tree<std::shared_ptr<Observation> >::value_type;
Public Functions Documentation
function HistoryTree [1/3]
sdm::HistoryTree::HistoryTree ()
function HistoryTree [2/3]
sdm::HistoryTree::HistoryTree (
number max_depth
)
Parameters:
datathe value of the origin
function HistoryTree [3/3]
sdm::HistoryTree::HistoryTree (
std::shared_ptr< HistoryTree > parent,
const std::shared_ptr< Observation > & item
)
Parameters:
parentthe parent treeitemthe itembackupwheter the node is marked or not
This constructor builds a tree with a given parent and item.
function expand [1/2]
template<typename output typename output>
inline virtual std::shared_ptr< output > sdm::HistoryTree::expand (
const std::shared_ptr< Observation > & observation,
bool backup=true
)
Parameters:
datathe data of the expanded node
Returns:
the expanded history
If child leading from the item previously exists, the method return that child. Otherwise, it expands the tree by adding an item at the current leaf of the tree and creating if necessary a corresponding child. The constructed child is returned.
Implements sdm::HistoryInterface::expand
function expand [2/2]
virtual std::shared_ptr< HistoryInterface > sdm::HistoryTree::expand (
const std::shared_ptr< Observation > & observation,
bool backup=true
)
Parameters:
observationthe observation of the expanded node
Returns:
the expanded history
Implements sdm::HistoryInterface::expand
function getChild
std::shared_ptr< HistoryTree > sdm::HistoryTree::getChild (
const std::shared_ptr< Observation > & child_item
) const
function getChildren
std::vector< std::shared_ptr< HistoryTree > > sdm::HistoryTree::getChildren () const
function getData
const std::shared_ptr< Observation > & sdm::HistoryTree::getData () const
function getHorizon
virtual number sdm::HistoryTree::getHorizon () const
Returns:
number the history
Implements sdm::HistoryInterface::getHorizon
function getLastObservation
virtual std::shared_ptr< Observation > sdm::HistoryTree::getLastObservation ()
Returns:
the last observation
Implements sdm::HistoryInterface::getLastObservation
function getOrigin
std::shared_ptr< HistoryTree > sdm::HistoryTree::getOrigin ()
function getParent
std::shared_ptr< HistoryTree > sdm::HistoryTree::getParent () const
function getPointer
virtual std::shared_ptr< Item > sdm::HistoryTree::getPointer ()
Returns:
std::shared_ptr<Item>
Implements sdm::Item::getPointer
function getPreviousHistory
virtual std::shared_ptr< HistoryInterface > sdm::HistoryTree::getPreviousHistory ()
Returns:
the one step behind history.
Implements sdm::HistoryInterface::getPreviousHistory
function getptr
std::shared_ptr< HistoryTree > sdm::HistoryTree::getptr ()
function serialize
template<class Archive class Archive>
void sdm::HistoryTree::serialize (
Archive & archive,
const unsigned int
)
function short_str
virtual std::string sdm::HistoryTree::short_str () const
Implements sdm::HistoryInterface::short_str
function str
virtual std::string sdm::HistoryTree::str () const
Returns:
std::string the description of the item
Implements sdm::HistoryInterface::str
Protected Functions Documentation
function truncatedExpand
template<typename output typename output>
inline std::shared_ptr< output > sdm::HistoryTree::truncatedExpand (
const std::shared_ptr< Observation > & observation,
bool backup
)
Parameters:
datathe data of the expanded nodebackupwheter the node is marked or not
Returns:
the truncated expanded tree
## Friends Documentation
friend operator<<
inline friend std::ostream & sdm::HistoryTree::operator<< (
std::ostream & os,
HistoryTree & i_hist
)
The documentation for this class was generated from the following file src/sdm/core/state/history_tree.hpp