QDpy
Loading...
Searching...
No Matches
qdpy.rl.dqs.DiverseQualitySpecies Class Reference

Evolve multiple high-performing species without requiring a descriptor grid. More...

Public Member Functions

 stats (self)
 train (self, max_env_steps)
 Evaluate population members and run online updates under a hard step cap.
 policy_for (self, species, member, *, device=None)
 Reconstruct an independently exportable member of a species.
 best_policy (self, *, species=None, device=None)
 Return the best measured member by running average raw task reward.
 evaluate (self, *, episodes=4, seed=1337, descriptor=None, archive=None, env_factory=None, best_per_species=False)
 Measure policies on independent seeds and optionally bin their achieved descriptors.

Detailed Description

Evolve multiple high-performing species without requiring a descriptor grid.

Learn continuous policies using species-specific deterministic policy gradients.

Each species contains several independently deployable policies. A
discriminator rewards successor states informative about their species.
The shared actor and twin critics receive species IDs and learn TD3
targets from a common replay ring. Retained members are reevaluated
every generation and selected by their running mean task return.
Offspring learn against the shared critic using their own species'
replay states. An optional post-training audit can map policies into
caller-supplied descriptor cells.

:param env_factory: Callable returning a single Gymnasium Box environment.
:param num_species: Number of fixed, equal-sized populations.
:param species_size: Number of policies belonging to each species.
:param elites: Number of retained breeders per species, below species_size.
:param diversity_scale: Nonnegative multiplier of the discriminator reward.
:param gradient_steps: Number of actor updates per cloned offspring.
:param update_frequency: Environment steps between replay learner updates.
:param discriminator_learning_rate: Positive Adam learning rate for the state classifier.
:param policy: PolicyConfig specifying policy and species actor architecture.
:param td3: TD3Config for the shared learner and offspring learning rate.
:param max_episode_steps: Hard maximum steps in each training or audit episode.
:param seed: Nonnegative seed for resets, replay, and variation.
:param device: CPU or CUDA Torch device.

Definition at line 97 of file dqs.py.

Member Function Documentation

◆ best_policy()

qdpy.rl.dqs.DiverseQualitySpecies.best_policy ( self,
* ,
species = None,
device = None )

Return the best measured member by running average raw task reward.

Optionally restrict selection to one species.

Definition at line 273 of file dqs.py.

◆ evaluate()

qdpy.rl.dqs.DiverseQualitySpecies.evaluate ( self,
* ,
episodes = 4,
seed = 1337,
descriptor = None,
archive = None,
env_factory = None,
best_per_species = False )

Measure policies on independent seeds and optionally bin their achieved descriptors.

Parameters
episodesNumber of held-out episodes per measured population member.
seedBase seed, shared reset panel across all members.
descriptorOptional callback from complete episodes to numeric descriptors.
archiveOptional empty best-only reporting Grid or CVTGrid.
env_factoryOptional environment factory with the same spaces as training.
best_per_speciesAudit only the top training-ranked member of each measured species.
Returns
Independent DQSAudit with measured results and environment-step cost.
Evaluate without updating the search counters, learner, or supplied grid.

Definition at line 290 of file dqs.py.

◆ policy_for()

qdpy.rl.dqs.DiverseQualitySpecies.policy_for ( self,
species,
member,
* ,
device = None )

Reconstruct an independently exportable member of a species.

Return a deterministic ContinuousPolicy for the current slots.

Definition at line 261 of file dqs.py.

◆ stats()

qdpy.rl.dqs.DiverseQualitySpecies.stats ( self)
Return cumulative search accounting, including pending population work.

Definition at line 167 of file dqs.py.

◆ train()

qdpy.rl.dqs.DiverseQualitySpecies.train ( self,
max_env_steps )

Evaluate population members and run online updates under a hard step cap.

Train for additional environment steps. Retry an unfinished member on the next call.

Definition at line 228 of file dqs.py.


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