CRAAM  2.0.0
Robust and Approximate Markov Decision Processes
Public Member Functions | Protected Attributes | List of all members
craam::msen::SampleDiscretizerSI< State, Action, SHash, AHash > Class Template Reference

Turns arbitrary samples to discrete ones assuming that actions are state independent. More...

#include <Samples.hpp>

Public Member Functions

 SampleDiscretizerSI ()
 Constructs new internal discrete samples.
 
void add_samples (const Samples< State, Action > &samples)
 Adds samples to the discrete samples.
 
long add_state (const State &dstate)
 Returns a state index, and creates a new one if it does not exists.
 
long add_action (const Action &action)
 Returns a action index, and creates a new one if it does not exists.
 
shared_ptr< DiscreteSamplesget_discrete ()
 Returns a shared pointer to the discrete samples.
 

Protected Attributes

shared_ptr< DiscreteSamplesdiscretesamples
 
unordered_map< Action, long, AHash > action_map
 
unordered_map< State, long, SHash > state_map
 

Detailed Description

template<typename State, typename Action, typename SHash = std::hash<State>, typename AHash = std::hash<Action>>
class craam::msen::SampleDiscretizerSI< State, Action, SHash, AHash >

Turns arbitrary samples to discrete ones assuming that actions are state independent.

That is the actions must have consistent names across states. This assumption can cause problems when some samples are missing.

The internally-held discrete samples can be accessed and modified from the outside. Also, adding more samples will modify the discrete samples.

See SampleDiscretizerSD for a version in which action names are dependent on states.

A new hash function can be defined as follows:

namespace std{
template<> struct hash<pair<int,int>>{
size_t operator()(pair<int,int> const& s) const{
boost::hash<pair<int,int>> h;
return h(s);
};
}
};
Template Parameters
StateType of state in the source samples
ActionType of action in the source samples
ShashHash function for states
AhashHash function for actions

A hash function hash<type> for each sample type must exists.


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