How QDpy runs a search¶
A search owns the request and feedback loop. The evaluator owns the measurements. The archive owns admission and supplies retained candidates to the search. The same evaluator can be used with more than one search or archive when their objective counts and descriptor domains agree.
Candidate lifecycle¶
The optimiser asks for a candidate. Uniform and Sobol search generate a genome directly. Evolutionary searches can select and copy a genome that is already in an archive.
The evaluator returns raw objectives and behaviour descriptors. It can also return a dictionary of named measurements. A genome and its descriptors can have different dimensions.
Tell attaches the evaluation, checks the objective count, and invokes the optimiser’s pre-admission hook. For example, an improvement emitter uses this hook to read the previous quality of the destination cell.
The archive resolves the configured fitness and descriptors and decides whether to keep the candidate. Feedback then reaches the optimiser and its logger, with an indicator of the archive’s reported update.
Fitness weights determine comparison direction. A negative weight minimises, a positive weight maximises, and zero gives an objective no influence in weighted comparisons. Saved fitness values remain in their original units. Use an explicit fitness domain per objective and descriptor domain per coordinate. The domains affect admission. For mutation bounds, configure the optimiser’s genome domain separately.
Archive layout¶
Archive |
Local membership |
Configuration to check |
|---|---|---|
Retains evaluated candidates within the declared domains and capacity. |
Fitness and descriptor names, storage type, and parent links. |
|
Partitions descriptor space into rectangular cells. |
One cell count per descriptor, one or more entries per cell, and finite descriptor bounds. |
|
Assigns each descriptor vector to the nearest fitted centre. |
Number of centres and number of dimensions used for centroid fitting. |
|
Rebuilds rectangular cells as the observed domains change. |
Scaling archives and whether to adapt the fitness domain, descriptor domain, or both. |
|
Admits novel candidates or candidates that dominate their nearby neighbour. |
A parent archive, distance metric, neighbour count, and novelty threshold. |
|
Replaces its oldest local member when admitting a new genome at capacity. |
Finite capacity and parent admission. |
Keep genome values unchanged while an individual is stored. Genome equality determines duplicate admission, and hash-based backends depend on a stable genome hash. A descriptor edit alone leaves an entry in its stored grid cell. To move the candidate, discard it and resubmit it with the new descriptor.
Parents retain evaluation history separately from child elites. A near-neighbour match in the parents gives a novelty archive a reference for comparison. Eviction affects the child when the matched neighbour also has a local entry. If a required parent insertion raises, the child preserves its existing member. With multiple parents, built-in parent archives restore their previous entries and counters. A custom parent is responsible for its external side effects. In best-effort mode, the child continues to offer the candidate to later parents after a failure.
Reporting QD scores¶
The normalised QD score uses the declared fitness bounds to measure
improvement from the worst endpoint of each objective. An infinite endpoint
makes that score unavailable for a populated archive. The logger displays
N/A and saves nan in its iteration table. For the sum of raw objective
values instead, call archive.qd_score(normalized=False). Supply finite
fitness bounds to compare normalised quality across runs.
Parallel dispatch¶
The controlling process asks for candidates and applies all results to the archive. Use the evaluator workers to compute measurements. In batch mode the controller waits for the batch before asking again. In steady-state mode it refills available slots as calls finish.
A packed call uses one slot for every candidate it contains. The evaluator returns one result per input in the same order. Failed calls still consume the candidate slots already dispatched. With an emitter wrapper, the scheduler retains the original ask object so that a late evaluation reaches its proposer.
The completion order can change which elites are available when the next proposal is generated. For repeatable evaluation noise, derive a private random generator from a recorded run seed and a stable candidate or evaluation identifier. Keep interpreter and dependency versions with the result when repeating an experiment.
Extension points¶
Supply an evaluation function to an existing
QDAlgorithmwhen only the objective or descriptors change.Use
LambdaorEvolutionwhen you have a candidate generator, selection operator, or feedback rule.Subclass the optimiser when it needs persistent search state. Use the pre-admission hook for information that can change during admission and the tell hook for feedback based on the outcome.
Use
ContainerDecoratorwhen the archive should resolve descriptors differently while retaining its original storage. Register a class when it needs to be constructed from YAML.
Read Core Python API for public signatures, Control evaluation with ask and tell for runnable scheduling examples, and QDpy source reference for the source reference with implementation hooks.