|
| GRMDP (long state_count) |
| Constructs the RMDP with a pre-allocated number of states. More...
|
|
| GRMDP () |
| Constructs an empty RMDP. More...
|
|
SType & | create_state (long stateid) |
| Assures that the MDP state exists and if it does not, then it is created. More...
|
|
SType & | create_state () |
| Creates a new state at the end of the states. More...
|
|
size_t | state_count () const |
| Number of states.
|
|
size_t | size () const |
| Number of states.
|
|
const SType & | get_state (long stateid) const |
| Retrieves an existing state.
|
|
const SType & | operator[] (long stateid) const |
| Retrieves an existing state.
|
|
SType & | get_state (long stateid) |
| Retrieves an existing state.
|
|
SType & | operator[] (long stateid) |
| Retrieves an existing state.
|
|
const vector< SType > & | get_states () const |
|
bool | is_normalized () const |
| Check if all transitions in the process sum to one. More...
|
|
void | normalize () |
| Normalize all transitions to sum to one for all states, actions, outcomes. More...
|
|
template<typename Policy > |
long | is_policy_correct (const Policy &policies) const |
| Checks if the policy and nature's policy are both correct. More...
|
|
void | to_csv (ostream &output, bool header=true) const |
| Saves the model to a stream as a simple csv file. More...
|
|
void | to_csv_file (const string &filename, bool header=true) const |
| Saves the transition probabilities and rewards to a CSV file. More...
|
|
string | to_string () const |
| Returns a brief string representation of the RMDP. More...
|
|
string | to_json () const |
| Returns a json representation of the RMDP. More...
|
|
template<class SType>
class craam::GRMDP< SType >
A general robust Markov decision process.
Contains methods for constructing and solving RMDPs.
Some general assumptions (may depend on the state and action classes):
- Transition probabilities must be non-negative but do not need to add up to a specific value
- Transitions with 0 probabilities may be omitted, except there must be at least one target state in each transition
- State with no actions: A terminal state with value 0
- Action with no outcomes: Terminates with an error for uncertain models, but assumes 0 return for regular models.
- Outcome with no target states: Terminates with an error
- Invalid actions are ignored
- Behavior for a state with all invalid actions is not defined
- Template Parameters
-
SType | Type of state, determines s-rectangularity or s,a-rectangularity and also the type of the outcome and action constraints |
template<class SType>
void craam::GRMDP< SType >::to_csv |
( |
ostream & |
output, |
|
|
bool |
header = true |
|
) |
| const |
|
inline |
Saves the model to a stream as a simple csv file.
States, actions, and outcomes are identified by 0-based ids. Columns are separated by commas, and rows by new lines.
The file is formatted with the following columns: idstatefrom, idaction, idoutcome, idstateto, probability, reward
Exported and imported MDP will be be slightly different. Since action/transitions will not be exported if there are no actions for the state. However, when there is data for action 1 and action 3, action 2 will be created with no outcomes.
Note that outcome distributions are not saved.
- Parameters
-
output | Output for the stream |
header | Whether the header should be written as the first line of the file represents the header. |