GridWorld

Module that implements a simple grid world with obstacles and rewards/reinforcement. Movements are given either as absolute or relative directions in the MOVE input.

In absolute mode set by move = "max", the maximum direction in the MOVE array sets the direction of movement. The four components in the array correspond to north (up), east (right), south (down) and west (left). In absolute mode with summation, set by move = "sum", the movement is the result of adding all directions in the MOVE input before finding the maximum direction.

In relative mode, set by move = "relative", the array MOVE is interpreted as having three components: move-ahead, turn-left, turn-right. With mode = "relative_sum", the components turn-left and turn-right are subtracted before the maximum is found.

No action is performed if MOVE is the zero vector.

The agent is automatically moved to the initial location when a reward location is reached.

Example XML definition

A simple example

  <module
      class = "GridWorld"
      name = "GridWorld"
      start_x = "2"
      start_y = "2"
      move = "absolute"
  />

Parameters

NameDescriptionTypeDefault
classThe class name for the module; must be "GridWorld".string
nameThe name of this instance of the module.string
moveHow to use the MOVE inputchoices:
max
sum
relative_max
relative_sum
max
start_xStarting x coordinate for the agentint1
start_yStarting y coordinate for the agentint1
normalize_coordinateMap coordinate output to the interval 0..1boolno

Module Connections

Inputs

NameDescription
MOVEMove in absolute directions (N, E, S, W) or relative (Forward, Turn-Left, Turn-Right).
OBSTACLESMatrix with obstacles
VALUESMatrix with values

Outputs

NameDescription
LOCATIONMatrix with location of agent
COORDINATEArray with location of agent as an x, y value
LOCAL_OBSTACLES3x3 grid around agent
LOCAL_VALUES3x3 grid around agent
REWARDThe current reward value
COLLISIONThe action makes the agent collide with a wall
IMAGEAn image of the world with agent. Can be used by a viewer to visualize the world

Limitations

It should be possible to turn off the automatic movement of the agent from goal to start locations.

Author

Christian Balkenius
christian.balkenius@lucs.lu.se
Lund University Cognitive Science

Files

GridWorld.h
GridWorld.cc
GridWorld.ikc

blog comments powered by Disqus