Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
ericl committed Dec 9, 2018
1 parent 7a88d90 commit f53875c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions doc/source/rllib-env.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@ ARS **Yes** **Yes** No No

.. _`+parametric`: rllib-models.html#variable-length-parametric-action-spaces

You can pass either a string name or a Python class to specify an environment. By default, strings will be interpreted as a gym `environment name <https://gym.openai.com/envs>`__. Custom env classes passed this way must take a single ``env_config`` parameter in their constructor:
You can pass either a string name or a Python class to specify an environment. By default, strings will be interpreted as a gym `environment name <https://gym.openai.com/envs>`__. Custom env classes passed directly to the agent must take a single ``env_config`` parameter in their constructor:

.. code-block:: python
import ray
import gym, ray
from ray.rllib.agents import ppo
class MyEnv(gym.Env):
def __init__(self, env_config):
self.action_space = ...
self.observation_space = ...
...
self.action_space = <gym.Space>
self.observation_space = <gym.Space>
def reset(self):
return <obs>
def step(self, action):
return <obs>, <reward: float>, <done: bool>, <info: dict>
ray.init()
trainer = ppo.PPOAgent(env=MyEnv, config={
Expand Down

0 comments on commit f53875c

Please sign in to comment.