Pausing reinforcement learning by forcing

2 visualizaciones (últimos 30 días)
SHromaneko
SHromaneko el 2 de En. de 2024
Editada: SHromaneko el 10 de En. de 2024
I'm running reinforcement learning, but I think there are times when I think it's not going well and want to stop it.
If you stop today's learning agent executed with the code below with Training stopped, simulink will freeze and stop working.
Repeatedly hitting the escape key doesn't work either.
so that you can stop it properly
Is there something wrong with the code?
numObs = 9;
obsInfo = rlNumericSpec([numObs 1]);
obsInfo.Name = "observations";
mdl = "kineticmodel_wIAVFBC_IncS2Ea_NH3FBC";
open_system(mdl)
numAct = 1;
actInfo = rlNumericSpec([numAct 1],LowerLimit=0,UpperLimit=1);
actInfo.Name = "NH3";
blk = mdl + "/RL agent/RL Agent";
env = rlSimulinkEnv(mdl,blk,obsInfo,actInfo);
Ts = 1
agent = createDDPGAgent(numObs,obsInfo,numAct,actInfo,Ts);
maxEpisodes = 2000;
Tf = 1240*3
maxSteps = floor(Tf/Ts);
trainOpts = rlTrainingOptions(...
MaxEpisodes=maxEpisodes,...
MaxStepsPerEpisode=maxSteps,...
ScoreAveragingWindowLength=250,...
Verbose=false,...
Plots="training-progress",...
StopTrainingCriteria="EpisodeCount",...
StopTrainingValue=maxEpisodes,...
SaveAgentCriteria="EpisodeCount",...
SaveAgentValue=maxEpisodes);
doTraining = true;
if doTraining
% Train the agent.
trainingStats = train(agent,env,trainOpts);
else
% Load a pretrained agent for the selected agent type.
if strcmp(AgentSelection,"DDPG")
load("rlWalkingBipedRobotDDPG.mat","agent")
else
load("rlWalkingBipedRobotTD3.mat","agent")
end
end

Respuesta aceptada

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis el 9 de En. de 2024
The proper way to stop it would be through the Episode Manager (top right of the window). Does this not work for you?
  1 comentario
SHromaneko
SHromaneko el 10 de En. de 2024
Editada: SHromaneko el 10 de En. de 2024
It's just a bug, I re-installed and fixed it.
Thanks a lot.

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by