Home > marl > world > gridworld > gridworld.m

gridworld

PURPOSE ^

Creates a 2D grid world

SYNOPSIS ^

function gw = gridworld(agents, name, worldsize, goalpos, initpos, obstacles, rewards)

DESCRIPTION ^

Creates a 2D grid world
  GW = GRIDWORLD(AGENTS, NAME, WORLDSIZE, GOALPOS, [INITPOS, OBSTACLES, REWARDS])
  Parameters:
   AGENTS      - the agents in the gridworld, as a (possibly
               heterogeneous) cell array
   NAME        - the name of the gridworld
   WORLDSIZE   - the size of the 2D gridworld, a vector [W H]
   GOALPOS     - the goal positions of the agents. One agent position on
               each row. Should specify goal positions for the maximum
               number of agents in the gridworld.
   INITPOS     - (optional) the deterministic initial positions of the
               agents. If an empty matrix, at each trial start agents will
               be placed in random positions in the world. One agent
               position on each column. Should specify initial positions for
               the maximum number of agents in the gridworld.
               Default: empty matrix.
   OBSTACLES   - (optional) the obstacles to place in the gridworld.
               May be: a matrix with obstacle 2D coordinates on each column;
               an empty matrix, in which case no obstacles are placed; or
               the string 'user' to obtain the obstacles interactively
               from the user. Default is empty matrix (no obstacles)
   REWARDS     - (optional) a vector with three elements, [RMOVE RCOLL RGOAL],
               specifying how much should the agents be rewarded /
               penalized upon an ordinary move, a collision and reaching
               the goal. Default is [-1 -2 10]

  Agents can move one cell in either of the four compass directions,
  or stay still. Each agent has one action variable available, and its
  values are coded in the following way:
   1 - left
   2 - right
   3 - up
   4 - down
   5 - stay put
  Note that an agent can function without the fifth action.

  The agents cannot move out of the grid, onto an obstacle, or onto a goal
  that does not belong to them. If agents collide, they will be reset to
  their positions previous to the collision.
  Each agent finishes when it has reached its corresponding goal. There is
  no failure situation.


  See also gridworldview, gridworld_advance, gridworld_destroy,
      gridworld_obstacles, gridworld_reset

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 04-Aug-2010 16:55:08 by m2html © 2005