ribs.emitters.rankers.RankerBase¶
- class ribs.emitters.rankers.RankerBase(seed=None)[source]¶
Base class for rankers.
Every ranker has a
rank()
method that returns a list of indices that indicate how the solutions should be ranked and areset()
method that resets the internal state of the ranker (e.g. inRandomDirectionRanker
).Child classes are only required to override
rank()
.Methods
rank
(emitter, archive, data, add_info)Generates a batch of indices that represents an ordering of
data["solution"]
.reset
(emitter, archive)Resets the internal state of the ranker.
- abstract rank(emitter, archive, data, add_info)[source]¶
Generates a batch of indices that represents an ordering of
data["solution"]
.- Parameters
emitter (ribs.emitters.EmitterBase) – Emitter that this
ranker
object belongs to.archive (ribs.archives.ArchiveBase) – Archive used by
emitter
when creating and inserting solutions.data (dict) – Dict mapping from field names like
solution
andobjective
to arrays with data for the solutions. Rankers at least assume the presence of thesolution
key.add_info (dict) – 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 andn_values
is the number of values that the rank function used.- Return type
- reset(emitter, archive)[source]¶
Resets the internal state of the ranker.
- Parameters
emitter (ribs.emitters.EmitterBase) – Emitter that this
ranker
object belongs to.archive (ribs.archives.ArchiveBase) – Archive used by
emitter
when creating and inserting solutions.