BaseClippingTrajectoryProcessor

class maze.core.trajectory_recording.datasets.trajectory_processor.BaseClippingTrajectoryProcessor(clip_k: int)

A base class for different clipping trajectory preprocessors.

pre_process(trajectory: TrajectoryRecord) TrajectoryRecord | List[TrajectoryRecord]

Clip a trajectory for self.clip_k steps if the clipping condition returns true.

Parameters:

trajectory – The trajectory to preprocess.

Returns:

The pre-processed trajectory or a list of multiple pre-processed trajectories.

abstract test_for_trajectory_clipping(done_terminated: bool, done_truncated: bool, info: Dict[str, str]) bool

Abstract method for checking whether the current trajectory should be clipped or not.

Parameters:
  • done_terminated – Whether the current trajectory ended in done by termination.

  • done_truncated – Whether the current trajectory ended in done by truncation.

  • info – The info of the last environment step.

Returns:

Return True if teh trajectory should be clipped, false otherwise.