A Gymnasium grid environment for educational purposes
Project description
EduGrid
[!NOTE] EduGrid is intended for educational purposes and is hence not optimized for speed. If you don't need so much flexibility, have a look at the Gymmasium environments "Minigrid" and "Frozen Lake".
EduGrid is a Gymnasium grid environment with focus on flexibility for educational purposes. The agent moves in a grid of cells and tries to reach target cells. Furthermore, dynamic programming algorithms are implemented and can iteratively be inspected.
Features
- The following environment properties can be inspected and modified:
transition_matrixwith shape(rows, columns, actions, rows, columns)specifying the probabilities for all "state-action-next_state" transitionsreward_matrixwith shape(rows, columns, actions, rows, columns)specifying the rewards for all "state-action-next_state" transitionsterminal_matrixwith shape(rows, columns)specifying whether states are terminal.
- Custom cells can be defined by implementing the abstract class
Celland overriding callbacks such ason_left,on_entered,on_step,is_blocking, andrender. - The dynamic programming algorithms "policy evaluation", "policy iteration" and "value iteration" are implemented in
edugrid.algorithms. They can iteratively be executed and inspected.
Installation
pip install edugrid
Examples
Environment creation and modification:
import edugrid
import gymnasium as gym
env = gym.make(
"philsteg/EduGrid-v0",
size=(3, 3),
agent_location=(0, 0),
wall_locations=[(2, slice(None))],
sink_locations=[(0, 1), (1, 0)],
target_locations=[(0, 2)],
slip_prob=0.5,
)
# Modify the reward matrix
env.unwrapped.reward_matrix[:, :, :, 0, 0] = 5
Algorithm: Value Iteration
import edugrid
from edugrid.algorithms.dynamic_programming import ValueIteration
import gymnasium as gym
env = gym.make("philsteg/EduGrid-v0")
value_iteration = ValueIteration(env, mode="state", gamma=1.0)
for i, values in enumerate(value_iteration.iter()):
# Inspect the values in each iteration
...
policy = value_iteration.get_policy(values, type="stochastic")
See the more sophisticated examples in examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file edugrid-0.0.2.tar.gz.
File metadata
- Download URL: edugrid-0.0.2.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c725c17d7ef1becbfe8c0e05f586f63bcc1b7937bd2f5e59543c5a1a52b9c9c
|
|
| MD5 |
ecbf06508a9dcdc3e5296fe9f6f848d0
|
|
| BLAKE2b-256 |
e851489d51298e2bc3354885e9fdfcde27df58ed594ca871a6ba931c385bb9c3
|
Provenance
The following attestation bundles were made for edugrid-0.0.2.tar.gz:
Publisher:
python-publish.yml on philsteg/edugrid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
edugrid-0.0.2.tar.gz -
Subject digest:
9c725c17d7ef1becbfe8c0e05f586f63bcc1b7937bd2f5e59543c5a1a52b9c9c - Sigstore transparency entry: 804440099
- Sigstore integration time:
-
Permalink:
philsteg/edugrid@0e8e3c3558a9a5eec12e408f21cef536433835ad -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/philsteg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0e8e3c3558a9a5eec12e408f21cef536433835ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file edugrid-0.0.2-py3-none-any.whl.
File metadata
- Download URL: edugrid-0.0.2-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
641219850e3fba531a22df7467b059e1a8a020d02a4d2a9581feeb01a7ca205c
|
|
| MD5 |
2cb8834f580f0c50dfcd446095e3a1c1
|
|
| BLAKE2b-256 |
e24f7a33cd19c2ffc1a8394c5f28ba9c4c6dea743bcde9a0bfa5a5ccec34705a
|
Provenance
The following attestation bundles were made for edugrid-0.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on philsteg/edugrid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
edugrid-0.0.2-py3-none-any.whl -
Subject digest:
641219850e3fba531a22df7467b059e1a8a020d02a4d2a9581feeb01a7ca205c - Sigstore transparency entry: 804440100
- Sigstore integration time:
-
Permalink:
philsteg/edugrid@0e8e3c3558a9a5eec12e408f21cef536433835ad -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/philsteg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0e8e3c3558a9a5eec12e408f21cef536433835ad -
Trigger Event:
release
-
Statement type: