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 NSLCRanker that automatically uses the genotypic_diversity field 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:

  1. Novelty (higher is better)

  2. Local competition (higher is better)

  3. Genotypic diversity (higher is better)

This ranker is intended for users who can provide a genotypic-diversity signal for their domain. If the genotypic_diversity field 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 novelty and local_competition fields from their add method. Currently, this is ribs.archives.ProximityArchive.add() when the archive is constructed with local_competition=True.

Parameters:
seed: int | integer | None = None

Passed through to RankerBase; unused by this ranker but kept for API consistency with other rankers.

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_field is set -- and breaks ties within each front with NSGA-II crowding distance.

reset(emitter, archive)

Resets the internal state of the ranker.

Attributes

diversity_field

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_field is set – and breaks ties within each front with NSGA-II crowding distance.

Parameters:
emitter: EmitterBase

Emitter that this ranker object belongs to.

archive: ArchiveBase

Archive used by emitter when creating and inserting solutions.

data: dict[str, ndarray]

Dict mapping from field names like solution and objective to 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_size is the number of solutions and n_values is 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 ranker object belongs to.

archive: ArchiveBase

Archive used by emitter when creating and inserting solutions.

property diversity_field : str | None

Name of the optional third objective field, or None.