QDpy
Loading...
Searching...
No Matches
qdpy.rl.search.NeuralMAPElites Class Reference

Illuminate a fixed QDpy archive by evaluating and mutating neural policies. More...

Inheritance diagram for qdpy.rl.search.NeuralMAPElites:
qdpy.rl.ascii_me.ASCIIME qdpy.rl.bfm_qd.BFMQD qdpy.rl.cma_mega.CMAMEGATD3ES qdpy.rl.descriptor_search._DescriptorMAPElites qdpy.rl.dynamics_aware.DynamicsAwareQD qdpy.rl.gene_map_elites.GENEMAPElites qdpy.rl.madecm.MADECM qdpy.rl.masqd.MASQD qdpy.rl.mome_p2c._ParetoPolicySearch qdpy.rl.pbt.PBTMAPElites qdpy.rl.pga.PGAMAPElites qdpy.rl.ppga.PPGA qdpy.rl.qdpg.QDPG qdpy.rl.search.PPOAssistedMAPElites qdpy.rl.sv_qd.SVQDRL

Public Member Functions

 stats (self)
 train (self, max_env_steps, *, evaluation_batch_size=1, budget_aware=False)
 Spend an additional hard step budget on policy search.
 policy_for (self, individual, *, device=None, seed=0)
 Rebuild an independent inference actor from an archived genome.
 best_policy (self, *, device=None, seed=0)
 Rebuild the best archived actor for inference or export.

Detailed Description

Illuminate a fixed QDpy archive by evaluating and mutating neural policies.

Search for high-return policies with different measured behaviour.

Random Torch initializations fill the initial archive. Later offspring
use Iso+LineDD without clipping network weights. All policies use the
same architecture, and the archive owns copies of their flat genomes.

:param env_factory: Callable returning a fresh Gymnasium environment.
:param archive: Empty, parentless, best-only Grid or CVTGrid with one
    fitness objective. If set, its fitness weight must be positive.
:param descriptor: Map a completed :class:`Episode` to a descriptor vector.
:param fitness: Optional function of a completed episode. Defaults to return.
:param policy: Actor architecture as a :class:`PolicyConfig`.
:param evaluation_episodes: Average this many complete episodes per policy.
:param initial_policies: Number of evaluated random policies before variation.
:param iso_sigma: Independent Iso+LineDD noise scale.
:param line_sigma: Shared Iso+LineDD noise scale.
:param max_episode_steps: Per-episode safety horizon.
:param seed: Nonnegative seed for selection, initialization, and resets.
:param device: Torch CPU or CUDA device.
:param on_step: Optional callable receiving the archive and a frozen
    snapshot of cumulative stats after each completed candidate evaluation.

Definition at line 24 of file search.py.

Member Function Documentation

◆ best_policy()

qdpy.rl.search.NeuralMAPElites.best_policy ( self,
* ,
device = None,
seed = 0 )

Rebuild the best archived actor for inference or export.

Return an independent copy of the best policy, or raise on an empty archive.

Definition at line 233 of file search.py.

◆ policy_for()

qdpy.rl.search.NeuralMAPElites.policy_for ( self,
individual,
* ,
device = None,
seed = 0 )

Rebuild an independent inference actor from an archived genome.

Decode a candidate using this search's observation and action layout.

Reimplemented in qdpy.rl.bfm_qd.BFMQD, and qdpy.rl.gene_map_elites.GENEMAPElites.

Definition at line 226 of file search.py.

◆ stats()

◆ train()

qdpy.rl.search.NeuralMAPElites.train ( self,
max_env_steps,
* ,
evaluation_batch_size = 1,
budget_aware = False )

Spend an additional hard step budget on policy search.

Parameters
max_env_stepsAdditional environment transitions allowed in this call.
evaluation_batch_sizeMaximum number of policies evaluated together.
budget_awareReserve complete episodes when choosing each batch's width.
Returns
Cumulative interaction and evaluation counts.
Return cumulative stats. A budget-cut candidate cannot enter the archive.

The optional batch size groups proposals before feedback and
batches actor inference across independent local environments.
Only plain NeuralMAPElites supports this mode. Proposals in a
batch use the same archive state and complete feedback is applied
in proposal order. Step callbacks see the consumed steps for the
batch as its feedback is applied.

With ``budget_aware=True``, the width is a ceiling. Reduce it to
reserve the worst-case steps for every episode of each policy.
When the remaining budget cannot reserve one complete policy,
advance one policy at a time until the budget is spent.

Reimplemented in qdpy.rl.cma_mega.CMAMEGATD3ES, qdpy.rl.descriptor_search._DescriptorMAPElites, qdpy.rl.dynamics_aware.DynamicsAwareQD, qdpy.rl.madecm.MADECM, qdpy.rl.masqd.MASQD, qdpy.rl.mome_p2c._ParetoPolicySearch, qdpy.rl.mome_pgx.MOMEPGX, qdpy.rl.pbt.PBTMAPElites, qdpy.rl.ppga.PPGA, qdpy.rl.reset_free_qd.ResetFreeQD, and qdpy.rl.sv_qd.SVQDRL.

Definition at line 153 of file search.py.


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