Class SimpleMultiAgentGroup
A basic class implementation of MultiAgentGroup.
Inherited Members
Namespace: Unity.MLAgents
Syntax
public class SimpleMultiAgentGroup : IMultiAgentGroup, IDisposable
Methods
AddGroupReward(Single)
Increments the group rewards for all agents in this MultiAgentGroup.
Declaration
public void AddGroupReward(float reward)
Parameters
Type | Name | Description |
---|---|---|
Single | reward | Incremental group reward value. |
Remarks
This function increases or decreases the group rewards by a given amount for all agents in the group. Use SetGroupReward(Single) to set the group reward assigned to the current step with a specific value rather than increasing or decreasing it.
A positive group reward indicates the whole group's accomplishments or desired behaviors. Every agent in the group will receive the same group reward no matter whether the agent's act directly leads to the reward. Group rewards are meant to reinforce agents to act in the group's best interest instead of individual ones. Group rewards are treated differently than individual agent rewards during training, so calling AddGroupReward() is not equivalent to calling agent.AddReward() on each agent in the group.
Dispose()
Disposes of the SimpleMultiAgentGroup.
Declaration
public virtual void Dispose()
Implements
EndGroupEpisode()
End episodes for all agents in this MultiAgentGroup.
Declaration
public void EndGroupEpisode()
Remarks
This should be used when the episode can no longer continue, such as when the group reaches the goal or fails at the task.
GetId()
Get the ID of MultiAgentGroup.
Declaration
public int GetId()
Returns
Type | Description |
---|---|
Int32 | MultiAgentGroup ID. |
Implements
GetRegisteredAgents()
Get list of all agents currently registered to this MultiAgentGroup.
Declaration
public IReadOnlyCollection<Agent> GetRegisteredAgents()
Returns
Type | Description |
---|---|
IReadOnlyCollection<Agent> | List of agents registered to the MultiAgentGroup. |
GroupEpisodeInterrupted()
Indicate that the episode is over but not due to the "fault" of the group. This has the same end result as calling EndGroupEpisode(), but has a slightly different effect on training.
Declaration
public void GroupEpisodeInterrupted()
Remarks
This should be used when the episode could continue, but has gone on for a sufficient number of steps, such as if the environment hits some maximum number of steps.
RegisterAgent(Agent)
Register agent to the MultiAgentGroup.
Declaration
public virtual void RegisterAgent(Agent agent)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | The Agent to register. |
Implements
SetGroupReward(Single)
Set the group rewards for all agents in this MultiAgentGroup.
Declaration
public void SetGroupReward(float reward)
Parameters
Type | Name | Description |
---|---|---|
Single | reward | The new value of the group reward. |
Remarks
This function replaces any group rewards given during the current step for all agents in the group. Use AddGroupReward(Single) to incrementally change the group reward rather than overriding it.
A positive group reward indicates the whole group's accomplishments or desired behaviors. Every agent in the group will receive the same group reward no matter whether the agent's act directly leads to the reward. Group rewards are meant to reinforce agents to act in the group's best interest instead of indivisual ones. Group rewards are treated differently than individual agent rewards during training, so calling SetGroupReward() is not equivalent to calling agent.SetReward() on each agent in the group.
UnregisterAgent(Agent)
Unregister agent from the MultiAgentGroup.
Declaration
public virtual void UnregisterAgent(Agent agent)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | The Agent to unregister. |