浏览代码

cumulative final reward soccer

/asymm-envs
Andrew Cohen 4 年前
当前提交
9a25be8c
共有 2 个文件被更改,包括 13 次插入3 次删除
  1. 14
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs
  2. 2
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs

14
Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs


float m_ForwardSpeed;
[HideInInspector]
public float timePenalty = 0;
[HideInInspector]
public Rigidbody agentRb;
SoccerSettings m_SoccerSettings;
BehaviorParameters m_BehaviorParameters;

// Existential bonus for Goalies.
AddReward(1f / 3000f);
}
else if (position == Position.Striker)
{
// Existential penalty for Strikers
AddReward(-1f / 3000f);
}
// Existential penalty for Strikers/Generic.
AddReward(-1f / 3000f);
// Existential penalty cumulant for Generic
timePenalty += -1f / 3000f;
}
MoveAgent(vectorAction);
}

public override void OnEpisodeBegin()
{
timePenalty = 0;
m_BallTouch = SideChannelUtils.GetSideChannel<FloatPropertiesChannel>().GetPropertyWithDefault("ball_touch", 0);
if (team == Team.Purple)
{

2
Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs


{
if (ps.agentScript.team == scoredTeam)
{
ps.agentScript.AddReward(1);
ps.agentScript.AddReward(1 + ps.agentScript.timePenalty);
}
else
{

正在加载...
取消
保存