Benchmarks API¶
benchmarks.wargames_bench.WargamesBench
¶
Run a policy against all WargamesBench scenarios and return results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Optional[BenchConfig]
|
Benchmark configuration. Use :class: |
None
|
Source code in benchmarks/wargames_bench.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
run(policy=None, *, label=None)
¶
Evaluate policy on all benchmark scenarios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
Optional[Any]
|
Any callable that accepts a flat |
None
|
label
|
Optional[str]
|
Override :attr: |
None
|
Returns:
| Type | Description |
|---|---|
class:`BenchSummary`
|
|
Source code in benchmarks/wargames_bench.py
benchmarks.wargames_bench.BenchScenario
dataclass
¶
Descriptor for one WargamesBench evaluation scenario.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Unique scenario identifier. Used as the leaderboard row key. |
n_blue |
int
|
Number of blue (agent) units. |
n_red |
int
|
Number of red (opponent) units. |
weather |
str
|
Weather string — |
terrain_seed |
int
|
Seed used to generate the procedural terrain. Fixed per scenario. |
seed |
int
|
Episode-level RNG seed used for |
n_hills |
int
|
Number of terrain hills to generate. |
n_forests |
int
|
Number of terrain forest patches to generate. |
map_width |
float
|
Terrain map width in metres. |
map_height |
float
|
Terrain map height in metres. |
Source code in benchmarks/wargames_bench.py
from_dict(d)
classmethod
¶
Build a :class:BenchScenario from a registry entry dict.
Source code in benchmarks/wargames_bench.py
benchmarks.wargames_bench.BenchConfig
dataclass
¶
Configuration for a WargamesBench run.
Attributes:
| Name | Type | Description |
|---|---|---|
n_eval_episodes |
int
|
Episodes per scenario. Use ≥ 100 for reproducible ± 2 % win rates. |
n_scenarios |
int
|
Number of canonical scenarios to evaluate (≤ 20). |
max_steps_per_episode |
int
|
Hard episode-length cap. |
baseline_label |
str
|
Human-readable label for the evaluated policy in the leaderboard. |
report_path |
Optional[str]
|
Where to write the Markdown leaderboard report. |
win_rate_tolerance |
float
|
Maximum allowed win-rate deviation between runs with the same seed.
Used by :meth: |
Source code in benchmarks/wargames_bench.py
benchmarks.wargames_bench.BenchResult
dataclass
¶
Win-rate statistics for one (policy × scenario) evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
scenario_name |
str
|
Name of the evaluated scenario. |
policy_label |
str
|
Human-readable label for the policy. |
win_rate |
float
|
Fraction of episodes won by the blue (agent) policy. |
mean_steps |
float
|
Mean episode length. |
std_steps |
float
|
Standard deviation of episode length. |
n_episodes |
int
|
Number of episodes evaluated. |
elapsed_seconds |
float
|
Wall-clock seconds for this evaluation. |
Source code in benchmarks/wargames_bench.py
benchmarks.wargames_bench.BenchSummary
dataclass
¶
Aggregated WargamesBench results across all evaluated scenarios.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
List[BenchResult]
|
Per-scenario :class: |
config |
BenchConfig
|
:class: |
Source code in benchmarks/wargames_bench.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
mean_win_rate
property
¶
Mean win rate across all evaluated scenarios.
std_win_rate
property
¶
Standard deviation of win rates across scenarios.
total_elapsed_seconds
property
¶
Total wall-clock seconds for all evaluations.
total_episodes
property
¶
Total number of episodes evaluated.
is_reproducible(other)
¶
Return True when self and other win rates agree within tolerance.
Both runs must have identical scenario names in the same order. The
tolerance is self.config.win_rate_tolerance (default 2 %).
Source code in benchmarks/wargames_bench.py
to_leaderboard_row()
¶
Return a dict suitable for appending to a leaderboard table.
Source code in benchmarks/wargames_bench.py
write_markdown(path=None)
¶
Write a Markdown leaderboard report to path.
Defaults to docs/wargames_bench_leaderboard.md.