Method SetReward
SetReward(float)
Overrides the current step reward of the agent and updates the episode reward accordingly.
Declaration
public void SetReward(float reward)
Parameters
| Type | Name | Description |
|---|---|---|
| float | reward | The new value of the reward. |
Remarks
This function replaces any rewards given to the agent during the current step. Use AddReward(float) to incrementally change the reward rather than overriding it.
Typically, you assign rewards in the Agent subclass's OnActionReceived(ActionBuffers) implementation after carrying out the received action and evaluating its success.
Rewards are used during reinforcement learning; they are ignored during inference.
See Agents - Rewards for general advice on implementing rewards and Reward Signals for information about mixing reward signals from curiosity and Generative Adversarial Imitation Learning (GAIL) with rewards supplied through this method.