Segment crossover in MAP-Elites¶
IsoLineCross varies a pair of parents with Iso+LineDD, then exchanges contiguous segments. The crossover is discrete even when the genes are real-valued. It can move a set of related genes together.
from qdpy.algorithms import IsoLineCrossMAPElites
from qdpy.containers import Grid
from qdpy.simple import run
grid = Grid(shape=(8,), fitness_domain=((0., 1.),),
features_domain=((0., 1.),))
search = IsoLineCrossMAPElites(grid, budget=128, dimension=6,
optimisation_task="maximisation")
def evaluate(genome):
descriptor = sum(genome[:3]) / 3
quality = 1 - sum((x - .7)**2 for x in genome[3:]) / 3
return (quality,), (descriptor,)
result = run(search, evaluate, seed=47)
print(result.evaluations, len(result.archive))
Put related genes next to each other in the genome. The operator
samples exponentially spaced breakpoints and scales them over the
genome. Repeated integer positions flip parental origin once per
breakpoint. Use line_sigma=0 for IsoCross, or
crossover_probability=0 for the Iso+LineDD ablation.
qdpy.tools.iso_line_cross supplies the operator for custom searches.