How to send values to workspace during reinforcement agent validation for further plot and analysis. Using "RUN" button on Simulink produces some difference from Validation.

1 回表示 (過去 30 日間)
I want to export specific values to workspace during the Agent validation to plot. I donot want to use the Simulink "RUN" button.
Reason: When I use the validate approach, the final value of a parameter is usually slightly different when I run the simulink using the "RUN" button. The different is significant to my analysis. Using the "ToWorkspace" does not ouput anything when I execute the validation script below. "ToWorkspace" only works when I use "RUN" on simulink. I want to get values to workspace during validation.
simOpts = rlSimulationOptions(MaxSteps=ceil(Tf/Ts),StopOnError="on");
experiences = sim(env,agent,simOpts);

採用された回答

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2023 年 2 月 7 日
編集済み: Emmanouil Tzorakoleftherakis 2023 年 2 月 7 日
Hello,
First, to answer your point about the simulation differences between using the "Play" button vs using the "sim" command from Reinforcement Learning Toolbox:
1) The "sim" command will first run the 'reset' function that you have specified. Using the 'Play' button will not. That means that if you have any randomization in your reset function, for example changing the initial condition of your model, then seeing different results is expected.
2) Not sure which agent you are using, but some agents are stochastic. So even if you run the same simulation multiple times, unless you fix the random seed you will see different results.
For your second question on logging data to workspace when using the sim command: I just tested it myself and was able to get the data on my workspace. The main difference is that when you use the 'sim' command, the variables from 'ToWorkspace' block will be saved inside the experiences struct (output of sim), not directly in your workspace. If that's not the case, I would check whether the model simulates without error.
Hope this helps
  2 件のコメント
Bay Jay
Bay Jay 2023 年 2 月 13 日
I am using DDPG. I extracted the data from the experience struct for a single/fixed initial condition without randomization and compared with the "Play" option. I observed that the results are same.
Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2023 年 2 月 13 日
編集済み: Emmanouil Tzorakoleftherakis 2023 年 2 月 13 日
Which makes sense since DDPG is deterministic. Please accept the answer if the issue has been resolved

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by