Parametric-Task MAP-Elites

Use PT-ME when each task can be specified by a vector of continuous parameters. A geometry of task cells gives the search neighbors that can supply candidates for a new task. Here the two task coordinates determine the optimum of a two-variable objective.

from itertools import product
from qdpy.algorithms import parametric_task_map_elites

def evaluate(genome, task):
    a, b = task
    return 1 - ((genome[0] - a) ** 2 + (genome[1] - b) ** 2) / 2

result = parametric_task_map_elites(
    evaluate,
    genome_bounds=((0., 1.), (0., 1.)),
    task_bounds=((0., 1.), (0., 1.)),
    centroids=tuple(product((0.2, 0.5, 0.8), repeat=2)),
    budget=256,
    seed=11,
)

record = result.solution_for((0.35, 0.65))
print(record.genome, record.task, record.fitness)
finer = result.rebin(tuple(product((0.1, 0.3, 0.5, 0.7, 0.9), repeat=2)))

Supply centroids in physical task units. The evaluator receives genomes and tasks in those same declared units and returns one scalar to maximize. The native CVT grid stores normalized task descriptors in [0, 1]. Each elite keeps the task at which it was measured, which may differ from the centroid. Evaluate a retrieved genome on your actual query task for its new score. Rebinning uses all saved successful trials and makes zero evaluator calls.

After one evaluation at each center, PT-ME proposes continuously sampled tasks. Half its proposals use simulated binary crossover and a UCB1 tournament over potential tasks. The other half use a through-origin local linear fit of genomes against the measured tasks of occupied neighbors. A degenerate neighborhood falls back to crossover at the same sampled task. The first incumbent wins score ties. Use regression_probability=0 for the crossover-only ablation. Failed evaluations count against the budget and leave no measurement in the result.

python examples/parametric_task_map_elites.py --budget 1024 --seeds 11 29 47

All three methods covered the 16 cells on the analytic task family. Median regret on 36 held-out tasks was 0.0069 for PT-ME, 0.0109 for crossover-only PT-ME, and 0.0062 for fixed-task MAP-Elites. The comparison evaluates the nearest-cell solution at each held-out task. Its QD score is the sum of those 36 scores. Raw runs.

See Parametric-Task MAP-Elites and the authors’ implementation.