浏览代码

Merge pull request #1282 from bjmolitor/patch-3

Fix bug in observation vector calculation
/develop-generalizationTraining-TrainerController
GitHub 6 年前
当前提交
c635d096
共有 1 个文件被更改,包括 19 次插入24 次删除
  1. 43
      docs/Learning-Environment-Create-New.md

43
docs/Learning-Environment-Create-New.md


position never changes.
```csharp
// Calculate relative position
// Calculate position relative to the target
// Relative position
// Position relative to the target
* Position of the Agent itself within the confines of the floor. This data is
collected as the Agent's distance from each edge of the floor.
* Position of the Agent itself relative to the size of the floor (which is 10)
// Distance to edges of platform
AddVectorObs((this.transform.position.x + 5) / 5);
AddVectorObs((this.transform.position.x - 5) / 5);
AddVectorObs((this.transform.position.z + 5) / 5);
AddVectorObs((this.transform.position.z - 5) / 5);
// Relative position
AddVectorObs(this.transform.position.x / 10);
AddVectorObs(this.transform.position.x / 10);
```
* The velocity of the Agent. This helps the Agent learn to control its speed so

AddVectorObs(rBody.velocity.z / 5);
```
All the values are divided by 5 to normalize the inputs to the neural network to
the range [-1,1]. (The number five is used because the platform is 10 units
across.)
All the values are divided to normalize the inputs to the neural network to
the range [-1,1]. (The platform is a square which reaches from positions -5 to +5
thereby having an edge length of 10 units.)
In total, the state observation contains 8 values and we need to use the
In total, the state observation contains 6 values and we need to use the
// Calculate relative position
Vector3 relativePosition = Target.position - this.transform.position;
// Calculate position relative to the target
Vector3 relativePosition = Target.position - this.transform.position;
// Relative position
AddVectorObs(relativePosition.x/5);
AddVectorObs(relativePosition.z/5);
// Position relative to the target
AddVectorObs(relativePosition.x / 5);
AddVectorObs(relativePosition.z / 5);
// Distance to edges of platform
AddVectorObs((this.transform.position.x + 5)/5);
AddVectorObs((this.transform.position.x - 5)/5);
AddVectorObs((this.transform.position.z + 5)/5);
AddVectorObs((this.transform.position.z - 5)/5);
// Relative position
AddVectorObs(this.transform.position.x / 10);
AddVectorObs(this.transform.position.x / 10);
// Agent velocity
AddVectorObs(rBody.velocity.x/5);

Inspector window. Set the following properties:
* `Vector Observation Space Type` = **Continuous**
* `Vector Observation Space Size` = 8
* `Vector Observation Space Size` = 6
* `Vector Action Space Type` = **Continuous**
* `Vector Action Space Size` = 2
* `Brain Type` = **Player**

正在加载...
取消
保存