Search Unity

Question How can I run methods when the max steps was reached?

Discussion in 'ML-Agents' started by yuval100amir, Jun 13, 2021.

  1. yuval100amir

    yuval100amir

    Joined:
    Dec 31, 2020
    Posts:
    3
    I am very new to ml agents and I just can't figure this out.

    When the episode ends because the max steps was reached I want to give a reward.

    I just need a way to run methods when the max steps was reached. I'll figure out the rest.
     
    Last edited: Jun 13, 2021
  2. ruoping_unity

    ruoping_unity

    Unity Technologies

    Joined:
    Jul 10, 2020
    Posts:
    134
    You can manually end the episode for reaching max step, so that you can do custom rewarding or any other stuff you need.

    You'll need to track the agent step count, and when it reaches the max step, add the reward and do whatever you need to do, and finally call Agent.EpisodeInterrupted().