CRAAM
2.0.0
Robust and Approximate Markov Decision Processes
|
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< DiscreteSamples > | get_discrete () |
Returns a shared pointer to the discrete samples. | |
Protected Attributes | |
shared_ptr< DiscreteSamples > | discretesamples |
unordered_map< Action, long, AHash > | action_map |
unordered_map< State, long, SHash > | state_map |
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:
State | Type of state in the source samples |
Action | Type of action in the source samples |
Shash | Hash function for states |
Ahash | Hash function for actions |
A hash function hash<type> for each sample type must exists.