How to set the state with different variables in properties?
이전 댓글 표시
I am writing the custom reinforcement learning environment via template. I want to initialize state within properties. The following is from my current scripts. The scripts are based on the class called rl.env.MATLABEnvironment. The properties of this class can't accept the structure definition.
properties
% Initialize system state [schedule,ppath,completionTime,computeDuring]'
% schedule = [];
% ppath = [];
% completionTime = Inf;
% computeDuring = 0;
State = zeros(4,1)
end
However, I don't know how to definite State. In the above case, State consists of schedule, ppath, completionTime and computerDuring, where schedule and ppath are vectors, while completionTime and computerDuring are numbers. If I just define them as zeros(4,1), it doesn't work.
채택된 답변
추가 답변 (1개)
Luca Ferro
2023년 3월 6일
편집: Luca Ferro
2023년 3월 6일
0 개 추천
use a struct:
state.schedule= [];
state.path=[];
state.completionTime=Inf;
state.computerDuring=0;
this will create a struct with said fields. You can access them by using state.schedule, state.path etc
카테고리
도움말 센터 및 File Exchange에서 Reinforcement Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!