Skip to main content

Random Walk

This environment reflects the Markov Reward Process (MRP) defined in Example 6.2 Random Walk of the book Reinforcement Learning An Introduction (2nd Ed) by Richard S. Sutton and Andrew G. Barto.
The Random Walk Environment is a custom Gymnasium environment that simulates a simple random walk process. The agent starts in a predefined state and moves randomly to adjacent states (left or right) at each timestep. The states are arranged in a row, with terminal states at both ends. The rightmost terminal state rewards the agent with +1, while all other transitions have a reward of 0. The environment is ideal for experiments in reinforcement learning or Markov Reward Processes (MRPs), focusing on stochastic state transitions without actions.

Installation

pip install random-walk-env

Use with gymnasium

import random_walk_env
import gymnasium as gym

env = gym.make('random_walk_env/RandomWalk-v0')

Note

As per the gymnasium API for the step function, an action must be provided. However, this value is ignored as this environment represents a Markov Reward Process (and not a Markov Decision Process).

The terminal states are represented by * (asterisk). Terminal states are the leftmost and the rightmost states.

You can set the number of (nonterminal) states and the index of the start state as the following.

env = gym.make('random_walk_env/RandomWalk-v0', num_states=6, start_state=4) # *ABCD[E]F*

Default is num_states=5, start_state=2 (*AB[C]DE*).

Metadata

Release files for random-walk-env 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for random-walk-env 0.0.4
File Size Uploaded
random_walk_env-0.0.4.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for random-walk-env 0.0.4
File Interpreter ABI Platform
random_walk_env-0.0.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.4 kB

Release files / random_walk_env-0.0.4.tar.gz

Download URL random_walk_env-0.0.4.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
88fa26623e0f86a0134135c1bf74f2a10dd731b41bcac3ad21859e81967b339b
BLAKE2b-256 checksum
How to use checksums
74f947754d0feadab2a238df3410ac0e4f4d4d5923e564017c7f9349dc031d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / random_walk_env-0.0.4-py2.py3-none-any.whl

Download URL random_walk_env-0.0.4-py2.py3-none-any.whl
Size 4.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5c81f56dbac97ec984d63ae5982b7e63954150f29e3c9b936bf1e84909bc6f06
BLAKE2b-256 checksum
How to use checksums
d783ee2cb840baab560a2dbbc97edc935cbbb8ec33fc022079162d776b989153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page