- Use "rng('shuffle')" before running your simulation to set a non-fixed seed based on the current time.
- Ensure SimEvents blocks use a non-fixed seed for random number generation.
- Ensure any randomness in the RL agent also uses a non-fixed seed.
- Check that no part of your code unintentionally resets the RNG.
- Use logging to monitor RNG states throughout the simulation.
- Ensure each parallel worker has a unique RNG seed.
How to generate random numbers in RL simulation
7 次查看(过去 30 天)
显示 更早的评论
Dear Matlab Experts, I am currently modelling a reinforcement learning agent integrated into a simevents system. My model is able to run, however there is supposed to be a random number generator in the entity server block "mission". If I unplug the RL agent and run the simevents model only, the random numbers are generated randomly as intended, however if I run the complete model with the RL agent, the results always gives the same values and not random at all. I understand stand that matlab rng is deterministic and depends on a predefined seed, how do you think should I proceed to gain actual random numbers for my model? Thank you in advance. Attached is my model.
0 个评论
回答(1 个)
Pratyush
2024-8-21
Hi Aaron,
To ensure randomness in a SimEvents model integrated with a reinforcement learning (RL) agent in MATLAB, follow these steps:
These steps help maintain randomness across simulations.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!