AbstractPolicy.m debug warning

Hi there,
Could someone please explain what the following debug warning in AbstractPolicy.m means?
% DEBUG: limit to scalar policies only. To step multiple
% policies caller may use loops.
assert(isscalar(this));

Answers (2)

Yongjian Feng
Yongjian Feng on 2 Jul 2021
Hello kloner,
Basically it means that 'this' can not be an array. It must be a scaler. As explained in the comment, if you have an array, then just loop through the array and call the function for each element in the array.
Thanks,
Yongjian

2 Comments

kloner
kloner on 2 Jul 2021
Edited: kloner on 2 Jul 2021
Dear Yongjian,
This explanation does not make a lot of sense to me as "this" refers to an rlQAgent (in the step method). I only have one agent, so how could I be failing on this error?
Thanks very much for the help.
What is an riQAgent?
You can also do these to narrow it down:
  1. If you run this from the debugger, set a break point there, and type isscalar(this) in the command line window.
  2. type class(this) to make sure it is indeed riQAgent.
  3. type which isscalar to check if it is the built-in isscalar being called.

Sign in to comment.

kloner
kloner on 4 Jul 2021
Dear Yongjian,
An rlQAgent is a MATLAB-provided Reinforcement Learning agent, as described here: https://www.mathworks.com/help/reinforcement-learning/ref/rlqagent.html.
Apologies for any confusion: I thought that the context would be clear based on the information I originally submitted. I hope that this clarification provides sufficient information to explain the Debug message as originally alluded to. Thanks.

3 Comments

I see. Now which function/method of rlQAgent did you call when you got into this debug error?
I tried getAction, and it is working there at least. Reproduction steps are needed to narrow down the problem.
Thanks,
Yongjian
kloner
kloner on 6 Jul 2021
Edited: kloner on 7 Jul 2021
Dear Yongjian,
I specifically hoping that someone could explain what a debug message found within AbstractPolicy.m, which is a file created by the MATLAB core team, meant. The warning does not appear when I call the file but is located specifically within the file itself.
No attachments here. Can you double check please?

Sign in to comment.

Products

Release

R2021a

Asked:

on 2 Jul 2021

Edited:

on 7 Jul 2021

Community Treasure Hunt

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

Start Hunting!