QDpy
Loading...
Searching...
No Matches
qdpy.containers.trace.TraceArchive Class Reference

Best-only multi-point archive with one record per retained measurement. More...

Public Member Functions

 __len__ (self)
 __iter__ (self)
 __getitem__ (self, index)
 cell_elites (self)
 filled_bins (self)
 coverage (self)
 features_domain (self)
 cells_for (self, trace)
 Identify distinct cells in order of their first visit.
 sample (self, rng, *, by_cell=True)
 Sample one parent by cell or by retained measurement.
 add (self, genome, fitness, trace)
 Apply the same measurement independently to all visited cells.
 to_grid (self)
 Materialize a per-cell reporting grid for plotting or export.
 qd_score (self, normalized=True)
 Sum the fitness of cell winners as in a best-only grid.

Detailed Description

Best-only multi-point archive with one record per retained measurement.

Use native Grid or CVTGrid geometry with independent competition per cell.

In-bounds points compete using the same signed fitness. Duplicate points
or visits to the same cell compete once. Equal fitness keeps the existing
winner. Multiple cells can reference the same immutable record. The
archive releases the record when the last cell is taken by another elite.

:param geometry: Empty, parentless, best-only Grid or CVTGrid with one
    explicit signed objective and direct fitness and descriptors.

Definition at line 34 of file trace.py.

Member Function Documentation

◆ __getitem__()

qdpy.containers.trace.TraceArchive.__getitem__ ( self,
index )
Return a retained measurement by admission order.

Definition at line 68 of file trace.py.

◆ __iter__()

qdpy.containers.trace.TraceArchive.__iter__ ( self)
Iterate retained measurements once each in admission order.

Definition at line 64 of file trace.py.

◆ __len__()

qdpy.containers.trace.TraceArchive.__len__ ( self)
Count distinct retained measurement records.

Definition at line 60 of file trace.py.

◆ add()

qdpy.containers.trace.TraceArchive.add ( self,
genome,
fitness,
trace )

Apply the same measurement independently to all visited cells.

Return the cell indices won by this measurement.

Genome coordinates, scalar fitness and descriptor points must be
finite. Empty traces, out-of-domain points and out-of-domain fitness
never win a cell.

Definition at line 122 of file trace.py.

◆ cell_elites()

qdpy.containers.trace.TraceArchive.cell_elites ( self)
Return a read-only view from cell indices to their measured elites.

Definition at line 73 of file trace.py.

◆ cells_for()

qdpy.containers.trace.TraceArchive.cells_for ( self,
trace )

Identify distinct cells in order of their first visit.

Return the cell indices visited by the in-bounds points.

Definition at line 108 of file trace.py.

◆ coverage()

qdpy.containers.trace.TraceArchive.coverage ( self)
Return the fraction of geometry cells that have a winner.

Definition at line 83 of file trace.py.

◆ features_domain()

qdpy.containers.trace.TraceArchive.features_domain ( self)
Return the native descriptor bounds.

Definition at line 88 of file trace.py.

◆ filled_bins()

qdpy.containers.trace.TraceArchive.filled_bins ( self)
Count cells with a retained winner.

Definition at line 78 of file trace.py.

◆ qd_score()

qdpy.containers.trace.TraceArchive.qd_score ( self,
normalized = True )

Sum the fitness of cell winners as in a best-only grid.

Count every occupied cell, including cells won by the same elite.

Definition at line 174 of file trace.py.

◆ sample()

qdpy.containers.trace.TraceArchive.sample ( self,
rng,
* ,
by_cell = True )

Sample one parent by cell or by retained measurement.

Use a NumPy random generator to draw a parent uniformly from the selected pool.

Definition at line 113 of file trace.py.

◆ to_grid()

qdpy.containers.trace.TraceArchive.to_grid ( self)

Materialize a per-cell reporting grid for plotting or export.

Return a fresh native grid with one representative point per won cell.

Definition at line 160 of file trace.py.


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