Class sdm::StateGraph

Class List > sdm > StateGraph

A graph that keep all beliefs.

  • #include <state_graph.hpp>

Inherits the following classes: sdm::Graph, sdm::State, sdm::BoostSerializable

Public Types

Type Name
typedef Pair< std::shared_ptr< State >, double >(const std::shared_ptr< MDPInterface > &, const std::shared_ptr< State > &, const std::shared_ptr< Action > &, const std::shared_ptr< Observation > &, number) TransitionFunction

Public Attributes inherited from sdm::Graph

See sdm::Graph

Type Name
std::unordered_map< TNode, std::shared_ptr< GraphNode< TNode, TEdge > > > node_space_
Space of nodes.

Public Functions

Type Name
StateGraph ()
StateGraph (const std::vector< std::shared_ptr< State >> & list_states, const std::vector< double > & list_proba)
StateGraph (const std::shared_ptr< State > & data)
StateGraph (const std::shared_ptr< StateGraph > & predecessor, const std::shared_ptr< State > & belief)
Construct a new belief.
std::shared_ptr< StateGraph > getNode (const std::shared_ptr< State > & belief)
Get the node associated to a given belief.
double getProbability (const std::shared_ptr< Action > & action, const std::shared_ptr< Observation > & observation) const
Get the probability of associated belief.
std::shared_ptr< StateGraph > getptr ()
Return a the pointer on this object.
void initialize ()
std::shared_ptr< StateGraph > next (TransitionFunction transition_function, const std::shared_ptr< MDPInterface > & pomdp, const std::shared_ptr< Action > & action, const std::shared_ptr< Observation > & observation, number t, bool backup=true)
Expands the graph.
void serialize (Archive & archive, const unsigned int)
virtual std::string str () const
Return a.

Public Functions inherited from sdm::Graph

See sdm::Graph

Type Name
Graph ()
Default constructor object.
void addNode (const TNode & node_value)
Add a node in the graph.
void addSuccessor (const TNode & node_value, const TEdge & edge_value, const TNode & succ_node_value)
bool contains (const TNode & node_value) const
std::shared_ptr< GraphNode< TNode, TEdge > > getNode (const TNode & belief) const
Get the node associated to a given node's value .
number getNumNodes () const
Get the number of node.
std::shared_ptr< GraphNode< TNode, TEdge > > getPredecessor (const TNode & node, const TEdge & edge) const
std::shared_ptr< GraphNode< TNode, TEdge > > getSuccessor (const TNode & node, const TEdge & edge) const
std::shared_ptr< Graph > getptr ()
std::string node_str () const
void serialize (Archive & archive, const unsigned int)
std::string str () const
virtual ~Graph ()
Destructor of Graph (that's bad).

Public Functions inherited from sdm::BoostSerializable

See 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).

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

See 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
RecursiveMap< std::shared_ptr< Action >, std::shared_ptr< Observation >, double > belief_probability
A pointer on the bag containing all nodes.
std::shared_ptr< std::unordered_map< std::shared_ptr< State >, std::shared_ptr< StateGraph > > > belief_space
A pointer on the bag which associated a belief to a precise pointer.

Protected Functions

Type Name
virtual std::shared_ptr< State > exist (const std::shared_ptr< State > &)

Protected Functions inherited from sdm::BoostSerializable

See sdm::BoostSerializable

Type Name
void serialize (Archive & archive, const unsigned int version)

Protected Functions inherited from sdm::BoostSerializable

See sdm::BoostSerializable

Type Name
void serialize (Archive & archive, const unsigned int version)

Public Types Documentation

typedef TransitionFunction

using sdm::StateGraph::TransitionFunction =  Pair<std::shared_ptr<State>, double>(const std::shared_ptr<MDPInterface> &, const std::shared_ptr<State> &, const std::shared_ptr<Action> &, const std::shared_ptr<Observation> &, number);

Public Functions Documentation

function StateGraph [1/4]

sdm::StateGraph::StateGraph () 

function StateGraph [2/4]

sdm::StateGraph::StateGraph (
    const std::vector< std::shared_ptr< State >> & list_states,
    const std::vector< double > & list_proba
) 

function StateGraph [3/4]

sdm::StateGraph::StateGraph (
    const std::shared_ptr< State > & data
) 

function StateGraph [4/4]

sdm::StateGraph::StateGraph (
    const std::shared_ptr< StateGraph > & predecessor,
    const std::shared_ptr< State > & belief
) 

Parameters:

  • predecessor
  • belief

function getNode

std::shared_ptr< StateGraph > sdm::StateGraph::getNode (
    const std::shared_ptr< State > & belief
) 

Parameters:

  • belief a specific belief

Returns:

the address of the node

function getProbability

double sdm::StateGraph::getProbability (
    const std::shared_ptr< Action > & action,
    const std::shared_ptr< Observation > & observation
) const

Parameters:

  • action
  • observation
  • belief

Returns:

the corresponding probability

function getptr

std::shared_ptr< StateGraph > sdm::StateGraph::getptr () 

function initialize

void sdm::StateGraph::initialize () 

function next

std::shared_ptr< StateGraph > sdm::StateGraph::next (
    TransitionFunction transition_function,
    const std::shared_ptr< MDPInterface > & pomdp,
    const std::shared_ptr< Action > & action,
    const std::shared_ptr< Observation > & observation,
    number t,
    bool backup=true
) 

Parameters:

  • action the action
  • observation the observation
  • backup if true, we store the expanded belief in the graph.

Returns:

the next belief

function serialize

template<class Archive class Archive>
void sdm::StateGraph::serialize (
    Archive & archive,
    const unsigned int
) 

function str

virtual std::string sdm::StateGraph::str () const

Implements sdm::State::str

Protected Attributes Documentation

variable belief_probability

RecursiveMap<std::shared_ptr<Action>, std::shared_ptr<Observation>, double> sdm::StateGraph::belief_probability;

variable belief_space

std::shared_ptr<std::unordered_map<std::shared_ptr<State>, std::shared_ptr<StateGraph> > > sdm::StateGraph::belief_space;

A pointer on the bag containing all nodes.

Protected Functions Documentation

function exist

virtual std::shared_ptr< State > sdm::StateGraph::exist (
    const std::shared_ptr< State > &
) 

Friends Documentation

friend operator<<

inline friend std::ostream & sdm::StateGraph::operator<< (
    std::ostream & os,
    StateGraph & belief_state_graph
) 

The documentation for this class was generated from the following file src/sdm/core/state/state_graph.hpp