dsapandora / plangym

Interface to use OpenAI gym for planning problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plan gym

Documentation Status Build Status Code coverage PyPI package license: MIT Code style: black

Plangym is an interface to use OpenAI gym for planning problems. It extends the standard interface to allow setting and recovering the environment states.

Furthermore, it provides functionality for stepping the environments in parallel, and it is compatible with passing the parameters as vectors of steps and actions.

Getting started

Stepping a batch of states and actions

from plangym import AtariEnvironment
env = AtariEnvironment(name="MsPacman-v0",
                       clone_seeds=True, autoreset=True)
state, obs = env.reset()

states = [state.copy() for _ in range(10)]
actions = [env.action_space.sample() for _ in range(10)]

data = env.step_batch(states=states, actions=actions)
new_states, observs, rewards, ends, infos = data

Using parallel steps

from plangym import AtariEnvironment, ParallelEnvironment
env = ParallelEnvironment(env_class=AtariEnvironment,
                          name="MsPacman-v0",
                          clone_seeds=True, autoreset=True,
                          blocking=False)

state, obs = env.reset()

states = [state.copy() for _ in range(10)]
actions = [env.action_space.sample() for _ in range(10)]

data =  env.step_batch(states=states,
                       actions=actions)
new_states, observs, rewards, ends, infos = data

Installation

bash pip3 install plangym

About

Interface to use OpenAI gym for planning problems

License:MIT License


Languages

Language:Python 87.8%Language:Jupyter Notebook 11.5%Language:Dockerfile 0.5%Language:Makefile 0.2%