mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-05-16 21:10:08 +00:00
* fix Atari in CI * fix dtype and atari extra * Update setup.py * remove 3.6 * note about how to install Atari * pendulum-v1 * atari v5 * black * fix pendulum capitalization * add minimum version * moved things in changelog to breaking changes * partial v5 fix * env update to pass tests * mismatch env version fixed * Fix tests after merge * Include autorom in setup.py * Blacken code * Fix dtype issue in more robust way * Fix GitLab CI: switch to Docker container with new black version * Remove workaround from GitLab. (May need to rebuild Docker for this though.) * Revert to v4 * Update setup.py * Apply suggestions from code review * Remove unnecessary autorom * Consistent gym versions Co-authored-by: J K Terry <justinkterry@gmail.com> Co-authored-by: Anssi <kaneran21@hotmail.com> Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org> Co-authored-by: modanesh <mohamad4danesh@gmail.com> Co-authored-by: Adam Gleave <adam@gleave.me>
31 lines
850 B
Python
31 lines
850 B
Python
import gym
|
|
import numpy as np
|
|
import pytest
|
|
from gym.spaces import Box, Dict, Discrete
|
|
|
|
from stable_baselines3.common.env_checker import check_env
|
|
|
|
|
|
class ActionDictTestEnv(gym.Env):
|
|
action_space = Dict({"position": Discrete(1), "velocity": Discrete(1)})
|
|
observation_space = Box(low=-1.0, high=2.0, shape=(3,), dtype=np.float32)
|
|
|
|
def step(self, action):
|
|
observation = np.array([1.0, 1.5, 0.5], dtype=self.observation_space.dtype)
|
|
reward = 1
|
|
done = True
|
|
info = {}
|
|
return observation, reward, done, info
|
|
|
|
def reset(self):
|
|
return np.array([1.0, 1.5, 0.5], dtype=self.observation_space.dtype)
|
|
|
|
def render(self, mode="human"):
|
|
pass
|
|
|
|
|
|
def test_check_env_dict_action():
|
|
test_env = ActionDictTestEnv()
|
|
|
|
with pytest.warns(Warning):
|
|
check_env(env=test_env, warn=True)
|