- 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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Pratyush
le 21 Août 2024
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.
Voir également
Catégories
En savoir plus sur SimEvents dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!