ribs.emitters.rankers.TwoStageRandomDirectionRanker¶
- class ribs.emitters.rankers.TwoStageRandomDirectionRanker(seed=None)[source]¶
Similar to
ribs.emitters.rankers.RandomDirectionRanker
, but the solutions are first ranked by whether they are added, then by their projection onto a random direction in the archive space.This ranker originates from Fontaine 2020 as RandomDirectionEmitter.
Methods
rank
(emitter, archive, data, add_info)Ranks the solutions first by whether they are added, then by their projection onto a random direction in the archive.
reset
(emitter, archive)Generates a random direction in the archive's measure space.
Attributes
(measure_dim,)
array with the target measure direction vector.- rank(emitter, archive, data, add_info)[source]¶
Ranks the solutions first by whether they are added, then by their projection onto a random direction in the archive.
- 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]¶
Generates a random direction in the archive’s measure space.
A random direction is sampled from a standard Gaussian – since the standard Gaussian is isotropic, there is equal probability for any direction. The direction is then scaled to the archive bounds so that it is a random archive direction.
- 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.
- property target_measure_dir¶
(measure_dim,)
array with the target measure direction vector.- Type