flatland.evaluators.trajectory_evaluator module

flatland.evaluators.trajectory_evaluator module#

class flatland.evaluators.trajectory_evaluator.TrajectoryEvaluator(trajectory: Trajectory, callbacks: FlatlandCallbacks = None)[source]#

Bases: object

evaluate(start_step: int = None, end_step: int = None, snapshot_interval=0, tqdm_kwargs: dict = None, skip_rewards_dones_infos: bool = False, skip_rewards: bool = False, ignoring_action_required: bool = True, rewards: Rewards = None, obs_builder: ObservationBuilder[Any, RailEnv] | None = None, effects_generator: EffectsGenerator[RailEnv] | None = None, shifted_malfunction: bool = False, shifted_off_map_speed: bool = False, skip_state_machine_update: bool | None = None) → RailEnv[source]#

Parameters

end_stepint

stop evaluation at intermediate step excl. If not provided, defaults to env’s max_episode_steps.

snapshot_intervalint

interval to write pkl snapshots to outputs/serialised_state subdirectory (not serialised_state subdirectory directly). 1 means at every step. 0 means never.

tqdm_kwargs: dict

additional kwargs for tqdm

skip_rewards_dones_infosbool

skip verification of rewards/dones/infos

rewardsRewards

Rewards used for evaluation, forwarded to Trajectory.load_env. If not provided, defaults to the restored env’s default rewards.

obs_builderObservationBuilder

obs builder for the restored env, forwarded to Trajectory.load_env. If not provided, defaults to DummyObservationBuilder.

effects_generatorEffectsGenerator

if given, forwarded to Trajectory.load_env and replaces the restored env’s persisted effects generator instead of being discarded.

shifted_malfunctionbool

# TODO remove this option once the malfunction episodes are regenerated recorded episodes predate decrementing the malfunction counter at the start of step() - while an actual malfunction is active, expect the recorded info’s malfunction one lower than freshly computed.

shifted_off_map_speedbool

# TODO remove this option once the malfunction episodes are regenerated recorded episodes predate SpeedCounter speed being None while off map - while an agent is off map (freshly computed info’s speed is None), ignore the recorded info’s speed (pinned at the agent’s max_speed under the old convention).

skip_state_machine_updateOptional[bool]

forwarded to Trajectory.load_env. Defaults to the setting saved with the env (see RailEnvStateMachineWrapper).