"experienc​es=allExpe​riences (saved.age​nt.Experie​nceBuffer)​"

21 ビュー (過去 30 日間)
铖
2025 年 11 月 24 日 15:20
回答済み: Anumeha 2025 年 12 月 15 日 10:08
Excuse me, when I am using the code "experiences=allExperiences (saved.agent.ExperienceBuffer)", I expect to get all experiences, but the system output is "experiences=empty 1x0 struct array without fields". May I ask why this situation has occurred.

採用された回答

Anumeha
Anumeha 2025 年 12 月 15 日 10:08
Hi ,
I understand “allExperiences” is giving empty output, which would mean that the input it receives is empty somehow. Since the code and data isn’t provided, I was able to achieve a possible workflow using this documentation page.
The code I used is given below:
obsContinuous = rlNumericSpec([2 1],...
LowerLimit=0,...
UpperLimit=[1;5]);
obsDiscrete = rlFiniteSetSpec([1 2 3]);
obsInfo = [obsContinuous obsDiscrete];
actInfo = rlNumericSpec([2 1],...
LowerLimit=0,...
UpperLimit=[5;10]);
for i = 1:10
experience(i).Observation = ...
{obsInfo(1).UpperLimit.*rand(2,1) randi(3)};
experience(i).Action = {actInfo.UpperLimit.*rand(2,1)};
experience(i).NextObservation = ...
{obsInfo(1).UpperLimit.*rand(2,1) randi(3)};
experience(i).Reward = 10*rand(1);
experience(i).IsDone = 0;
end
save('filename.mat', 'experience');
Now this is saved. So I cleared the experience variable, and reloaded it from the saved file.
load("filename.mat")
buffer = rlReplayMemory(obsInfo,actInfo,5000);
append(buffer,experience);
experiences = allExperiences(buffer)
This gives me the 10 experiences I saved.
Hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by