"experiences=allExperiences (saved.agent.ExperienceBuffer)"
조회 수: 21 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Anumeha
2025년 12월 15일 10:08
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!