浏览代码
Team manager prototype (#4850)
Team manager prototype (#4850)
* remove group id * very rough sketch for TeamManager interface * add team manager id to proto * team manager for hallway * add manager to hallway * send and process team manager id * remove print * small cleanup Co-authored-by: Chris Elion <chris.elion@unity3d.com>/develop/centralizedcritic
GitHub
4 年前
当前提交
70220f95
共有 21 个文件被更改,包括 253 次插入 和 35 次删除
-
11Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayCollabAgent.cs
-
1Project/Assets/ML-Agents/Examples/Hallway/TFModels/HallwayCollab.onnx.meta
-
2com.unity.ml-agents/Editor/BehaviorParametersEditor.cs
-
42com.unity.ml-agents/Runtime/Agent.cs
-
5com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs
-
39com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/AgentInfo.cs
-
8com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
-
18ml-agents-envs/mlagents_envs/base_env.py
-
11ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.py
-
7ml-agents-envs/mlagents_envs/communicator_objects/agent_info_pb2.pyi
-
29ml-agents-envs/mlagents_envs/rpc_utils.py
-
20ml-agents/mlagents/trainers/agent_processor.py
-
1protobuf-definitions/proto/mlagents_envs/communicator_objects/agent_info.proto
-
25Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs
-
11Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayTeamManager.cs.meta
-
3com.unity.ml-agents.extensions/Runtime/Teams.meta
-
14com.unity.ml-agents/Runtime/ITeamManager.cs
-
3com.unity.ml-agents/Runtime/ITeamManager.cs.meta
-
35com.unity.ml-agents.extensions/Runtime/Teams/BaseTeamManager.cs
-
3com.unity.ml-agents.extensions/Runtime/Teams/BaseTeamManager.cs.meta
|
|||
using System.Collections.Generic; |
|||
using Unity.MLAgents; |
|||
using Unity.MLAgents.Extensions.Teams; |
|||
using Unity.MLAgents.Sensors; |
|||
|
|||
public class HallwayTeamManager : BaseTeamManager |
|||
{ |
|||
List<Agent> m_AgentList = new List<Agent> { }; |
|||
|
|||
|
|||
public override void RegisterAgent(Agent agent) |
|||
{ |
|||
m_AgentList.Add(agent); |
|||
} |
|||
|
|||
public override void OnAgentDone(Agent agent, Agent.DoneReason doneReason, List<ISensor> sensors) |
|||
{ |
|||
agent.SendDoneToTrainer(); |
|||
} |
|||
|
|||
public override void AddTeamReward(float reward) |
|||
{ |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8b67166b7adef46febf8b570f92c400d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 77124df6c18c4f669052016b3116147e |
|||
timeCreated: 1610064454 |
|
|||
using System.Collections.Generic; |
|||
using Unity.MLAgents.Sensors; |
|||
|
|||
namespace Unity.MLAgents |
|||
{ |
|||
public interface ITeamManager |
|||
{ |
|||
string GetId(); |
|||
|
|||
void RegisterAgent(Agent agent); |
|||
// TODO not sure this is all the info we need, maybe pass a class/struct instead.
|
|||
void OnAgentDone(Agent agent, Agent.DoneReason doneReason, List<ISensor> sensors); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 75810d91665e4477977eb78c9b15aeb3 |
|||
timeCreated: 1610057818 |
|
|||
using System.Collections.Generic; |
|||
using Unity.MLAgents; |
|||
using Unity.MLAgents.Sensors; |
|||
|
|||
namespace Unity.MLAgents.Extensions.Teams |
|||
{ |
|||
public class BaseTeamManager : ITeamManager |
|||
{ |
|||
readonly string m_Id = System.Guid.NewGuid().ToString(); |
|||
|
|||
public virtual void RegisterAgent(Agent agent) |
|||
{ |
|||
throw new System.NotImplementedException(); |
|||
} |
|||
|
|||
public virtual void OnAgentDone(Agent agent, Agent.DoneReason doneReason, List<ISensor> sensors) |
|||
{ |
|||
// Possible implementation - save reference to Agent's IPolicy so that we can repeatedly
|
|||
// call IPolicy.RequestDecision on behalf of the Agent after it's dead
|
|||
// If so, we'll need dummy sensor impls with the same shape as the originals.
|
|||
throw new System.NotImplementedException(); |
|||
} |
|||
|
|||
public virtual void AddTeamReward(float reward) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public string GetId() |
|||
{ |
|||
return m_Id; |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b2967f9c3bd4449a98ad309085094769 |
|||
timeCreated: 1610064493 |
撰写
预览
正在加载...
取消
保存
Reference in new issue