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.0.2.tar.gz (491.0 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.0.2-py3-none-any.whl (489.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hybrid_platform-0.0.2.tar.gz
Algorithm Hash digest
SHA256 795d4281dfdad5b011fb077e38d804d1fe1a34c5de438470db9bb1302b36c91f
MD5 52a9231f9ab43c9dc2edcdc801b3cc5b
BLAKE2b-256 9262bde1292327d5127989117748c1f402d2472d56ba0a279f889c431e9c6103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hybrid_platform-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7821eb1d205a71dae2665aac9b3ceb6dd6580263cc745a83669f228ba7545e4d
MD5 3358cfe8e6b9ef5bc6d771020d612b73
BLAKE2b-256 8720a97fd8790cf250b83eac43189402ac145caf7b64254ff8ae2ec4d2aa6baf

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