QDpy
Loading...
Searching...
No Matches
qdpy.algorithms.qd_self_play.QDSelfPlay Class Reference

Admit novel strategies and improve incumbents through matched competition. More...

Public Member Functions

 archives (self)
 stats (self)
 run (self, budget)
 Continue search using at most budget additional match calls.

Detailed Description

Admit novel strategies and improve incumbents through matched competition.

Alternate between two unstructured archives for opposing roles.

A sampled matchup gives the proposer context. If its candidate is
novel enough, the archive keeps it as a stepping stone. Otherwise the
candidate must beat its closest archived neighbor on a common panel
of opponents. Scores are interpreted in the current role's units and
larger is better for both roles. Archives hold the strategy and its
immutable embedding. Match outcomes are local to their comparison.

:param initial: One hashable immutable seed strategy per role.
:param play: Callable taking (role_0_strategy, role_1_strategy) and
    returning a finite pair of scores in that order.
:param propose: Callable taking (QDSelfPlayContext, rng) and
    returning a strategy or None to skip the proposal.
:param embed: Callable taking (role, strategy) and returning a finite vector.
:param novelty_radius: Candidate distance above which a strategy is considered novel.
:param neighbors: Maximum nearest strategies supplied to the proposer or novelty callback.
:param opponents: Maximum distinct opponents used in each local comparison.
:param is_novel: Optional callable taking (role, strategy, neighbors)
    and returning a boolean, to replace the radius decision.
:param seed: Private random seed.

Definition at line 48 of file qd_self_play.py.

Member Function Documentation

◆ archives()

qdpy.algorithms.qd_self_play.QDSelfPlay.archives ( self)
Return immutable snapshots of the strategies in role order.

Definition at line 91 of file qd_self_play.py.

◆ run()

qdpy.algorithms.qd_self_play.QDSelfPlay.run ( self,
budget )

Continue search using at most budget additional match calls.

Use the same sampled opponent panel for both members of a duel.

Each proposal costs one context match. A local update needs at
least two more calls. A run can leave up to two calls unused.
The final panel can be smaller than opponents when budget is low.

Definition at line 130 of file qd_self_play.py.

◆ stats()

qdpy.algorithms.qd_self_play.QDSelfPlay.stats ( self)
Return cumulative accounting, including attempted callback calls.

Definition at line 96 of file qd_self_play.py.


The documentation for this class was generated from the following file: