QDpy
Loading...
Searching...
No Matches
game.py File Reference

Generational Adversarial MAP-Elites for two-player games. More...

Go to the source code of this file.

Classes

class  qdpy.algorithms.game.MatchResult
 Record one match from both players' perspectives. More...
class  qdpy.algorithms.game.GameElite
 A strategy with fitness and behaviour against a single opponent. More...
class  qdpy.algorithms.game.GameRound
 The opponent-specific archives and selected strategies from one round. More...
class  qdpy.algorithms.game.GameResult
 Completed GAME rounds and separately counted matches. More...
class  qdpy.algorithms.game.GameTournamentMetrics
 Compare a strategy group against an identical panel of opponents. More...
class  qdpy.algorithms.game.GameTournament
 Store all directional payoffs from a common Red versus Blue tournament. More...
class  qdpy.algorithms.game._GrowingArchive

Namespaces

namespace  qdpy

Functions

 qdpy.algorithms.game.game_cross_play (play, red, blue, *, repeats=1)
 Evaluate two strategy pools against one another for cross-variant reporting.
 qdpy.algorithms.game.game_search (play, *, dimensions, rounds, matches_per_round, bounds=((0.0, 1.0),(0.0, 1.0)), task_count=4, cells_per_task=8, warmup_elites=8, seed=0, task_selection="behavior", match_budget=None)
 Run GAME with caller-supplied fitness and descriptors.

Detailed Description

Generational Adversarial MAP-Elites for two-player games.

Definition in file game.py.

Function Documentation

◆ game_cross_play()

qdpy.algorithms.game.game_cross_play ( play,
red,
blue,
* ,
repeats = 1 )

Evaluate two strategy pools against one another for cross-variant reporting.

Evaluate all Red and Blue pairings. Missing matchup scores are NaN.

:param play: Match evaluator with the same contract as game_search.
:param red: Red strategy genomes in input order.
:param blue: Blue strategy genomes in input order.
:param repeats: Matches to average for each pair. A failed replicate makes
    that pair incomplete and removes the affected profile from metric calculations.

Definition at line 220 of file game.py.

◆ game_search()

qdpy.algorithms.game.game_search ( play,
* ,
dimensions,
rounds,
matches_per_round,
bounds = ((0.0, 1.0), (0.0, 1.0)),
task_count = 4,
cells_per_task = 8,
warmup_elites = 8,
seed = 0,
task_selection = "behavior",
match_budget = None )

Run GAME with caller-supplied fitness and descriptors.

Coevolve two sides by alternating rounds of opponent-specific search.

An uncapped run completes ``rounds * matches_per_round`` search
attempts. Between rounds, a separate tournament provides the new
active side with measurements against its new opponents.

:param play: Callable taking immutable Red and Blue genomes in that
    order and returning a MatchResult. Each side maximises its fitness.
:param dimensions: Number of real coordinates for Red and Blue.
:param rounds: Alternating search rounds starting with Red.
:param matches_per_round: Search attempts in one round.
:param bounds: One shared coordinate interval for each side, Red first.
:param task_count: Initial number and later maximum number of opponents.
:param cells_per_task: Maximum retained niches per opponent, at least two.
:param warmup_elites: Minimum total elites before applying Iso+LineDD.
:param seed: Seed for proposals, opponent draws and clustering.
:param task_selection: "behavior" for the original selector, "ranking"
    for tournament matchup profiles, or "pareto" for NSGA-III selection
    over the raw matchup payoffs.
:param match_budget: Optional hard limit on search and tournament calls.
    If it cannot cover a selection tournament, the last round reports
    behavior-selected representatives. Inspect stopped_for_budget.
:returns: A GameResult with the round archives and attempt counts.
:raises RuntimeError: If a round yields no valid elite.

Definition at line 257 of file game.py.