smarts.core.utils.episodes module

class smarts.core.utils.episodes.Episode(episodes: Episodes)[source]

An episode recording object

continues(observation, reward, terminated, truncated, info) bool[source]

Determine if the current episode can continue.

class smarts.core.utils.episodes.EpisodeLog(index: int = 0, start_time: float = <factory>, fixed_timestep_sec: float = 0, scores: dict = <factory>, steps: int = 0, scenario_map: str = '', scenario_traffic: str = '', mission_hash: str = '')[source]

An episode logging tool.

fixed_timestep_sec: float = 0
index: int = 0
mission_hash: str = ''
record_scenario(scenario_log)[source]

Record a scenario end.

record_step(observations, rewards, terminateds, truncateds, infos)[source]

Record a step end.

scenario_map: str = ''
scenario_traffic: str = ''
scores: dict
property sim2wall_ratio

The ration of sim time to wall time. Above 1 is hyper-real-time.

property sim_time

An estimation of the total fixed-time-step simulation performed.

start_time: float
steps: int = 0
property steps_per_second

The rate of steps performed since instantiation.

property wall_time

Time elapsed since instantiation.

class smarts.core.utils.episodes.EpisodeLogs(col_width, total_episodes: str | int = '?')[source]

An episode logging utility.

static context(col_width)[source]

Generate a formatted table context object.

reset() EpisodeLog[source]

Record an episode reset.

class smarts.core.utils.episodes.Episodes(max_steps: int, current_step: int = 0)[source]

An episode counter utility.

current_step: int = 0
max_steps: int
smarts.core.utils.episodes.episode_range(max_steps)[source]

An iteration method that provides a range of episodes that meets the given max steps.

smarts.core.utils.episodes.episodes(n)[source]

An iteration method that provides numbered episodes. Acts similar to python’s range(n) but yielding episode loggers.