(models: str, arenas: str, rounds: int, simulations: int, record_ratio: float, output: Path)
| 8 | |
| 9 | |
| 10 | def main(models: str, arenas: str, rounds: int, simulations: int, record_ratio: float, output: Path): |
| 11 | # Get all models |
| 12 | models = yaml.safe_load(open(models)) |
| 13 | output.mkdir(parents=True, exist_ok=True) |
| 14 | |
| 15 | # Get arenas |
| 16 | arenas_list = ARENAS if arenas == "all" else [a for a in ARENAS if a.name in arenas.split(",")] |
| 17 | if not arenas_list: |
| 18 | print(f"No valid arenas found from {arenas}. Choose from {[a.name for a in ARENAS]}.") |
| 19 | return # Stop execution if no valid arenas are found |
| 20 | |
| 21 | for arena in arenas_list: |
| 22 | print(f"Generating config for arena: {arena.name}") |
| 23 | config = get_config(rounds, simulations, arena, models) |
| 24 | config_name = f"{arena.name}__p{len(models)}__r{rounds}__s{simulations}.yaml" |
| 25 | with open(output / config_name, "w") as f: |
| 26 | yaml.dump( |
| 27 | config, |
| 28 | f, |
| 29 | default_style=None, |
| 30 | sort_keys=False, |
| 31 | allow_unicode=True, |
| 32 | default_flow_style=False, |
| 33 | Dumper=yaml.SafeDumper, |
| 34 | ) |
| 35 | |
| 36 | clean_config(output / config_name) |
| 37 | |
| 38 | print(f"Generated {len(arenas_list)} configuration files in '{output}'.") |
| 39 | print(f"- # Models: {len(models)}") |
| 40 | print(f"- # Arenas: {len(arenas_list)}") |
| 41 | print(f"- r (rounds) {rounds}") |
| 42 | print(f"- s (sims_per_round) {simulations}") |
| 43 | |
| 44 | |
| 45 | if __name__ == "__main__": |
no test coverage detected