pyrevs.strategies.base.termination

Defines the interface and simple implementations of termination criteria.

Attributes

Classes

TerminationCriterion

Termination criterion interface.

TimeTerminationCriterion

Termination criterion based on time.

TimeInterruptionCriterion

Interruption criterion based on time.

LowScoreTerminationCriterion

Termination criterion based on score.

ModelTerminationCriterion

Termination criterion based on model.

TargetScoreConvergenceCriterion

Convergence criterion based on a target score.

Module Contents

T_Noise[source]
T_State[source]
class TerminationCriterion[source]

Bases: Protocol

Termination criterion interface.

abstractmethod should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory should terminate.

Parameters:
  • model – the forward model

  • trajectory – the trajectory

Returns:

One of the TrajectoryStateType

class TimeTerminationCriterion(end_time: float)[source]

Bases: TerminationCriterion

Termination criterion based on time.

Will trigger termination if the current time is greater than or equal to the end time.

should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory should terminate.

class TimeInterruptionCriterion(end_time: float)[source]

Bases: TerminationCriterion

Interruption criterion based on time.

Will trigger interruption if the current time is greater than or equal to the end time.

should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory should terminate.

class LowScoreTerminationCriterion(score_threshold: float)[source]

Bases: TerminationCriterion

Termination criterion based on score.

Will trigger termination if the current score is less than or equal to a threshold.

should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory should terminate.

class ModelTerminationCriterion[source]

Bases: TerminationCriterion

Termination criterion based on model.

Will trigger termination if the forward model has decides to.

should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory should terminate.

class TargetScoreConvergenceCriterion(target_score: float)[source]

Bases: TerminationCriterion

Convergence criterion based on a target score.

Will trigger convergence if the forward model decides that the current score reached the target score (by default, if the score is greater than or equal to the target score).

should_terminate(model: pyrevs.core.ForwardModelBaseClass[T_Noise, T_State], trajectory: pyrevs.trajectory.Trajectory) → pyrevs.trajectory.TrajectoryStateType[source]

Check if the trajectory has converged.