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

2 ビュー (過去 30 日間)
轩
2024 年 7 月 2 日
コメント済み: 2024 年 7 月 12 日
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

回答 (1 件)

Krishna
Krishna 2024 年 7 月 8 日
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 件のコメント
轩
2024 年 7 月 12 日
Hello Krishna,
Thank you for your reply, I think I have done the checking, but there is still a problem.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeReinforcement Learning についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by