Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Nov 25, 2023
1 parent ba6c8d0 commit 3a6ae9d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
17 changes: 17 additions & 0 deletions benchmarl/benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@


class Benchmark:
"""A benchmark.
Benchmarks are collections of experiments to compare.
Args:
algorithm_configs (list of AlgorithmConfig): the algorithms to benchmark
model_config (ModelConfig): the config of the policy model
tasks (list of Task): the tasks to benchmark
seeds (set of int): the seeds for the benchmark
experiment_config (ExperimentConfig): the experiment config
critic_model_config (ModelConfig, optional): the config of the critic model. Defaults to model_config
"""

def __init__(
self,
algorithm_configs: Sequence[AlgorithmConfig],
Expand All @@ -36,9 +50,11 @@ def __init__(

@property
def n_experiments(self):
"""The number of experiments in the benchmark."""
return len(self.algorithm_configs) * len(self.tasks) * len(self.seeds)

def get_experiments(self) -> Iterator[Experiment]:
"""Yields one experiment at a time"""
for algorithm_config in self.algorithm_configs:
for task in self.tasks:
for seed in self.seeds:
Expand All @@ -52,6 +68,7 @@ def get_experiments(self) -> Iterator[Experiment]:
)

def run_sequential(self):
"""Run all the experiments in the benchmark in a sequence."""
for i, experiment in enumerate(self.get_experiments()):
print(f"\nRunning experiment {i+1}/{self.n_experiments}.\n")
try:
Expand Down
9 changes: 3 additions & 6 deletions docs/source/modules/benchmark.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ benchmarl.benchmark
Benchmark
---------

.. autosummary::
:nosignatures:
:toctree: ../generated
:template: autosummary/class.rst

Benchmark
.. automodule:: benchmarl.benchmark.benchmark
:members:
:undoc-members:

0 comments on commit 3a6ae9d

Please sign in to comment.