marlax.tracers.Tracer#

class marlax.tracers.Tracer(log_path)[source]#

Bases: object

Records and manages simulation logs and agent exports.

log_path#

Base directory for log storage.

Type:

str

logger_active#

Flag indicating logging activity.

Type:

bool

log_buffer#

Buffered rows awaiting flush.

Type:

list

flush_every#

Number of frames before auto-flush.

Type:

int

regime_idx#

Identifier for current regime.

Type:

int

log_filename#

Path to the active Parquet file.

Type:

str

parquet_writer#

Writer for Parquet output.

Type:

pq.ParquetWriter

__init__(log_path)[source]#

Initialize the tracer.

Parameters:

log_path (str) – Path to the log directory.

Methods

__init__(log_path)

Initialize the tracer.

export_agents(env)

Serialize each agent's Q-table to individual pickle files.

import_agents(agent)

Load agent Q-tables from pickle files and reinstantiate agents.

export_agents(env)[source]#

Serialize each agent’s Q-table to individual pickle files.

Parameters:

env (Environment) – Environment whose agents will be dumped.

import_agents(agent)[source]#

Load agent Q-tables from pickle files and reinstantiate agents.

Parameters:

agent_cls (callable) – Constructor for the agent class to create instances.

Returns:

Agent instances with loaded Q-tables.

Return type:

list