What is the difference between sim (RL toolbox) and directly click "run" in the Simulink Model

2 vues (au cours des 30 derniers jours)
轩
le 2 Juil 2024
Commenté : le 12 Juil 2024
sim - Simulate trained reinforcement learning agents within specified environment
After training my RL agent I use TestSim = sim(agent,env) to test my trained agent.
However, I find that the agent performence is different and much worse if I directly click run bottom is the Simulink model pannel rather than using sim command.
I have checked that in my Simulink model the RL agent block has correctly quoted my trained agent in the MATLAB workspace

Réponses (1)

Krishna
Krishna le 8 Juil 2024
Hey,
I understand that you are facing worse performance when running directly from simulink. Can you please check the following things,
  1. Ensure initial conditions are identical for both methods. Running the simulation directly from the panel might use default initial conditions different from those set in the 'sim' command
  2. Verify consistency in simulation parameters (start/stop times, solver settings, step sizes) between both methods
  3. Set the random seed to the same value for both simulations to ensure consistency in the agent's performance
  4. Check for any callbacks or scripts that might run when starting the simulation from the Simulink panel, as they can alter the simulation behavior.
Also ensure the Simulink model references the correct and current version of the trained agent from the MATLAB workspace.
Please go through the following documentation to learn more about 'sim' command and its default values to be used while simulation,
Also please share the simulation model for further investigation if possible.
Hope this helps.
  1 commentaire
轩
le 12 Juil 2024
Hello Krishna,
Thank you for your reply, I think I have done the checking, but there is still a problem.

Connectez-vous pour commenter.

Produits


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by