- 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!