QDpy
Loading...
Searching...
No Matches
qdpy.rl.pdo.PDO Class Reference

Train PPO learners for reward, then diversify copies of archived policies. More...

Public Member Functions

 stats (self)
 initialization_cost (self)
 round_cost (self)
 elites (self)
 train (self, max_env_steps)
 Spend an additional hard environment-step budget in complete rounds.
 policies (self, *, seed=0, device=None)
 Reconstruct independent serializable actors from retained archive entries.
 evaluate (self, *, episodes_per_policy=8, seed=1337)
 Audit retained policies using a shared panel of fresh seeds.

Detailed Description

Train PPO learners for reward, then diversify copies of archived policies.

Run a synchronous continuous-action variant of Jiang et al.'s PDO.

Each reward phase updates live PPO learners and evaluates them in
the environment. Periodically replace the worst live learner with
a copy of a randomly chosen archive entry. The diversity phase
trains copies of the best archive entries using shared observations
from the reward phase and no additional environment interactions.
It evaluates those copies before offering them to the archive.

Pass a native best-only Grid or CVTGrid for descriptor-local
competition. Omit it for a bounded reward-priority archive. The
determinant uses diagonal Gaussian distances before tanh squashing.

:param env_factory: Callable returning a fresh single Gymnasium environment.
:param archive: Optional initially empty Grid or CVTGrid maximizing return.
:param descriptor: Optional callable (Episode) returning a fixed-length descriptor.
    Required with a grid.
:param archive_size: Capacity of the reward-priority archive.
:param population_size: Number of live PPO learners.
:param evaluation_episodes: Episodes per archive measurement.
:param reward_updates: Number of PPO rollout updates per learner and round.
:param diversity_updates: Auxiliary optimization steps per round, zero for a PBT control.
:param diversity_batch_size: Maximum saved observations per auxiliary step.
:param diversity_learning_rate: Learning rate for the auxiliary Adam optimizer.
:param bandwidth: Gaussian similarity kernel length in latent action units.
:param smoothing: Weight on the similarity matrix in the regularized determinant.
:param exploit_period: Completed reward rounds between PBT replacements.
:param ppo: Optional PPOConfig.
:param policy: Optional PolicyConfig.
:param max_episode_steps: Evaluation horizon and maximum environment steps per episode.
:param seed: Private seed for all training operations.
:param device: PyTorch device.

Definition at line 75 of file pdo.py.

Member Function Documentation

◆ elites()

qdpy.rl.pdo.PDO.elites ( self)
Return live archive measurements in descending measured return order.

Definition at line 176 of file pdo.py.

◆ evaluate()

qdpy.rl.pdo.PDO.evaluate ( self,
* ,
episodes_per_policy = 8,
seed = 1337 )

Audit retained policies using a shared panel of fresh seeds.

Parameters
episodes_per_policyNumber of common-seed evaluation episodes per actor.
seedIndependent evaluation seed.
Returns
Separate measurements and actual audit cost.
Measure the archive on a new evaluation panel outside the search budget.

Definition at line 323 of file pdo.py.

◆ initialization_cost()

qdpy.rl.pdo.PDO.initialization_cost ( self)
Return the worst-case cost of scoring the initial population.

Definition at line 158 of file pdo.py.

◆ policies()

qdpy.rl.pdo.PDO.policies ( self,
* ,
seed = 0,
device = None )

Reconstruct independent serializable actors from retained archive entries.

Parameters
seedSeed for clone action sampling.
deviceOptional destination device.
Returns
ContinuousPolicy objects matching elites order.
Return one exportable actor per archive measurement.

Definition at line 308 of file pdo.py.

◆ round_cost()

qdpy.rl.pdo.PDO.round_cost ( self)
Return the worst-case environment steps to reserve for a complete round.

Definition at line 163 of file pdo.py.

◆ stats()

qdpy.rl.pdo.PDO.stats ( self)
Return cumulative search costs and updates.

Definition at line 153 of file pdo.py.

◆ train()

qdpy.rl.pdo.PDO.train ( self,
max_env_steps )

Spend an additional hard environment-step budget in complete rounds.

Parameters
max_env_stepsUpper bound on additional training and archive evaluation interactions.
Returns
Cumulative PDOStats.
Reserve a full evaluation panel and leave unused steps when a round cannot fit.

Definition at line 292 of file pdo.py.


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