Giter VIP home page Giter VIP logo

graph-env's Introduction

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, done, info = env.step(action)
    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

graph-env's People

Contributors

pstjohn avatar xtruan avatar charlesedisontripp avatar davebiagioni avatar jlaw9 avatar iammix avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.