ribs.emitters.rankers.NSLCClassicRanker¶
-
class ribs.emitters.rankers.NSLCClassicRanker(seed: int | integer | None =
None)[source]¶ Ranks solutions with the paper-faithful NSLC algorithm using genotypic diversity.
This ranker is a variant of
NSLCRankerthat automatically uses thegenotypic_diversityfield as the third objective in the non-dominated sort, implementing Lehman & Stanley’s original NSLC algorithm. This is the paper-faithful mode that uses three objectives:Novelty (higher is better)
Local competition (higher is better)
Genotypic diversity (higher is better)
This ranker is intended for users who can provide a genotypic-diversity signal for their domain. If the
genotypic_diversityfield is not available from the archive or emitter, the ranker will raise a KeyError at ranking time.For the practical 2-objective version that uses NSGA-II crowding distance instead, use
NSLCRanker.This ranker can only be used with archives that return both
noveltyandlocal_competitionfields from theiraddmethod. Currently, this isribs.archives.ProximityArchive.add()when the archive is constructed withlocal_competition=True.- Parameters:¶
- seed: int | integer | None =
None¶ Passed through to
RankerBase; unused by this ranker but kept for API consistency with other rankers.
- seed: int | integer | None =
Methods
rank(emitter, archive, data, add_info)Ranks solutions by fast non-dominated sort over (novelty, local_competition) -- plus an optional third diversity objective when
diversity_fieldis set -- and breaks ties within each front with NSGA-II crowding distance.reset(emitter, archive)Resets the internal state of the ranker.
Attributes
Name of the optional third objective field, or
None.- rank(emitter: EmitterBase, archive: ArchiveBase, data: dict[str, ndarray], add_info: dict[str, ndarray]) tuple[ndarray, ndarray]¶
Ranks solutions by fast non-dominated sort over (novelty, local_competition) – plus an optional third diversity objective when
diversity_fieldis set – and breaks ties within each front with NSGA-II crowding distance.- Parameters:¶
- emitter: EmitterBase¶
Emitter that this
rankerobject belongs to.- archive: ArchiveBase¶
Archive used by
emitterwhen creating and inserting solutions.- data: dict[str, ndarray]¶
Dict mapping from field names like
solutionandobjectiveto arrays with data for the solutions.- add_info: dict[str, ndarray]¶
Information returned by an archive’s
add()method.
- Returns:¶
The first array (shape
(batch_size,)) is an array of indices representing a ranking of the solutions and the second array (shape(batch_size,)or(batch_size, n_values)) is an array of values that this ranker used to rank the solutions.batch_sizeis the number of solutions andn_valuesis the number of values that the rank function used.
- reset(emitter: EmitterBase, archive: ArchiveBase) None¶
Resets the internal state of the ranker.
- Parameters:¶
- emitter: EmitterBase¶
Emitter that this
rankerobject belongs to.- archive: ArchiveBase¶
Archive used by
emitterwhen creating and inserting solutions.