AIToolbox
A library that offers tools for AI problem solving.
|
This class represents a 2-agent tiger antelope environment. More...
#include <AIToolbox/Factored/MDP/Environments/TigerAntelope.hpp>
Public Member Functions | |
TigerAntelope (unsigned width, unsigned height) | |
Basic constructor. More... | |
std::tuple< State, Rewards > | sampleSRs (const State &s, const Action &a) const |
This function allows to sample a new state and rewards. More... | |
bool | isTerminalState (const State &s) const |
This function returns whether a state is terminal. More... | |
State | getS () const |
This function returns the state space of the model. More... | |
Action | getA () const |
This function returns the action space of the model. More... | |
double | getDiscount () const |
This function returns the discount factor of the model. More... | |
size_t | getAntelopeState () const |
This function returns the state where the antelope is located. More... | |
const AIToolbox::MDP::GridWorld & | getGrid () const |
This function returns a reference to the internal GridWorld. More... | |
std::string | printState (const State &s) const |
This function returns a graphical representation of a State. More... | |
This class represents a 2-agent tiger antelope environment.
The two tigers move in a torus grid which always has the antelope at its center. Their goal is to capture it; this can be done when both tigers are adjacent to the antelope, and only one of them moves onto it.
The antelope movement is simulated by shifting the whole world around, so that the antelope is always in the "center" of the state-space. This is done to reduce the size of the state-space from a 3d vector to a 2d vector.
Each tiger can move in one of the 4 cardinal directions, or stay still.
AIToolbox::Factored::MDP::TigerAntelope::TigerAntelope | ( | unsigned | width, |
unsigned | height | ||
) |
Basic constructor.
width | The width of the torus. |
height | The height of the torus. |
Action AIToolbox::Factored::MDP::TigerAntelope::getA | ( | ) | const |
This function returns the action space of the model.
size_t AIToolbox::Factored::MDP::TigerAntelope::getAntelopeState | ( | ) | const |
This function returns the state where the antelope is located.
double AIToolbox::Factored::MDP::TigerAntelope::getDiscount | ( | ) | const |
This function returns the discount factor of the model.
const AIToolbox::MDP::GridWorld& AIToolbox::Factored::MDP::TigerAntelope::getGrid | ( | ) | const |
This function returns a reference to the internal GridWorld.
State AIToolbox::Factored::MDP::TigerAntelope::getS | ( | ) | const |
This function returns the state space of the model.
bool AIToolbox::Factored::MDP::TigerAntelope::isTerminalState | ( | const State & | s | ) | const |
This function returns whether a state is terminal.
Note that this function's return value is not defined for invalid states (for example a state with both tigers in the same place).
s | The state to check. |
std::string AIToolbox::Factored::MDP::TigerAntelope::printState | ( | const State & | s | ) | const |
This function returns a graphical representation of a State.
std::tuple<State, Rewards> AIToolbox::Factored::MDP::TigerAntelope::sampleSRs | ( | const State & | s, |
const Action & | a | ||
) | const |
This function allows to sample a new state and rewards.
s | The state to start with. |
a | The action to perform. |