Skip to main content

PyPI version Total alerts Language grade: Python DOI DOI

graph-env

The graphenv Python library is designed to

  1. make graph search problems more readily expressible as RL problems via an extension of the OpenAI gym API while
  2. enabling their solution via scalable learning algorithms in the popular RLLib library.

RLLib provides out-of-the-box support for both parametrically-defined actions and masking of invalid actions. However, native support for action spaces where the action choices change for each state is challenging to implement in a computationally efficient fashion. The graphenv library provides utility classes that simplify the flattening and masking of action observations for choosing from a set of successor states at every node in a graph search.

Installation

Graphenv can be installed with pip:

pip install graphenv

Quick Start

graph-env allows users to create a customized graph search by subclassing the Vertex class. Basic examples are provided in the graphenv/examples folder. The following code snippet shows how to randomly sample from valid actions for a random walk down a 1D corridor:

import random
from graphenv.examples.hallway.hallway_state import HallwayState
from graphenv.graph_env import GraphEnv

state = HallwayState(corridor_length=10)
env = GraphEnv({"state": state, "max_num_children": 2})

obs = env.make_observation()
done = False
total_reward = 0

while not done:
    action = random.choice(range(len(env.state.children)))
    obs, reward, terminated, truncated, info = env.step(action)
    done = terminated or truncated
    total_reward += reward

Additional details on this example are given in the documentation

Documentation

The documentation is hosted on GitHub Pages

Contributing

We welcome bug reports, suggestions for new features, and pull requests. See our contributing guidelines for more details.

License

graph-env is licensed under the BSD 3-Clause License. Copyright (c) 2022, Alliance for Sustainable Energy, LLC

Metadata

Release files for graphenv 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphenv 0.2.6
File Size Uploaded Provenance
graphenv-0.2.6.tar.gz 1.3 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for graphenv 0.2.6
File Interpreter ABI Platform
graphenv-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / graphenv-0.2.6.tar.gz

Download URL graphenv-0.2.6.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
18656e1e7d4563e8aa4d965ca9ba716c8f35d9134892e0cb6b604674028dc4b4
BLAKE2b-256 checksum
How to use checksums
799a754b2d5fa463454afb083b2f3e9693da3ca2c6761ef45a466375629666f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / graphenv-0.2.6-py3-none-any.whl

Download URL graphenv-0.2.6-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68e801583c115c6551ed74fb689c0b476eb491616a7b3736bdce14d5161df16d
BLAKE2b-256 checksum
How to use checksums
3bd95e2ad4470bf9fcf6ed7a40d5f529528eb6bbc3451a75a42912c070e7421c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for graphenv 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page