This class represents a simple rectangular gridworld.
More...
#include <AIToolbox/MDP/Environments/Utils/GridWorld.hpp>
This class represents a simple rectangular gridworld.
◆ Direction
◆ GridWorld()
AIToolbox::MDP::GridWorld::GridWorld |
( |
unsigned |
width, |
|
|
unsigned |
height, |
|
|
bool |
torus = false |
|
) |
| |
Basic constructor.
- Parameters
-
width | The number of columns in the world. |
height | The number of rows in the world. |
torus | Whether to join the edges of the grid as in a torus. |
◆ distance()
unsigned AIToolbox::MDP::GridWorld::distance |
( |
const State & |
s1, |
|
|
const State & |
s2 |
|
) |
| const |
This function returns the Manhattan distance between the two states.
- Returns
- The distance between the input states.
◆ getAdjacent() [1/2]
This function returns the state next to the input in the chosen Direction.
This function returns the same state if the Direction goes outside the Grid boundaries.
- Parameters
-
d | The Direction to look for. |
s | The initial State. |
- Returns
- The State next to the input.
◆ getAdjacent() [2/2]
State AIToolbox::MDP::GridWorld::getAdjacent |
( |
size_t |
d, |
|
|
State |
s |
|
) |
| const |
This function uses size_t to pass the direction.
- Parameters
-
d | The Direction to look for. |
s | The initial State. |
- Returns
- The State next to the input.
◆ getHeight()
unsigned AIToolbox::MDP::GridWorld::getHeight |
( |
| ) |
const |
This function returns the height of the GridWorld.
◆ getS()
size_t AIToolbox::MDP::GridWorld::getS |
( |
| ) |
const |
This function returns the number of cells in the grid.
◆ getWidth()
unsigned AIToolbox::MDP::GridWorld::getWidth |
( |
| ) |
const |
This function returns the width of the GridWorld.
◆ isTorus()
bool AIToolbox::MDP::GridWorld::isTorus |
( |
| ) |
const |
This function returns whether the GridWorld represents a torus.
◆ operator()() [1/2]
State AIToolbox::MDP::GridWorld::operator() |
( |
const size_t |
s | ) |
const |
This function returns the State with the input numerical representation.
- Parameters
-
s | The State numerical representation. |
◆ operator()() [2/2]
State AIToolbox::MDP::GridWorld::operator() |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
This function returns the State at the selected position.
Coordinates are bound to the size of the GridWorld.
- Parameters
-
x | The x of the output State. |
y | The y of the output State. |
The documentation for this class was generated from the following file: