Bases: MAPElites
Core elements of the MAP-Elites Low-Spread algorithm.
Most methods in this class are inherited from MAPElites.
The same scoring function can be passed into both MAPElites and this class.
We have overridden init such that it takes in the scoring function and
wraps it such that every solution is evaluated num_samples times.
Source code in qdax/core/mels.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 | class MELS(MAPElites):
"""Core elements of the MAP-Elites Low-Spread algorithm.
Most methods in this class are inherited from MAPElites.
The same scoring function can be passed into both MAPElites and this class.
We have overridden __init__ such that it takes in the scoring function and
wraps it such that every solution is evaluated `num_samples` times.
"""
def __init__(
self,
scoring_function: Callable[
[Genotype, RNGKey], Tuple[Fitness, Descriptor, ExtraScores, RNGKey]
],
emitter: Emitter,
metrics_function: Callable[[MELSRepertoire], Metrics],
num_samples: int,
repertoire_init: Callable[
[Genotype, Fitness, Descriptor, Centroid, Optional[ExtraScores]],
MELSRepertoire,
] = MELSRepertoire.init,
) -> None:
self._scoring_function = partial(
multi_sample_scoring_function,
scoring_fn=scoring_function,
num_samples=num_samples,
)
self._emitter = emitter
self._metrics_function = metrics_function
self._num_samples = num_samples
self._repertoire_init = repertoire_init
|