bensons gets mental pain from existing
This commit is contained in:
@@ -126,11 +126,16 @@ public class AgentController : Agent
|
|||||||
if (actions.DiscreteActions[1] == 1)
|
if (actions.DiscreteActions[1] == 1)
|
||||||
hInput = 1f;
|
hInput = 1f;
|
||||||
|
|
||||||
|
// reward for going forward
|
||||||
|
|
||||||
if (vInput == 1f)
|
if (vInput == 1f)
|
||||||
{
|
{
|
||||||
AddReward(0.001f);
|
AddReward(0.001f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// give benson mental pain for existing (punishment for maximizing first checkpoint by standing still)
|
||||||
|
AddReward(-0.002f);
|
||||||
|
|
||||||
float forwardSpeed = Vector3.Dot(transform.forward, rigidBody.velocity);
|
float forwardSpeed = Vector3.Dot(transform.forward, rigidBody.velocity);
|
||||||
|
|
||||||
|
|
||||||
@@ -269,10 +274,19 @@ public class AgentController : Agent
|
|||||||
return distanceToCheckpoint;
|
return distanceToCheckpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// punishment for hitting a wall
|
||||||
|
private void OnCollisionEnter(Collision other) {
|
||||||
|
if (other.gameObject.tag == "Wall")
|
||||||
|
{
|
||||||
|
AddReward(-0.05f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// punishment for staying at a wall
|
||||||
private void OnCollisionStay(Collision other) {
|
private void OnCollisionStay(Collision other) {
|
||||||
if (other.gameObject.tag == "Wall")
|
if (other.gameObject.tag == "Wall")
|
||||||
{
|
{
|
||||||
AddReward(-0.01f);
|
AddReward(-0.005f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user