浏览代码

Add OneHot util to goal sensor

/goal-conditioning
Arthur Juliani 4 年前
当前提交
e6a973cd
共有 4 个文件被更改,包括 11 次插入3 次删除
  1. 2
      Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
  2. 2
      Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
  3. 2
      Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
  4. 8
      Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GoalSensorComponent.cs

2
Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab


m_Script: {fileID: 11500000, guid: 163dac4bcbb2f4d8499db2cdcb22a89e, type: 3}
m_Name:
m_EditorClassIdentifier:
observationSize: 1
observationSize: 2
--- !u!1 &1625008366184734
GameObject:
m_ObjectHideFlags: 0

2
Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity


m_Script: {fileID: 11500000, guid: 163dac4bcbb2f4d8499db2cdcb22a89e, type: 3}
m_Name:
m_EditorClassIdentifier:
observationSize: 1
observationSize: 2
--- !u!1 &260425459
GameObject:
m_ObjectHideFlags: 0

2
Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs


Array values = Enum.GetValues(typeof(GridGoal));
int goalNum = (int)gridGoal;
goalSensor = this.GetComponent<GoalSensorComponent>();
goalSensor.AddGoal(goalNum);
goalSensor.AddOneHotGoal(goalNum, values.Length);
}
public override void WriteDiscreteActionMask(IDiscreteActionMask actionMask)

8
Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GoalSensorComponent.cs


goalSensor.AddObservation(goal);
}
}
public void AddOneHotGoal(int goal, int range)
{
for (var i = 0; i < range; i++)
{
goalSensor.AddObservation(i == goal ? 1.0f : 0.0f);
}
}
}
public class GoalSensor : VectorSensor

正在加载...
取消
保存