Why I get the warning "Referencing of the same agent object by multiple RL Agent blocks " when doing RL training ?

7 views (last 30 days)
I got the warning "Referencing of the same agent object by multiple RL Agent blocks" when when doing RL training refer to"Train Multiple Agents to Perform Collaborative Task". I got this warning when using “rlSimulinkEnv” to create a multi-agent environment and my Simulink files actually did not contain same agent objects (The two agents are named differently). Does anyone know what mistake I might have made?
Here is the environment creating part of the training code:
mdl = 'xxx';
blks = ["xxx/.../RL Agent 4","xxx/.../RL Agent 16"];
open_system(mdl)
obsInfo = rlNumericSpec([6 1],...
'LowerLimit',[-inf 0 -10 -inf -inf -inf]',...
'UpperLimit',[ inf inf 10 inf inf inf]');
numObservations = obsInfo.Dimension(1);
actInfo = rlNumericSpec([1 1],...
'LowerLimit',0,...
'UpperLimit',5);
numActions = actInfo.Dimension(1);
obsInfos = {obsInfo,obsInfo};
actInfos = {actInfo,actInfo};
env = rlSimulinkEnv(mdl,blks,obsInfos,actInfos);
env.ResetFcn = @(in)localResetFcn(in);
  2 Comments
Lin
Lin on 12 Jan 2024
Hello,I have the same question,have you solved the problem?If it did, can you tell me how it worked out?
Thank you.
katuysha
katuysha on 17 Apr 2024 at 1:48
Hello Lin,
I'm glad to tell you that I have solved this warning problem later in my simulink model.
If you still haven't solved it, here is the solution:
  1. Open your ***.slx model, find your RL Agent blocks and double-click to open one.
  2. You will see the name of your agent in "Agent - Agent object". Set it to the same name as the agent in the training program.
  3. Perform the same operations for other RL Agent blocks.
  4. If the Agent object values of the agents are different, there is no such warning generated.

Sign in to comment.

Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!