Class sdm::JointHistoryTree
Class List > sdm > JointHistoryTree
Joint history class that use a representation by tree.More...
#include <jhistory_tree.hpp>
Inherits the following classes: sdm::JointHistoryInterface, sdm::HistoryTree, sdm::Joint, sdm::BoostSerializable
Public Types
Type | Name |
---|---|
typedef std::shared_ptr< HistoryTree > | ihistory_type |
typedef typename HistoryTree::value_type | value_type |
Public Types inherited from sdm::HistoryTree
See sdm::HistoryTree
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 Types inherited from sdm::Joint
See sdm::Joint
Type | Name |
---|---|
typedef T | value_type |
Public Types inherited from sdm::Function
See sdm::Function
Type | Name |
---|---|
typedef TInput | input_type |
typedef TOutput | output_type |
Public Functions
Type | Name |
---|---|
JointHistoryTree () Default constructor. This constructor builds a default and empty tree. | |
JointHistoryTree (number n_agents) Construct a new joint history tree object (the origin) | |
JointHistoryTree (number n_agents, number max_depth) Construct a new truncated joint history tree object (the origin) | |
JointHistoryTree (std::shared_ptr< HistoryTree > parent, const std::shared_ptr< Observation > & item) This constructor build a child node given its parent's node and a new joint item. | |
JointHistoryTree (const Joint< std::shared_ptr< HistoryInterface >> & ihistories) Construct a new joint history based on individual histories. | |
virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Joint< std::shared_ptr< Observation >>> & joint_observation, bool backup=true) Expands the tree. |
virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Observation > & observation, bool backup=true) Expands the history. |
std::shared_ptr< JointHistoryTree > | getChild (const std::shared_ptr< Observation > & child_item) const |
std::vector< std::shared_ptr< JointHistoryTree > > | getChildren () const |
virtual std::shared_ptr< Joint< std::shared_ptr< Observation > > > | getDefaultObs () |
virtual Joint< std::shared_ptr< HistoryInterface > > | getIndividualHistories () const Get the address of the individual histories of all agents. |
virtual std::shared_ptr< HistoryInterface > | getIndividualHistory (number agent_id) const Get the address of the individual history of agent 'agent_id'. |
std::shared_ptr< JointHistoryTree > | getOrigin () |
std::shared_ptr< JointHistoryTree > | getParent () const |
std::shared_ptr< JointHistoryTree > | getptr () |
virtual void | isNotOrigin () |
void | serialize (Archive & archive, const unsigned int) |
void | setDefaultObs (const std::shared_ptr< Joint< std::shared_ptr< Observation >>> & default_observation) |
virtual std::string | str () const Get a string describing the current item. |
Public Functions inherited from sdm::JointHistoryInterface
See sdm::JointHistoryInterface
Type | Name |
---|---|
virtual void | addIndividualHistory (std::shared_ptr< HistoryInterface > ihist) = 0 |
virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Observation > & observation, bool backup=true) = 0 Expands the history. |
virtual std::shared_ptr< HistoryInterface > | expand (const std::shared_ptr< Joint< std::shared_ptr< Observation >>> &, bool=true) = 0 |
virtual std::shared_ptr< Joint< std::shared_ptr< Observation > > > | getDefaultObs () = 0 |
virtual Joint< std::shared_ptr< HistoryInterface > > | getIndividualHistories () const = 0 |
virtual std::shared_ptr< HistoryInterface > | getIndividualHistory (number agent_id) const = 0 |
virtual void | isNotOrigin () = 0 |
virtual std::string | str () const = 0 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::HistoryTree
See sdm::HistoryTree
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 () |
Public Functions inherited from sdm::Joint
See sdm::Joint
Type | Name |
---|---|
Joint () | |
Joint (const std::vector< T > & joint_item) | |
Joint (const std::vector< number > &, const std::vector< T > & joint_item) | |
Joint (std::initializer_list< T > list_values) | |
const T & | get (const number &) const Get the element for agent i. |
number | getNumAgents () const Get the number of agents (i.e. the size of the joint element) |
virtual T | operator() (const number &) Get the element for agent i. |
void | serialize (Archive & archive, const unsigned int) |
std::string | str () const |
std::shared_ptr< Joint< std::shared_ptr< TOutput > > > | toJoint () |
virtual | ~Joint () |
Public Functions inherited from sdm::Function
See sdm::Function
Type | Name |
---|---|
virtual output_type | operator() (const input_type &) = 0 |
virtual | ~Function () |
Public Functions inherited from sdm::BoostSerializable
Type | Name |
---|---|
BoostSerializable () | |
void | load (std::string filename) Load a value function from a file. The extension of the file will indicate the type of formatage for reading ( .txt = text format, '.xml' = XML format, other = binary format). |
void | save (std::string filename) Save a value function into a file. The extension of the file will indicate the type of formatage for recording ( .txt = text format, '.xml' = XML format, other = binary format). |
Protected Attributes
Type | Name |
---|---|
std::shared_ptr< Joint< std::shared_ptr< Observation > > > | default_observation_ |
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 |
---|---|
virtual void | addIndividualHistory (std::shared_ptr< HistoryInterface > ihist) |
void | setupDefaultObs (number num_agents, const std::shared_ptr< Observation > & default_observation=sdm::NO_OBSERVATION) |
Protected Functions inherited from sdm::HistoryTree
See sdm::HistoryTree
Type | Name |
---|---|
std::shared_ptr< output > | truncatedExpand (const std::shared_ptr< Observation > & observation, bool backup) Expands the tree using truncated expand method. |
Protected Functions inherited from sdm::BoostSerializable
Type | Name |
---|---|
void | serialize (Archive & archive, const unsigned int version) |
Detailed Description
It can be viewed as a history over joint observations and as a list of individual histories.
Public Types Documentation
typedef ihistory_type
using sdm::JointHistoryTree::ihistory_type = std::shared_ptr<HistoryTree>;
typedef value_type
using sdm::JointHistoryTree::value_type = typename HistoryTree::value_type;
Public Functions Documentation
function JointHistoryTree [1/5]
sdm::JointHistoryTree::JointHistoryTree ()
function JointHistoryTree [2/5]
sdm::JointHistoryTree::JointHistoryTree (
number n_agents
)
Parameters:
n_agents
the number of agents
function JointHistoryTree [3/5]
sdm::JointHistoryTree::JointHistoryTree (
number n_agents,
number max_depth
)
Parameters:
n_agents
the number of agentsmax_depth
the maximal depth of the truncated history
function JointHistoryTree [4/5]
sdm::JointHistoryTree::JointHistoryTree (
std::shared_ptr< HistoryTree > parent,
const std::shared_ptr< Observation > & item
)
Parameters:
parent
the parent treeitem
the item
function JointHistoryTree [5/5]
sdm::JointHistoryTree::JointHistoryTree (
const Joint < std::shared_ptr< HistoryInterface >> & ihistories
)
Warning:
This will build a well defined Joint<std::shared_ptr<HistoryTree>> structure but wrong HistoryTree<std::shared_ptr<Joint<T>>> !!
Parameters:
ihistories
the list of individual histories
function expand [1/2]
virtual std::shared_ptr< HistoryInterface > sdm::JointHistoryTree::expand (
const std::shared_ptr< Joint < std::shared_ptr< Observation >>> & joint_observation,
bool backup=true
)
Parameters:
data
the data of the expanded node
Returns:
the expanded tree
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::JointHistoryInterface::expand
function expand [2/2]
virtual std::shared_ptr< HistoryInterface > sdm::JointHistoryTree::expand (
const std::shared_ptr< Observation > & observation,
bool backup=true
)
Parameters:
data
the 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::HistoryTree::expand
function getChild
std::shared_ptr< JointHistoryTree > sdm::JointHistoryTree::getChild (
const std::shared_ptr< Observation > & child_item
) const
function getChildren
std::vector< std::shared_ptr< JointHistoryTree > > sdm::JointHistoryTree::getChildren () const
function getDefaultObs
virtual std::shared_ptr< Joint < std::shared_ptr< Observation > > > sdm::JointHistoryTree::getDefaultObs ()
Implements sdm::JointHistoryInterface::getDefaultObs
function getIndividualHistories
virtual Joint < std::shared_ptr< HistoryInterface > > sdm::JointHistoryTree::getIndividualHistories () const
Returns:
a vector that contains all individual histories
Implements sdm::JointHistoryInterface::getIndividualHistories
function getIndividualHistory
virtual std::shared_ptr< HistoryInterface > sdm::JointHistoryTree::getIndividualHistory (
number agent_id
) const
Parameters:
agent_id
the agent id
Returns:
the address of the individual history of agent 'agent_id'
Implements sdm::JointHistoryInterface::getIndividualHistory
function getOrigin
std::shared_ptr< JointHistoryTree > sdm::JointHistoryTree::getOrigin ()
function getParent
std::shared_ptr< JointHistoryTree > sdm::JointHistoryTree::getParent () const
function getptr
std::shared_ptr< JointHistoryTree > sdm::JointHistoryTree::getptr ()
function isNotOrigin
virtual void sdm::JointHistoryTree::isNotOrigin ()
Implements sdm::JointHistoryInterface::isNotOrigin
function serialize
template<class Archive class Archive>
void sdm::JointHistoryTree::serialize (
Archive & archive,
const unsigned int
)
function setDefaultObs
void sdm::JointHistoryTree::setDefaultObs (
const std::shared_ptr< Joint < std::shared_ptr< Observation >>> & default_observation
)
function str
virtual std::string sdm::JointHistoryTree::str () const
Returns:
std::string the description of the item
Implements sdm::HistoryTree::str
Protected Attributes Documentation
variable default_observation_
std::shared_ptr<Joint<std::shared_ptr<Observation> > > sdm::JointHistoryTree::default_observation_;
Protected Functions Documentation
function addIndividualHistory
virtual void sdm::JointHistoryTree::addIndividualHistory (
std::shared_ptr< HistoryInterface > ihist
)
Implements sdm::JointHistoryInterface::addIndividualHistory
function setupDefaultObs
void sdm::JointHistoryTree::setupDefaultObs (
number num_agents,
const std::shared_ptr< Observation > & default_observation=sdm::NO_OBSERVATION
)
Friends Documentation
friend operator<<
inline friend std::ostream & sdm::JointHistoryTree::operator<< (
std::ostream & os,
JointHistoryTree & j_hist
)
The documentation for this class was generated from the following file src/sdm/core/state/jhistory_tree.hpp