AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Factored::MDP::TigerAntelope Class Reference

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, RewardssampleSRs (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::GridWorldgetGrid () 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TigerAntelope()

AIToolbox::Factored::MDP::TigerAntelope::TigerAntelope ( unsigned  width,
unsigned  height 
)

Basic constructor.

Parameters
widthThe width of the torus.
heightThe height of the torus.

Member Function Documentation

◆ getA()

Action AIToolbox::Factored::MDP::TigerAntelope::getA ( ) const

This function returns the action space of the model.

◆ getAntelopeState()

size_t AIToolbox::Factored::MDP::TigerAntelope::getAntelopeState ( ) const

This function returns the state where the antelope is located.

◆ getDiscount()

double AIToolbox::Factored::MDP::TigerAntelope::getDiscount ( ) const

This function returns the discount factor of the model.

◆ getGrid()

const AIToolbox::MDP::GridWorld& AIToolbox::Factored::MDP::TigerAntelope::getGrid ( ) const

This function returns a reference to the internal GridWorld.

◆ getS()

State AIToolbox::Factored::MDP::TigerAntelope::getS ( ) const

This function returns the state space of the model.

◆ isTerminalState()

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).

Parameters
sThe state to check.
Returns
Whether the state is terminal.

◆ printState()

std::string AIToolbox::Factored::MDP::TigerAntelope::printState ( const State s) const

This function returns a graphical representation of a State.

◆ sampleSRs()

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.

Parameters
sThe state to start with.
aThe action to perform.
Returns
A new state and rewards.

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