From 7ac626c9f6088b75d29c0fb442e62321e9e4bea0 Mon Sep 17 00:00:00 2001 From: Nikunj-Gupta Date: Mon, 8 Feb 2021 01:45:01 +0530 Subject: [PATCH 1/2] fixed errors --- env/multiagent/multi_discrete.py | 5 +++-- env/multiagent/rendering.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/env/multiagent/multi_discrete.py b/env/multiagent/multi_discrete.py index d7108ad..7f49b62 100644 --- a/env/multiagent/multi_discrete.py +++ b/env/multiagent/multi_discrete.py @@ -4,7 +4,7 @@ import numpy as np import gym -from gym.spaces import prng +# from gym.spaces import prng class MultiDiscrete(gym.Space): """ @@ -30,7 +30,8 @@ def __init__(self, array_of_param_array): def sample(self): """ Returns a array with one sample from each discrete action space """ # For each row: round(random .* (max - min) + min, 0) - random_array = prng.np_random.rand(self.num_discrete_space) + # random_array = prng.np_random.rand(self.num_discrete_space) + random_array = np.random.RandomState().rand(self.num_discrete_space) return [int(x) for x in np.floor(np.multiply((self.high - self.low + 1.), random_array) + self.low)] def contains(self, x): return len(x) == self.num_discrete_space and (np.array(x) >= self.low).all() and (np.array(x) <= self.high).all() diff --git a/env/multiagent/rendering.py b/env/multiagent/rendering.py index cd00c7f..5b01600 100644 --- a/env/multiagent/rendering.py +++ b/env/multiagent/rendering.py @@ -11,18 +11,18 @@ os.environ['DYLD_FALLBACK_LIBRARY_PATH'] += ':/usr/lib' # (JDS 2016/04/15): avoid bug on Anaconda 2.3.0 / Yosemite -from gym.utils import reraise +# from gym.utils import reraise from gym import error try: import pyglet except ImportError as e: - reraise(suffix="HINT: you can install pyglet directly via 'pip install pyglet'. But if you really just want to install all Gym dependencies and not have to think about it, 'pip install -e .[all]' or 'pip install gym[all]' will do it.") + raise ImportError() try: from pyglet.gl import * except ImportError as e: - reraise(prefix="Error occured while running `from pyglet.gl import *`",suffix="HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'. If you're running on a server, you may need a virtual frame buffer; something like this should work: 'xvfb-run -s \"-screen 0 1400x900x24\" python '") + raise ImportError(prefix="Error occured while running `from pyglet.gl import *`") import math import numpy as np From f71d679f71b9bbb9767fd43fc676a56da7430f1b Mon Sep 17 00:00:00 2001 From: Nikunj-Gupta Date: Mon, 8 Feb 2021 01:45:46 +0530 Subject: [PATCH 2/2] added initial setup files like makefile and .gitignore --- .gitignore | 1 + __init__.py | 0 makefile | 3 +++ 3 files changed, 4 insertions(+) create mode 100644 .gitignore create mode 100644 __init__.py create mode 100644 makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/makefile b/makefile new file mode 100644 index 0000000..e91ec77 --- /dev/null +++ b/makefile @@ -0,0 +1,3 @@ +all: + clear + PYTHONPATH=$(PWD) python3 algo/ma_main.py \ No newline at end of file