ReinforcementLearning (version 1.0.5)

gridworldEnvironment: Defines an environment for a gridworld example

Description

Function defines an environment for a 2x2 gridworld example. Here an agent is intended to navigate from an arbitrary starting position to a goal position. The grid is surrounded by a wall, which makes it impossible for the agent to move off the grid. In addition, the agent faces a wall between s1 and s4. If the agent reaches the goal position, it earns a reward of 10. Crossing each square of the grid results in a negative reward of -1.

Usage

gridworldEnvironment(state, action)

Arguments

state

The current state.

action

Action to be executed.

Value

List containing the next state and the reward.

Examples

Run this code
# NOT RUN {
# Load gridworld environment
gridworld <- gridworldEnvironment

# Define state and action
state <- "s1"
action <- "down"

# Observe next state and reward
gridworld(state, action)

# }

Run the code above in your browser using DataLab