Downloads · 30 days
0
minzSleeps/TransportEnergyGridEnv
TransportEnergyGridEnv is a machine learning model from minzSleeps. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A custom Gymnasium environment for Reinforcement Learning. The agent operates in a grid environment to pick up cargo, manage energy reserves, avoid moving/patrolling enemies, and safely deliver cargo to the destination.
Downloads · 30 days
0
Access
Public
Updated Aug 3, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py32.6 KB · 49%
From the Hugging Face model README
deathenv)A custom Gymnasium environment for Reinforcement Learning. The agent operates in a grid environment to pick up cargo, manage energy reserves, avoid moving/patrolling enemies, and safely deliver cargo to the destination.
gymnasium.Env and integrates seamlessly with gym.make()..record() method to evaluate policies and save MP4 demonstrations.pip install git+https://huggingface.co/minzSleeps/TransportEnergyGridEnv.git
pip install git+https://github.com/Minz-sleeps/DeathEnv.git
git clone https://github.com/Minz-sleeps/DeathEnv.git
cd DeathEnv
pip install -e .
import gymnasium as gym
import deathenv
env = gym.make("TransportEnergyGrid-v0", grid_size=20, n_obstacles=10)
obs, info = env.reset(seed=42)
done = False
while not done:
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
env.close()
from src.env import TransportEnergyGridEnv
env = TransportEnergyGridEnv(grid_size=20)
env.record("demo.mp4", model=None, seed=42)
env.close()
DeathEnv/
├── pyproject.toml # Package configuration and dependencies
├── README.md # Documentation
├── requirements.txt # Core dependencies
├── src/
│ ├── __init__.py # Package exports & Gymnasium registration
│ └── env.py # TransportEnergyGridEnv implementation
└── examples/
├── train.py # Example: Train DQN agent via Stable-Baselines3
├── evaluate.py # Example: Evaluate model & record video
0: Move Up1: Move Down2: Move Left3: Move RightLocal grid surrounding the agent (6 channels) + 5 metadata attributes (Normalized energy, Has cargo flag, Step progress, Normalized X/Y distance to target).
The environment features fully customizable rewards via the rewards argument (a dictionary overriding default values):
custom_rewards = {
"step": -0.05, # Step penalty
"collision": -2.0, # Obstacle or grid boundary collision
"cargo_pickup": 30.0, # Cargo pickup reward
"delivery": 100.0, # Successful delivery to destination
"barrel": 20.0, # Collecting energy barrel
"enemy_collision": -50.0, # Collision with an enemy
"energy_exhaustion": -30.0 # Running out of energy
}
env = gym.make("TransportEnergyGrid-v0", rewards={"delivery": 200.0, "step": -0.1})
Training a DQN agent using [Stable-Baselines3]:
python examples/train.py --timesteps 1000000 --grid-size 30
Evaluating a trained model and saving a video:
python examples/evaluate.py --model-path dqn_transport_agent --output demo.mp4