ribs.emitters.rankers.RankerBase¶
- class ribs.emitters.rankers.RankerBase[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. inribs.emitters.rankers._random_direction_ranker
).Child classes are only required to override
rank()
.Methods
rank
(emitter, archive, rng, solution_batch, ...)Generates a batch of indices that represents an ordering of
solution_batch
.reset
(emitter, archive, rng)Resets the internal state of the ranker.
- abstract rank(emitter, archive, rng, solution_batch, objective_batch, measures_batch, status_batch, value_batch, metadata_batch)[source]¶
Generates a batch of indices that represents an ordering of
solution_batch
.- 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.rng (numpy.random.Generator) – A random number generator.
solution_batch (numpy.ndarray) – Batch of solutions generated by the emitter’s
ask()
method.objective_batch (numpy.ndarray) – Batch of objective values.
measures_batch (numpy.ndarray) –
(n, <measure space dimension>)
array with the measure space coordinates of each solution.status_batch (numpy.ndarray) – An array of integer statuses returned by a series of calls to archive’s
add_single()
method or by a single call to archive’sadd()
.value_batch (numpy.ndarray) – 1D array of floats returned by a series of calls to archive’s
add_single()
method or by a single call to archive’sadd()
. For what these floats represent, refer toribs.archives.add()
.metadata_batch (numpy.ndarray) – 1D object array containing a metadata object for each solution.
- 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, rng)[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.rng (numpy.random.Generator) – A random number generator.