浏览代码

Code improvements

/goal-conditioning/sensors-3-pytest-fix
vincentpierre 3 年前
当前提交
42a3732c
共有 8 个文件被更改,包括 19 次插入67 次删除
  1. 7
      Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
  2. 60
      Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
  3. 17
      Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridArea.cs
  4. 2
      config/ppo/GridWorld.yaml
  5. 0
      /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-red.prefab
  6. 0
      /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-red.prefab.meta
  7. 0
      /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-green.prefab
  8. 0
      /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-green.prefab.meta

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


actorObjs: []
players:
trueAgent: {fileID: 1488387672112076}
goalPref: {fileID: 1508142483324970, guid: 1ec4e4e96e7514d45b7ebc3ba5a9a481, type: 3}
pitPref: {fileID: 1811317785436014, guid: d13ee2db77b3a4dcc8664d2fe2a0f219, type: 3}
numberOfObstacles: 1
GreenPref: {fileID: 1508142483324970, guid: 1ec4e4e96e7514d45b7ebc3ba5a9a481, type: 3}
RedPref: {fileID: 1811317785436014, guid: d13ee2db77b3a4dcc8664d2fe2a0f219, type: 3}
numberOfGreen: 1
numberOfRed: 1
--- !u!1 &1656910849934022
GameObject:
m_ObjectHideFlags: 0

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


far clip plane: 1000
field of view: 58
orthographic: 1
orthographic size: 2.75
orthographic size: 5.46
m_Depth: 1
m_CullingMask:
serializedVersion: 2

propertyPath: m_Name
value: Area (6)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: -1

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1488387672112076, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: FloatAgent
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 0

- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 114650561397225712, guid: 5c2bd19e4bbda4991b74387ca5d28156,
type: 3}
propertyPath: m_UseHeuristic
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114889700908650620, guid: 5c2bd19e4bbda4991b74387ca5d28156,
type: 3}
propertyPath: compression
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114889700908650620, guid: 5c2bd19e4bbda4991b74387ca5d28156,
type: 3}
propertyPath: m_Compression
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

propertyPath: m_Name
value: Area (2)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: -1

- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: Area (5)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_Name
value: Area (4)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: -1

- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: Area (3)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_Name
value: Area (1)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 1

actorObjs: []
players:
trueAgent: {fileID: 125487785}
goalPref: {fileID: 1508142483324970, guid: 1ec4e4e96e7514d45b7ebc3ba5a9a481, type: 3}
pitPref: {fileID: 1811317785436014, guid: d13ee2db77b3a4dcc8664d2fe2a0f219, type: 3}
numberOfObstacles: 1
GreenPref: {fileID: 1508142483324970, guid: 1ec4e4e96e7514d45b7ebc3ba5a9a481, type: 3}
RedPref: {fileID: 1811317785436014, guid: d13ee2db77b3a4dcc8664d2fe2a0f219, type: 3}
numberOfGreen: 1
numberOfRed: 1
--- !u!4 &1795599558
Transform:
m_ObjectHideFlags: 0

- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: Area (7)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x

17
Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridArea.cs


Camera m_AgentCam;
public GameObject goalPref;
public GameObject pitPref;
public GameObject GreenPref;
public GameObject RedPref;
public int numberOfObstacles = 1;
public int numberOfGreen = 1;
public int numberOfRed = 1;
GameObject m_Plane;
GameObject m_Sn;

{
m_ResetParams = Academy.Instance.EnvironmentParameters;
m_Objects = new[] { goalPref, pitPref };
m_Objects = new[] { GreenPref, RedPref };
m_AgentCam = transform.Find("agentCam").GetComponent<Camera>();

transform.position = m_InitialPosition * (m_ResetParams.GetWithDefault("gridSize", 5f) + 1);
var playersList = new List<int>();
for (var i = 0; i < (int)m_ResetParams.GetWithDefault("numObstacles", numberOfObstacles); i++)
for (var i = 0; i < (int)m_ResetParams.GetWithDefault("numGreenGoals", numberOfGreen); i++)
playersList.Add(1);
playersList.Add(0);
for (var i = 0; i < (int)m_ResetParams.GetWithDefault("numGoals", 1f); i++)
for (var i = 0; i < (int)m_ResetParams.GetWithDefault("numRedGoals", numberOfRed); i++)
playersList.Add(0);
playersList.Add(1);
}
players = playersList.ToArray();

2
config/ppo/GridWorld.yaml


learning_rate_schedule: linear
network_settings:
normalize: false
hidden_units: 256
hidden_units: 100
num_layers: 1
vis_encode_type: simple
reward_signals:

/Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-ex.prefab → /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-red.prefab

/Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-ex.prefab.meta → /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-red.prefab.meta

/Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-plus.prefab → /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-green.prefab

/Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-plus.prefab.meta → /Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/goal-green.prefab.meta

正在加载...
取消
保存