Terminate RL DDPG episode if ode solver do not have a solution

조회 수: 1 (최근 30일)
Muhammad Nadeem
Muhammad Nadeem 2023년 10월 17일
댓글: Muhammad Nadeem 2023년 10월 29일
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,

채택된 답변

Shivam Lahoti
Shivam Lahoti 2023년 10월 27일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Special Functions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by