gridworldEnvironment: Defines an environment for a gridworld example

Description Usage Arguments Value Examples

View source: R/gridworld.R

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

1

Arguments

state

The current state.

action

Action to be executed.

Value

List containing the next state and the reward.

Examples

1
2
3
4
5
6
7
8
9
# Load gridworld environment
gridworld <- gridworldEnvironment

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

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

ReinforcementLearning documentation built on March 26, 2020, 7:38 p.m.