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

Density descent, dynamic archive refresh, and ES gradient arborescences. More...

Go to the source code of this file.

Classes

class  qdpy.algorithms.descriptor_cma.DDSResult
 Live passive archive and density search accounting. More...
class  qdpy.algorithms.descriptor_cma.DynamicCMAResult
 Dynamic archive and separately accounted evaluation phases. More...
class  qdpy.algorithms.descriptor_cma.CMAMEGAESResult
 Live archive and counts for each arborescence evaluation phase. More...

Namespaces

namespace  qdpy

Functions

 qdpy.algorithms.descriptor_cma._settings (archive, evaluate, x0, sigma0, batch_size, budget, ind_domain, on_step)
 qdpy.algorithms.descriptor_cma._improvements (archive, measurements, *, ages=None, tick=None)
 qdpy.algorithms.descriptor_cma._negative_log_density (points, previous, bandwidth)
 qdpy.algorithms.descriptor_cma.dds_kde (archive, evaluate, *, x0, budget, bandwidth, reservoir_size=1024, sigma0=0.15, batch_size=16, ind_domain=(0, 1), seed=0, executor=None, on_step=None)
 Guide CMA by a Gaussian KDE on a bounded reservoir of descriptors.
 qdpy.algorithms.descriptor_cma._density_descent (archive, evaluate, x0, budget, reservoir_size, sigma0, batch_size, ind_domain, seed, executor, on_step, negative_log_density)
 qdpy.algorithms.descriptor_cma._refresh_replacees (archive, offspring, probe, probe_measurement, remeasure)
 qdpy.algorithms.descriptor_cma.dynamic_cma_me (archive, evaluate, *, x0, budget, sigma0=0.15, batch_size=16, ind_domain=(0, 1), seed=0, refresh=True, on_step=None)
 Revalidate stale incumbents before CMA-ME ranks a generation.
 qdpy.algorithms.descriptor_cma._rank_gradients (noise, positive, negative)
 qdpy.algorithms.descriptor_cma._es_basis (noise, measurements, objective_weight)
 qdpy.algorithms.descriptor_cma.cma_mega_es (archive, evaluate, *, x0, budget, es_samples=32, es_sigma=0.02, sigma0=0.2, step_size=1.0, batch_size=16, ind_domain=(0, 1), seed=0, executor=None, on_step=None)
 Build and branch a gradient basis using a single batch of ES perturbations.

Detailed Description

Density descent, dynamic archive refresh, and ES gradient arborescences.

Definition in file descriptor_cma.py.

Function Documentation

◆ _density_descent()

qdpy.algorithms.descriptor_cma._density_descent ( archive,
evaluate,
x0,
budget,
reservoir_size,
sigma0,
batch_size,
ind_domain,
seed,
executor,
on_step,
negative_log_density )
protected
Rank valid candidates against an estimator using the previous descriptor reservoir.

Definition at line 205 of file descriptor_cma.py.

◆ _es_basis()

qdpy.algorithms.descriptor_cma._es_basis ( noise,
measurements,
objective_weight )
protected
Estimate rank gradients from complete mirrored pairs and normalise each row.

Definition at line 382 of file descriptor_cma.py.

◆ _improvements()

qdpy.algorithms.descriptor_cma._improvements ( archive,
measurements,
* ,
ages = None,
tick = None )
protected
Rank new cells first, then improvements, then rejected candidates.

Definition at line 124 of file descriptor_cma.py.

◆ _negative_log_density()

qdpy.algorithms.descriptor_cma._negative_log_density ( points,
previous,
bandwidth )
protected
Rank Gaussian KDEs in log space so remote points retain separation.

Definition at line 155 of file descriptor_cma.py.

◆ _rank_gradients()

qdpy.algorithms.descriptor_cma._rank_gradients ( noise,
positive,
negative )
protected
Form mirrored ES gradients using combined per-output ranks.

Definition at line 374 of file descriptor_cma.py.

◆ _refresh_replacees()

qdpy.algorithms.descriptor_cma._refresh_replacees ( archive,
offspring,
probe,
probe_measurement,
remeasure )
protected
Stage one probe and all incumbent moves against the unchanged archive.

Definition at line 246 of file descriptor_cma.py.

◆ _settings()

qdpy.algorithms.descriptor_cma._settings ( archive,
evaluate,
x0,
sigma0,
batch_size,
budget,
ind_domain,
on_step )
protected
Validate the shared archive, budget and CMA search domain.

Definition at line 71 of file descriptor_cma.py.

◆ cma_mega_es()

qdpy.algorithms.descriptor_cma.cma_mega_es ( archive,
evaluate,
* ,
x0,
budget,
es_samples = 32,
es_sigma = 0.02,
sigma0 = 0.2,
step_size = 1.0,
batch_size = 16,
ind_domain = (0, 1),
seed = 0,
executor = None,
on_step = None )

