Skip to main content

Platform domain Gymnasium environment

Project description

Hybrid Platform

A Gymnasium environment for the Platform domain, featuring a parameterized (hybrid) action space. This environment is widely used for benchmarking Reinforcement Learning algorithms that must handle both discrete action choices and continuous parameters simultaneously.

This is a modern fork of the original gym-platform, fully updated to use the Gymnasium API and modern numpy.

gym-platform

Installation

You can install the package directly from PyPI:

pip install hybrid-platform

Usage

import gymnasium as gym
import gym_platform

# Create the environment
env = gym.make('Platform-v0', render_mode='human')

obs, info = env.reset()

for _ in range(100):
    # Action structure: (discrete_action_index, (param_0, param_1, param_2))
    # where param_X is an array of shape (1,)
    
    # Example: RUN (0) with speed 15.0
    action = (0, ([15.0], [0.0], [0.0]))
    
    obs, reward, terminated, truncated, info = env.step(action)
    
    env.render()

    if terminated or truncated:
        obs, info = env.reset()

env.close()

Action Space

The action space is spaces.Tuple((spaces.Discrete(3), spaces.Tuple((spaces.Box(1), spaces.Box(1), spaces.Box(1))))). It consists of:

  1. Discrete(3): The high-level action choice.
    • 0: Run (Move horizontally)
    • 1: Hop (Small jump to clear gaps)
    • 2: Leap (Large jump to clear larger gaps)
  2. Tuple(Box(1), Box(1), Box(1)): The continuous parameters for each action.
    • Parameter 0 (Run): Speed, range [0, 30]
    • Parameter 1 (Hop): Power, range [0, 720]
    • Parameter 2 (Leap): Power, range [0, 430]

When taking a step, the environment selects the parameter corresponding to the chosen discrete action index and ignores the others.

Observation Space

The observation space is a spaces.Tuple containing:

  1. Box(9,): The state vector (scaled).
    • Basic features: [player_x, player_vx, enemy_x, enemy_dx]
    • Platform features: [platform_width_1, platform_width_2, gap, platform_position, height_diff]
  2. Discrete(200): The current time step (used for time awareness).

Original Credits

  • Original Platform domain by Warwick Masson et al.
  • Original gym-platform implementation by Craig Bester.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hybrid_platform-0.1.0.tar.gz (490.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hybrid_platform-0.1.0-py3-none-any.whl (489.8 kB view details)

Uploaded Python 3

File details

Details for the file hybrid_platform-0.1.0.tar.gz.

File metadata

  • Download URL: hybrid_platform-0.1.0.tar.gz
  • Upload date:
  • Size: 490.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for hybrid_platform-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9669e2d57c828ba1ed535bcfd0aefef46fa4f313001a97eb95aa415b499359c1
MD5 7a1f5aede72447e6877cd022593286cf
BLAKE2b-256 daae9fe674b963f5ca52748c9c6ea5e605b500552026aeb4138ff8297ff19979

See more details on using hashes here.

File details

Details for the file hybrid_platform-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hybrid_platform-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac8aaccb4c5e3aa353a6fd0cb7c695ca4b91a3b47bb1d94bc14e8c86d52edfd2
MD5 a6e95bdb89420b26d19f1ac4741504e1
BLAKE2b-256 43c4057e0d7a85ed662cdb9aca89e17e72a0c071d8dc9927c3c163a9bd9a62fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page