Chapter 3
Interactive algorithms
This chapter presents the evolutionary strategies of the package as variations of one ask–tell loop: what each strategy shows, which answers it can use, and how it turns them into the next gallery. It starts with the interactive genetic algorithm and the Blind Watchmaker, continues with the EASY-IEC evolution strategy and the continuous optimizers CMA-ES, PSO and differential evolution, and ends with strategies that seek diversity (MAP-Elites, novelty) or trade-offs (reference-point NSGA-II). Model-based strategies follow in chapter 4; their comparison with simulated users in chapter 10.
3.1 One loop, many strategies
Every strategy implements two methods. ask returns a query: a gallery for selection, ranking or rating, a set of duels, or the samples of a slider. tell receives the answer and updates the strategy’s state: a population, a search distribution, a swarm, an archive or a statistical model. A strategy declares the protocols it understands; the select protocol is the default, as in EASY-IEC. Strategies work in the unit cube (section 2.2) and see the problem only through its search space, so the same strategy evolves Julia sets, PID controllers and colour palettes. Two further hooks are shared: steer receives a direction in the unit cube from verbal steering (section 5.5) and biases the next offspring towards it, the bias decaying geometrically; and edits by the evaluator arrive as new individuals that the strategy treats like chosen ones (Lamarckian inheritance).
3.2 The interactive genetic algorithm and the Blind Watchmaker
The interactive genetic algorithm (IGA) is the workhorse of IEC [1]. The evaluator chooses (or ranks, rates, compares) the candidates; parents are drawn with probability proportional to their utility in plus a small floor, recombined by BLX- [28], simulated binary [29], arithmetic or uniform crossover, and mutated by a Gaussian step in the unit cube whose size is annealed from generation to generation. Chosen and explicitly kept candidates, and the best one in any case, survive unchanged, as in Picbreeder [12], so that a good design is never lost because of an unlucky offspring. A fraction of random immigrants can be added to keep the gallery varied.
Dawkins’ Blind Watchmaker [10] shows one parent surrounded by its mutants; the evaluator picks one, which becomes the next parent (Watchmaker). The package adapts the mutation step with a one-fifth-rule analogue: the step shrinks when the parent itself is chosen again — no mutant was better — and grows when a mutant wins. The scheme is intuitive and fast but greedy: the gallery soon consists of near-copies (fig. 3.1). NoveltyIEC counters this: it breeds a pool four times larger than the gallery and shows the candidates that are both close to the parents and far, in feature space, from everything shown so far — the novelty measure of Lehman and Stanley [30], used here as a filter rather than as the objective.
Open in ColabExample plot_07_watchmaker_novelty.py in the gallery
3.3 The EASY-IEC evolution strategy
EASY-IEC [2] is an evolution strategy in which the evaluator’s clicks define the selection. Each individual carries a genome and its own vector of step sizes (devi in the MATLAB toolbox), initialized to around an initial chromosome. A candidate clicked once becomes a parent; clicked twice it is also copied unchanged into the next gallery. The rest of the gallery consists of offspring: two parents are recombined intermediately (the mean of the genomes, the geometric mean of the step sizes), and the offspring is mutated by log-normal self-adaptation [31],
| (3.1) |
The step sizes are inherited with the genome, so they are selected together with it: when the evaluator keeps choosing similar candidates, offspring with small steps survive and the search contracts automatically; when the evaluator jumps to a distant candidate, large steps come back. InteractiveES generalizes the scheme to and selection with intermediate or discrete recombination; Breukelaar, Emmerich and Bäck studied this family with simulated users [13].
bench = run_benchmark( problems={"ellipsoid-6": lambda: SyntheticPreference(dim=6, kind="ellipsoid", seed=2)}, strategies={"EASY-IEC": lambda: EasyIEC(pop_size=9), "(+)-ES": lambda: InteractiveES(pop_size=9), "GA": lambda: InteractiveGA(pop_size=9)}, users={"user": lambda p, s: ei.SimulatedUser(p, target="random", noise=0.05, seed=s)}, seeds=range(10), generations=20) print(bench.summary.groupby("strategy")["best_true"].agg(["mean", "std"]).round(3))
3.4 CMA-ES, particle swarms and pairwise differential evolution
CMA-ES. The covariance matrix adaptation evolution strategy [32] samples a gallery from and updates the mean, the step size and the covariance from the ranks of the candidates only. This makes it a natural interactive optimizer: a ranking, or even a selection, is all it needs. InteractiveCMAES implements the standard update equations of the tutorial with weighted recombination of the better half, cumulative step-size adaptation and rank-one and rank- covariance updates; the order of the candidates comes from Feedback.order, so it runs with every protocol. After a few generations the covariance has learned the correlations between genes that the evaluator’s choices reveal (fig. 3.3).
Interactive PSO. Madár, Abonyi and Szeifert [3] replaced the fitness of particle swarm optimization [33] by the evaluator: the particle chosen in a generation becomes the global best, chosen particles update their personal bests, and the velocities follow the constriction form
| (3.2) |
with and [34], velocity clipping and reflection at the cube’s faces.
Pairwise differential evolution. Differential evolution [35] builds a trial vector for every member of the population from the scaled difference of two others (, binomial crossover with ) and keeps whichever of trial and target is better. The selection step is a single question — is the trial better than its parent? — so InteractiveDE asks it as a duel. A query contains several duels side by side, which suits AI judges and the escalation of section 5.6, where a duel is the natural unit of disagreement.
3.5 Diversity: interactive MAP-Elites
Designers often want a repertoire of good, different solutions rather than one winner. MAP-Elites [36] divides a two-dimensional behaviour space into cells and keeps the best individual found in each. InteractiveMAPElites uses two phenotype features as behaviour descriptors (for images, by default, the entropy and the colourfulness) and asks the evaluator only where a decision is needed: a newcomer that falls into an empty cell is stored without a question; a newcomer that falls into an occupied cell is shown in a duel with the incumbent elite, and the winner keeps the cell. A gallery of elites is shown now and then for parent selection. The effort thus concentrates on contested niches, and the archive offers a map of the possible rather than a single answer (fig. 3.4).
3.6 Trade-offs: reference-point NSGA-II
Engineering problems often have several computable objectives — integral error, overshoot, control effort, settling time — whose trade-off only the engineer can settle. InteractiveNSGA2 combines Pareto-based evolution with interaction. Between two queries, a silent population of 40 individuals evolves for five generations under non-dominated sorting and crowding [37]; then a gallery of representatives of the first front is shown, and the chosen candidates act as reference points: their normalized objective vectors bias the crowding distance of the next silent phase towards the chosen region of the front [38]. The evaluator never sees a Pareto front, only step responses, yet the population concentrates on the part of the front that matches the evaluator’s taste (fig. 3.5).
strategy = InteractiveNSGA2(pop_size=8, inner_size=40, inner_generations=5) user = ei.SimulatedUser(problem, target="default", noise=0.05, seed=1) result = ei.run(problem, strategy, user, generations=10, seed=1) print(problem.describe(result.best.genome))
Open in ColabExample plot_05_nsga2_reference.py in the gallery
In a nutshell: Interactive algorithms
- All strategies share the ask–tell loop, the unit cube, steering and Lamarckian edits; each declares the protocols it understands.
- The interactive GA and the Watchmaker are simple and greedy; NoveltyIEC keeps galleries varied.
- EASY-IEC is a self-adaptive evolution strategy: step sizes are selected with the genomes, so the search contracts and expands with the evaluator’s choices.
- CMA-ES needs only ranks; the interactive PSO turns choices into personal and global bests; DE asks one duel per trial vector.
- Interactive MAP-Elites asks only about contested niches; reference-point NSGA-II lets choices steer a silent Pareto search.