docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    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.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023