@@ -445,7 +445,7 @@ public void LazyInitialize()
445
445
enum DoneReason
446
446
{
447
447
/// <summary>
448
- /// The <see cref="EndEpisode"/> method was called .
448
+ /// The episode was ended manually by calling <see cref="EndEpisode"/>.
449
449
/// </summary>
450
450
DoneCalled ,
451
451
@@ -691,10 +691,41 @@ void UpdateRewardStats()
691
691
/// <summary>
692
692
/// Sets the done flag to true and resets the agent.
693
693
/// </summary>
694
+ /// <remarks>
695
+ /// This should be used when the episode can no longer continue, such as when the Agent
696
+ /// reaches the goal or fails at the task.
697
+ /// </remarks>
694
698
/// <seealso cref="OnEpisodeBegin"/>
699
+ /// <seealso cref="EpisodeInterrupted"/>
695
700
public void EndEpisode ( )
696
701
{
697
- NotifyAgentDone ( DoneReason . DoneCalled ) ;
702
+ EndEpisodeAndReset ( DoneReason . DoneCalled ) ;
703
+ }
704
+
705
+ /// <summary>
706
+ /// Indicate that the episode is over but not due to the "fault" of the Agent.
707
+ /// This has the same end result as calling <see cref="EndEpisode"/>, but has a
708
+ /// slightly different effect on training.
709
+ /// </summary>
710
+ /// <remarks>
711
+ /// This should be used when the episode could continue, but has gone on for
712
+ /// a sufficient number of steps.
713
+ /// </remarks>
714
+ /// <seealso cref="OnEpisodeBegin"/>
715
+ /// <seealso cref="EndEpisode"/>
716
+ public void EpisodeInterrupted ( )
717
+ {
718
+ EndEpisodeAndReset ( DoneReason . MaxStepReached ) ;
719
+ }
720
+
721
+
722
+ /// <summary>
723
+ /// Internal method to end the episode and reset the Agent.
724
+ /// </summary>
725
+ /// <param name="reason"></param>
726
+ void EndEpisodeAndReset ( DoneReason reason )
727
+ {
728
+ NotifyAgentDone ( reason ) ;
698
729
_AgentReset ( ) ;
699
730
}
700
731
0 commit comments