safe-rl / safe-rl-shielding

MIT License
39 stars 13 forks source link

Running GridWorld #1

Open Viehzeug opened 6 years ago

Viehzeug commented 6 years ago

Hey!

I was trying to rerun your GridWorld example. However I end up with the following error:

Traceback (most recent call last): | alpha = 0.2 | epsilon = 0.6
  File "simulator.py", line 919, in <module>
    agent.learn()
  File "/Users/marc/miniconda3/envs/saferlshieldingnew/lib/python2.7/site-packages/pybrain/rl/agents/learning.py", line 78, in learn
    self.learner.learnEpisodes(episodes)
  File "/Users/marc/miniconda3/envs/saferlshieldingnew/lib/python2.7/site-packages/pybrain/rl/learners/learner.py", line 45, in learnEpisodes
    self.learn(*args, **kwargs)
  File "/private/tmp/foo/safe-rl-shielding/envs/grid_world/my_pybrain/my_learner.py", line 42, in learn
    for state, actions, reward in seq:
  File "/Users/marc/miniconda3/envs/saferlshieldingnew/lib/python2.7/site-packages/pybrain/datasets/sequential.py", line 60, in getSequenceIterator
    fields = self.getSequence(index)
  File "/Users/marc/miniconda3/envs/saferlshieldingnew/lib/python2.7/site-packages/pybrain/datasets/sequential.py", line 55, in getSequence
    return [self._getSequenceField(index, l) for l in self.link]
  File "/Users/marc/miniconda3/envs/saferlshieldingnew/lib/python2.7/site-packages/pybrain/datasets/sequential.py", line 44, in _getSequenceField
    return self.getField(field)[ravel(self.getField('sequence_index'))[index]:]
TypeError: slice indices must be integers or None or have an __index__ method

I got to this error with both python 2 and python 3 (each from a clean virtual env with pybrain and pybrain3 respectively). The invocation was python simulator.py 9x9_illustrative/9x9_illustrative.png -t=.6 -o=3 -c=9x9_illustrative/9x9_illustrative, but the error even happens if I just run python simulator.py 9x9_illustrative/9x9_illustrative.png.

florisdenhengst commented 5 years ago

Cannot replicate this issue on the following environment:

Note numpy==1.11 instead of numpy==1.13.

# packages in environment at <path>:
#
atari-py                  0.1.1                     <pip>
bleach                    1.5.0                     <pip>
certifi                   2017.7.27.1               <pip>
certifi                   2016.2.28                py35_0  
chardet                   3.0.4                     <pip>
Django                    1.11.4                    <pip>
gym                       0.7.0                     <pip>
html5lib                  0.9999999                 <pip>
idna                      2.6                       <pip>
image                     1.5.13                    <pip>
imageio                   2.2.0                     <pip>
Keras                     2.0.8                     <pip>
Markdown                  2.6.9                     <pip>
mujoco-py                 0.5.7                     <pip>
numpy                     1.11.0                    <pip>
olefile                   0.44                      <pip>
opencv-python             3.3.0.9                   <pip>
openssl                   1.0.2l                        0  
Pillow                    4.2.1                     <pip>
pip                       9.0.1                    py35_1  
protobuf                  3.4.0                     <pip>
PyBrain3                  3.0.4                     <pip>
pygame                    1.9.3                     <pip>
pyglet                    1.2.4                     <pip>
PyOpenGL                  3.1.0                     <pip>
python                    3.5.4                         0  
pytz                      2017.2                    <pip>
PyYAML                    3.12                      <pip>
readline                  6.2                           2  
requests                  2.18.4                    <pip>
scipy                     0.19.1                    <pip>
setuptools                36.4.0                   py35_1  
six                       1.10.0                    <pip>
sqlite                    3.13.0                        0  
tensorflow                1.3.0                     <pip>
tensorflow-tensorboard    0.1.5                     <pip>
Theano                    0.9.0                     <pip>
tk                        8.5.18                        0  
tqdm                      4.15.0                    <pip>
urllib3                   1.22                      <pip>
Werkzeug                  0.12.2                    <pip>
wheel                     0.29.0                   py35_0  
xz                        5.2.3                         0  
zlib                      1.2.11                        0