benchmarl.experiment.Experiment

class Experiment(task: Task, algorithm_config: AlgorithmConfig, model_config: ModelConfig, seed: int, config: ExperimentConfig, critic_model_config: ModelConfig | None = None, callbacks: List[Callback] | None = None)[source]

Bases: CallbackNotifier

Main experiment class in BenchMARL.

Parameters:
  • task (Task) – the task configuration

  • algorithm_config (AlgorithmConfig) – the algorithm configuration

  • model_config (ModelConfig) – the policy model configuration

  • seed (int) – the seed for the experiment

  • config (ExperimentConfig) – the experiment config

  • critic_model_config (ModelConfig, optional) – the policy model configuration. If None, it defaults to model_config

  • callbacks (list of Callback, optional) – callbacks for this experiment

property on_policy: bool

Whether the algorithm has to be run on policy.

run()[source]

Run the experiment until completion.

evaluate()[source]

Run just the evaluation loop once.

close()[source]

Close the experiment.

state_dict() OrderedDict[source]

Get the state_dict for the experiment.

load_state_dict(state_dict: Dict) None[source]

Load the state_dict for the experiment.

Parameters:

state_dict (dict) – the state dict