ab316 / opennero

Automatically exported from code.google.com/p/opennero
Other
0 stars 0 forks source link

Default random seed set to constant and is hard to change #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
OpenNERO starts witha default random seed set to constant, and this seed is 
difficult to change. Setting it via command line parameters does not seem to 
work. Should also be possible to set it via appConfig.py. This is bad for 
running experiments.

Patrick, please provide additional detail.

Original issue reported on code.google.com by ikarpov on 22 Feb 2011 at 8:36

GoogleCodeExporter commented 9 years ago
I was trying to run sarsa on a fixed maze in the Maze module over condor and I 
found that my results for each run were always the same as the agent always 
followed the same steps.  This is happening because the epsilon greedy policy 
is always using the same random seed.  I tried using the --random argument and 
also changing the seeds value in appConfig.py (which has been removed from the 
repository) but the results are always the same.

Steps to reproduce:
Add something like the following to generate() in mods/Maze/mazer.py when 
generating a random maze in order to always have the same maze:
        seed = random.randint(0,999999)
        random.seed(346)
        random.shuffle(wall_list) # randomly order the walls
        random.seed(seed)

Start the a sarsa agent in the Maze module and notice the path it takes.  
Restart OpenNero and notice that the sarsa agent follows the identical path as 
before no matter what random seed is specified at the command line.  I got 
around this problem by adding a C++ function that allowed for a random seed to 
be injected by the python code in the Maze module into the TD.cpp random number 
generator but I really shouldn't of had to do this. 

Original comment by pat...@gmail.com on 2 Mar 2011 at 2:40

GoogleCodeExporter commented 9 years ago

Original comment by ikarpov on 7 Mar 2011 at 5:25

GoogleCodeExporter commented 9 years ago

Original comment by ikarpov on 10 Mar 2011 at 1:04

GoogleCodeExporter commented 9 years ago
We have two random number generators with independent seeding - the one used by 
Python, and the one used by the C++ code. TDAgent subclasses use the C++ random 
number generator, which apparently does not get affected by the --random 
parameters. 

appConfig.py has been removed intentionally because some parameters needed to 
be processed before Python was loaded, making it difficult to keep both a 
Python-based configuration file and the command-line parameters.

We should be able to make sure that both the C++-side and the Python-side 
random number generators are seeded with the command-line value.

Original comment by ikarpov on 16 Mar 2011 at 4:26

GoogleCodeExporter commented 9 years ago
r910 should address this issue for the C++ generator, please verify.

Original comment by ikarpov on 16 Mar 2011 at 5:11