I get error when I want to define an environment for DQN, that is related to RL observation.
3 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I want to generate a DQN actor, but when I want to create an environment, it gives an error, I will be appreciated if anyone can help me with this problem. I have 11 inputs and 3 actions for outputs.
mdl = "challenge";
%% Observation and actions
obsInfo = rlNumericSpec([11 1],'LowerLimit',-inf*ones(11,1),'UpperLimit',inf*ones(11,1));
actInfo = rlFiniteSetSpec({[0 ; 1], [0; 1],[0 ;1]});
obsInfo.Name = "Observation";
actInfo.Name = "Actions";
%% Environment
agentBlk = [mdl '/rlAgent'];
env = rlSimulinkEnv(mdl,agentBlk,obsInfo,actInfo);
it gives me the following error:
Error using rlSimulinkEnv>localValidateIOSpecs (line 172)
Invalid size or type for observation specification.
Error in rlSimulinkEnv (line 90)
localValidateIOSpecs(numAgents,observationInfo,actionInfo);
0 个评论
回答(1 个)
Ayush Aniket
2023-10-22
Hi Armin,
As per my understanding you are getting the error because of the incorrect definition of "Agent Block Paths". For a single RL Agent block, the input to "agentBlocks" argument needs to be a string or character vector containing the block path. However, by your definition it is a string array specifying multiple agents and hence the discrepancy in the observation information. You can correct it as:
%% Environment
agentBlk = mdl + '/rlAgent';
You can read more about the input arguments of "rlSimulinkEnv" function by referring to the following link:
Hope it helps.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!