cage-challenge-4 icon indicating copy to clipboard operation
cage-challenge-4 copied to clipboard

Questionable random number generator management

Open benjaminy opened this issue 8 months ago • 0 comments

A few things about the management of RNGs seem wrong to me.

I would have assumed that CybORG.set_seed() could be used to re-seed the simulation. But references to the RNG (np_random) get copied into lots of objects. So when set_seed is called, some objects retain references to the 'older' RNG, and now the simulation uses a weird mishmash of multiple RNGs.

This can be fixed by re-seeding the RNG in place, instead of replacing it.

There are a couple of places where seeding is invoked to create RNGs. The one that seems especially suspicious to me is in the BaseAgent constructor. The constructor is not provided with a RNG object, it allocates one. But the code provides no access to re-seed those RNGs.

benjaminy avatar Jun 06 '24 16:06 benjaminy