Deterministic Random Sampling

I suggested this a while ago, not sure whether it’s implemented already. Basically, we want the sequence of random samples to be repeatable using a seed. This is important for reproducibility/repeatability of experiments.

This should be possible at least for the built-in NewtonianSimulator. I expect this to be possible in CARLA as well as long as the user-defined agents are deterministic, since CARLA’s traffic manager can be configured using the carla.TrafficManager.set_random_device_seed().

1 Like

Hi Abel, I can’t recall our previous discussion offhand, but is the --seed option not working for you? It is supposed to make Scenic’s own sampling deterministic. Of course, as you point out, if the simulator is nondeterministic there’s not much we can do in general, but calling that CARLA API sounds like a good idea (feel free to make a feature request).

For the specific use case of replying experiments, Scenic also provides APIs to save and replay simulations; these have the same caveat about simulators as --seed.

That conversation was in January with Edward I believe. Is the seed option also available when using the Python API?

All the --seed option does is call random.seed() and numpy.random.seed() (see the documentation linked to above), so you can just call those yourself.

1 Like

Oh, I see. I guess Edward mentioned it too, I forgot. Thank you!