Build and branch a gradient basis using a single batch of ES perturbations.

Run CMA-MEGA (ES) with measured fitness and black-box descriptors.

Evaluate the centre and mirrored perturbations first. Use one rank
gradient per output, estimated from the same perturbations. Offer
all valid measurements to the archive. Branch along combinations of
the normalised gradients and adapt CMA in coefficient space using
archive improvement. Advance the centre by rank-weighted gradient
ascent. If the budget ends, archive measured partial phases without
adapting CMA from a short batch. Discard incomplete mirrored pairs
when estimating gradients.

:param archive: Empty, parentless, best-only Grid or CVTGrid.
:param evaluate: Callable taking an immutable real-valued genome and
    returning a singleton fitness vector and its descriptors.
:param x0: Initial centre in genome coordinates.
:param budget: Total attempted centre, perturbation and offspring evaluations.
:param es_samples: Even number of perturbations including both signs.
:param es_sigma: Perturbation standard deviation in genome coordinates.
:param sigma0: Initial CMA step size in gradient coefficient coordinates.
:param step_size: Multiplier for the rank-weighted centre displacement.
:param batch_size: CMA offspring population size.
:param ind_domain: Inclusive bounds, or None for unbounded search.
:param seed: Private seed for perturbations, CMA and restart centres.
:param executor: Optional caller-owned executor with ordered map.
:param on_step: Optional callback receiving the archive, iteration and evaluations.
:returns: The live archive and counts for each phase.

Definition at line 398 of file descriptor_cma.py.

◆ dds_kde()

qdpy.algorithms.descriptor_cma.dds_kde ( archive,
evaluate,
* ,
x0,
budget,
bandwidth,
reservoir_size = 1024,
sigma0 = 0.15,
batch_size = 16,
ind_domain = (0, 1),
seed = 0,
executor = None,
on_step = None )

Guide CMA by a Gaussian KDE on a bounded reservoir of descriptors.

Run Density Descent Search with kernel density estimation.

Each generation is ranked against the descriptor reservoir from earlier
generations. Reuse the previous order to break equal densities. Offer
measured solutions to a passive archive. Fitness and archive admission
never enter CMA feedback. Valid measurements outside the archive's
bounds still inform the density model.

:param archive: Empty, parentless, best-only Grid or CVTGrid.
:param evaluate: Callable taking an immutable genome and returning
    a singleton fitness vector and its descriptors. Use constant fitness
    for a pure diversity task.
:param x0: Initial genome for CMA and its restarts.
:param budget: Total attempted evaluations.
:param bandwidth: Positive Gaussian bandwidth in descriptor units.
:param reservoir_size: Maximum number of past descriptors to retain.
:param sigma0: Initial CMA sampling scale in genome coordinates.
:param batch_size: CMA population size. Commit a final partial batch
    to the passive archive and reservoir.
:param ind_domain: Shared bounds, or None for unbounded search.
:param seed: Private seed for CMA and uniform reservoir sampling.
:param executor: Optional caller-owned executor with ordered map.
:param on_step: Optional callback receiving the archive, iteration and evaluations.
:returns: Passive archive and run accounting.

Definition at line 170 of file descriptor_cma.py.

◆ dynamic_cma_me()

qdpy.algorithms.descriptor_cma.dynamic_cma_me ( archive,
evaluate,
* ,
x0,
budget,
sigma0 = 0.15,
batch_size = 16,
ind_domain = (0, 1),
seed = 0,
refresh = True,
on_step = None )

Revalidate stale incumbents before CMA-ME ranks a generation.

Run Dynamic CMA-ME with oldest-elite detection and replacee refresh.

A generation shares one tick, the number of attempts already spent
when it starts. Probe the least recently checked elite, including with
the final available call. If the probe changed, refresh occupied
destinations and follow incumbent moves. Commit the updates together
before ranking offspring by cell improvement. Failed or unfinished
refreshes leave the archive untouched and restart the strategy.
Only offspring from a full generation enter CMA feedback.

:param archive: Empty, parentless, best-only Grid or CVTGrid.
:param evaluate: Callable taking an immutable genome and a tick.
    Return a singleton fitness vector and its descriptors.
:param x0: Initial genome used before the first archive admission.
:param budget: All attempted evaluations, including probes and refreshes.
:param sigma0: Initial CMA sampling scale.
:param batch_size: CMA population size.
:param ind_domain: Common bounds, or None for unbounded search.
:param seed: Private CMA and restart seed.
:param refresh: Enable detection and refresh. False runs static CMA-ME
    with the same improvement emitter and tick convention.
:param on_step: Optional callback receiving the archive, iteration and evaluations.
:returns: The live archive and counts per evaluation phase.

Definition at line 268 of file descriptor_cma.py.