浏览代码

Merge pull request #4750 from Unity-Technologies/gc-onehot

AddOneHotGoal
/goal-conditioning
GitHub 4 年前
当前提交
a8aabd7d
共有 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)
{
if (goalSensor != null)
{
goalSensor.AddOneHotObservation(goal, range);
}
}
}
public class GoalSensor : VectorSensor

正在加载...
取消
保存