強化学習をやろうとしています。関数 'getSampleTime' (タイプ'double' の入力引数) が未定義です。の解決法を教えてください。
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
太雅 藤森
le 14 Oct 2021
Modifié(e) : Toshinobu Shintai
le 14 Oct 2021
MATLAB/Simulinkを用いて強化学習をやろうとしています。
Simulinkの診断ビューアーに以下のようなエラーメッセージが出てきたのですが、どのように対処したらよいのでしょうか。
'rl.simulink.blocks.AgentWrapper' の 'getSampleTime' メソッドを呼び出すときに MATLAB System ブロック 'PI_D/agent/AgentWrapper' エラーが発生しました。エラーは '
'C:\Program Files\MATLAB\R2021b\toolbox\rl\rl\simulink\+rl\+simulink\+blocks\AgentWrapper.m' at line 214 'C:\Program Files\MATLAB\R2021b\toolbox\simulink\ui\studio\config\m\+SLStudio\StartPauseContinue.p' at line 0 'C:\Program Files\MATLAB\R2021b\toolbox\simulink\ui\studio\config\m\+SLStudio\ToolBars.p' at line 0' からスローされました。
原因: 関数 'getSampleTime' (タイプ'double' の入力引数) が未定義です。
コンポーネント:Simulink | カテゴリ:Block エラー
またMATLAB の方のコードは以下の通りです。こちらはエラーは出ませんでした。
obsDim = [2 1];
obsInfo = rlNumericSpec(obsDim,"LowerLimit",-1*ones(2,1),"UpperLimit",ones(2,1))
actDim = {[0;0]};
k = 0;
for m = -1 : 0.01 : 1
for n = -1 : 0.01 : 1
k = k+1;
actDim{1,k} = [m;n];
end
end
actInfo = rlFiniteSetSpec(actDim)
obspath = [imageInputLayer([2 1],"Normalization","none","Name","obs");
fullyConnectedLayer(20,"Name","hiddenobs");
reluLayer("Name","reluobs");
fullyConnectedLayer(20,"Name","fcobs")];
actpath = [imageInputLayer([2 1],"Normalization","none","Name","act");
fullyConnectedLayer(20,"Name","hiddenact");
reluLayer("Name","reluact");
fullyConnectedLayer(20,"Name","fcact")];
joinedpath = [additionLayer(2,"Name","add");
reluLayer("Name","relu");
fullyConnectedLayer(1,"Name","fc")];
net = layerGraph(obspath)
net = addLayers(net,actpath);
net = addLayers(net,joinedpath);
plot(net)
net = connectLayers(net,"fcobs","add/in1");
net = connectLayers(net,"fcact","add/in2");
plot(net)
critic = rlQValueRepresentation(net,obsInfo,actInfo,"Observation","obs","Action","act");
agent = rlDQNAgent(critic);
env = rlSimulinkEnv("PI_D","PI_D/agent",obsInfo,actInfo);
よろしくお願いいたします。
0 commentaires
Réponse acceptée
Toshinobu Shintai
le 14 Oct 2021
Modifié(e) : Toshinobu Shintai
le 14 Oct 2021
おそらくですが、DQNのエージェントにサンプル時間が指定されていないのが理由ではないでしょうか。
以下のコード
agent = rlDQNAgent(critic);
を、
agentOptions = rlDQNAgentOptions('SampleTime', 0.01);
agent = rlDQNAgent(critic, agentOptions);
としてみて、エラーは無くなりませんでしょうか。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur インストールとライセンスの紹介 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!