ribs.emitters.rankers.ImprovementRanker¶
-
class ribs.emitters.rankers.ImprovementRanker(seed: int | integer | None =
None)[source]¶ Ranks solutions based on improvement in the objective.
This ranker ranks solutions in a single stage. The solutions are ranked by the improvement “value” described in
ribs.archives.ArchiveBase.add().This ranker should not be used with CMA-ME. The improvement values for new solutions in CMA-ME are on a different scale from the improvement values for the other solutions, in that new solutions have an improvement value which is simply their objective, while other solutions have an improvement value which is the difference between their objective and the objective of their corresponding cell in the archive.
Methods
rank(emitter, archive, data, add_info)Generates a list of indices that represents an ordering of solutions.
reset(emitter, archive)Resets the internal state of the ranker.
- rank(emitter: EmitterBase, archive: ArchiveBase, data: dict[str, ndarray], add_info: dict[str, ndarray]) tuple[ndarray, ndarray][source]¶
Generates a list of indices that represents an ordering of solutions.
- 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.