Terminate RL DDPG episode if ode solver do not have a solution
1 view (last 30 days)
Show older comments
Muhammad Nadeem
on 17 Oct 2023
Commented: Muhammad Nadeem
on 29 Oct 2023
Hello Everyone,
I am building an LQR type controller using RL DDPG in MATLAB. I had question.
I am steping the eviroment using ode15s solver (my evriormen is system of DAEs which I am solving using ode15s). I want to terminate the episode if for any action in the begining the ode15s is not able to solve the enviroment. How can I do it. Any help will highly be apprciated.
Thanks,
0 Comments
Accepted Answer
Shivam Lahoti
on 27 Oct 2023
Hi Muhammad Nadeem,
As per my understanding, you are stepping your environment (system of DAEs) using the ode15s solver and wish to terminate the environment if ode15s is unable to solve the environment.
The simplest solution could be to use a timestamp and a threshold time that you want the solver to run and find an answer in.
At the start of your code:
StartTime=clock;
At the end of each loop/the point you might want to exit
TimeElapsed=clock-StartTime;
if TimeElapsed(end)>10 %Set it to a value that you want (I chose 10 seconds)
return
end
If the above approach doesn’t work well then refer to the answer below.
I hope this helps.
Regards,
Shivam Lahoti.
More Answers (0)
See Also
Categories
Find more on Special Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!