Search code examples
c#unity-game-enginemachine-learningartificial-intelligence

"AddReward" not adding reward: Unity mlagents


I'm working with "mlagents" with unity at the moment, but I ran into a problem.

Problem: When I call the function "AddReward", the Cumulative Reward does not go higher then the value i put in the "()"

for example:

AddReward(0.1f); //--- I add a reward
Debug.Log(GetCumulativeReward()); //--- Print Cumulative Reward

When i call this function it just jumps to 0.1 and stays there, even if I call it again, and the same if i put "-0.1" in (it jumps to -0.1 and stays there)

What i have treid:

  1. Made sure I called "AddReward" and not "SetReward"
  2. Used "SetReward" and just put "GetCumulativeReward() + 1" in the "()"

Both did not work

any fixes?

Update: GetCumulativeReward() Retruns the reward for that episode, not al the episodes, so there was not probelm


Solution

  • Update: GetCumulativeReward() Retruns the reward for that episode, not al the episodes, so there was not probelm