sinergym.utils.wrappers.LoggerWrapper

class sinergym.utils.wrappers.LoggerWrapper(*args: Any, **kwargs: Any)
__init__(env: ~typing.Any, logger_class: ~typing.Callable = <class 'sinergym.utils.logger.CSVLogger'>, monitor_header: ~typing.List[str] | None = None, progress_header: ~typing.List[str] | None = None, flag: bool = True)

CSVLogger to log interactions with environment.

Parameters:
  • env (Any) – Original Gym environment.

  • logger_class (CSVLogger) – CSV Logger class to use to log all information.

  • monitor_header – Header for monitor.csv in each episode. Default is None (default format).

  • progress_header – Header for progress.csv in whole simulation. Default is None (default format).

  • flag (bool, optional) – State of logger (activate or deactivate). Defaults to True.

Methods

__init__(env[, logger_class, ...])

CSVLogger to log interactions with environment.

activate_logger()

Activate logger if its flag False.

close()

Recording last episode summary and close env.

deactivate_logger()

Deactivate logger if its flag True.

reset()

Resets the environment.

step(action)

Step the environment.

activate_logger() None

Activate logger if its flag False.

close() None

Recording last episode summary and close env.

deactivate_logger() None

Deactivate logger if its flag True.

reset() ndarray

Resets the environment. Recording episode summary in logger

Returns:

First observation given

Return type:

np.ndarray

step(action: int | ndarray) Tuple[ndarray, float, bool, Dict[str, Any]]

Step the environment. Logging new information

Parameters:

action (Union[int, np.ndarray]) – Action executed in step

Returns:

Tuple with next observation, reward, bool for terminated episode and dict with extra information.

Return type:

Tuple[np.ndarray, float, bool, Dict[str, Any]]