Skip to main content

Library to describe Gymnasium spaces as Python objects

Project description

Human Abstraction Gymnasium Language (HAGL)

Goal of this library is to simplify work with environment. In some times when you create environment there are necessity to use Box space because of library support, simplicity and etc. For example

Box(-1, 1, (20,))

And then, when implementing step method work with observation as numerical array:

position = observation[0:2]

Such work could be very uncomfortable. One of the existed solution is to use Dict space:

Dict({
    "position": Box(-1, 1, (2,)),
    "velocity": Box(-1, 1, (2,))
})

Dict can be transformed in Box space with flatten, unflatten and flatten_space functions from Gymnasium. With HAGL it can be written in such way:

class Observation:
    position = Position()
    velocity = Velocity()

This allows to use objects in step function:

position = observation.position

And then, using compile_type function or HAGLWrapper (for Gymnasium), HAGLParallelWrapper (for PettingZoo) this will be transformed to Box space. Difference of HAGL and Dict is that:

  • Can add method to class and use it in step function
  • Can use inheritance
  • When describe spaces with HAGL there are possibility to use usual python types for float, bool and arrays
  • There are some built-in types, for example Position and Velocity.

As a result: HAGL can be used to automate transformation of Gymnasium space representation to Python object

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

pyhagl-0.0.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

pyhagl-0.0.1-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file pyhagl-0.0.1.tar.gz.

File metadata

  • Download URL: pyhagl-0.0.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for pyhagl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1e676edc59f9def4b4d4452d49a9ed967ebe2affacd23f3c02785b802b619f15
MD5 677894ec192ffed4d16cc384b34e8eed
BLAKE2b-256 fa4b9c76c6a110bf21b50260f9011e2cb681a2a0131002f1c4e77b812310752d

See more details on using hashes here.

File details

Details for the file pyhagl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyhagl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for pyhagl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 696ab04d021a28465513a0e575322523dbada4e6a0d6c6bf73e1b298f5002fbb
MD5 8a9b17da9fcb25db12f8eee8660325f5
BLAKE2b-256 d297eb781dbafb46e3f109c9b6f36c1416112c6dd0f50d392b5e35577fd2eb78

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