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

Turns arbitrary samples to discrete ones (with continuous numbers assigned to states) assuming that actions are state dependent. More...

#include <Samples.hpp>

Public Member Functions

 SampleDiscretizerSD ()
 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 State &dstate, const Action &action)
 Returns an 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< pair< State, Action >, long, SAHash > action_map
 
unordered_map< State, long, SHash > action_count
 keeps the number of actions for each state
 
unordered_map< State, long, SHash > state_map
 

Detailed Description

template<typename State, typename Action, typename SAHash = std::hash<pair<State, Action>>, typename SHash = std::hash<State>>
class craam::msen::SampleDiscretizerSD< State, Action, SAHash, SHash >

Turns arbitrary samples to discrete ones (with continuous numbers assigned to states) assuming that actions are state dependent.

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

See SampleDiscretizerSI for a version in which action names are independent of 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
SAhashHash function for pair<State, Action>
ShashHash function for decision states

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


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