Evolutionary Computation Meets Machine Learning for Combinatorial Optimisation: An Interactive Tutorial
Delivery routes, factory schedules, cloud resource allocation: many of the hardest decisions in industry are combinatorial optimisation problems. For decades they were tackled with hand-designed algorithms. Today, evolutionary computation (EC) and machine learning (ML) increasingly work together: evolution can learn new heuristics, and learning can make evolutionary and other search methods smarter. This tutorial is a gentle, hands-on introduction for newcomers to all three fields. Every demo runs real computations in your browser, and every demo has a Show Python code button with a complete program you can copy and run.
1. Introduction
1.1 Combinatorial optimisation in a nutshell
A combinatorial optimisation problem (COP) asks for the best choice among a finite but astronomically large set of possibilities. The classic example is the travelling salesman problem (TSP): visit every city once and return home, travelling the shortest total distance. Variants of it, and its cousins, appear everywhere: vehicle routing in logistics, scheduling in manufacturing and cloud computing, cutting and packing, and sequence analysis in bioinformatics.
Most interesting COPs are NP-hard: no known algorithm solves every instance quickly, and the number of candidate solutions explodes. Three families of methods are used:
- Exact methods (branch and bound, dynamic programming, integer programming) guarantee optimality but can take exponential time.
- Constructive heuristics build one solution step by step with a simple rule, such as go to the nearest unvisited city. They are fast, but rarely optimal.
- Metaheuristics (local search, evolutionary algorithms, ant colony optimisation…) improve solutions iteratively and give good solutions in reasonable time, without guarantees.
How to use this demo
- Pick an instance. The Cities slider sets the number of cities (6 to 12); New instance draws new random cities.
- Build your own tour. Click the cities on the map one at a time, starting from city 0 (highlighted). After the last city the tour closes itself and its length appears in the table. Press Build my own tour to start again.
- Compare with algorithms. Press Nearest neighbour, + 2-opt local search and Optimal tour. Each one draws its tour on the map, explains how it works in the box, and adds its length and its gap to the optimal tour to the table.
- Count the tours. The note under the table shows how many different tours exist for this number of cities.
Click the cities in order, starting from city 0 (highlighted), to build your own tour.
Tour length of each method and its gap to the optimal tour (– = not run yet).
1.2 Learning meets optimisation
The machine learning boom has reached combinatorial optimisation too. But the idea of learning while searching is not new: many classical metaheuristics already adapt themselves to the problem at hand.
Mutation strengths are encoded in each individual and evolve along with the solution.
The tabu tenure grows when the search revisits solutions and shrinks otherwise.
Penalties on solution features (such as long edges) are learned to escape local optima.
Destroy and repair operators are chosen with probabilities that follow their past success.
Methods that select or generate heuristics, rather than solutions.
Pheromone trails accumulate a memory of good solution components.
Ant colony optimisation (ACO) is a good first example of learning inside search. Artificial ants build tours city by city, preferring short edges (heuristic information, weighted by β) and edges with strong pheromone (learned experience, weighted by α). After each iteration, pheromone evaporates everywhere (rate ρ) and is reinforced on the edges of good tours. Over time, the colony "learns" which edges belong in good solutions.
How to use this demo
- Set the parameters before you run: α (how strongly ants follow pheromone), β (how strongly they prefer short edges) and ρ (how fast pheromone evaporates). Changes take effect at the next run.
- Press Run 100 iterations (press it again to stop). In each iteration, 20 ants build tours and the pheromone is updated.
- Map: amber lines show the pheromone (thicker means more); the dark line is the best tour so far.
- Chart: the best tour so far, the best tour of each iteration, and the nearest-neighbour tour (dashed) for reference. The text above the chart gives the numbers.
- New instance draws 30 new cities.
Caveat: averaged over 20 runs on each of three 30-city instances, the full ACO reached 0.88 of the nearest-neighbour tour length, versus 0.96 with α = 0 and 1.08 with β = 0. These numbers come from a simple ACO variant, a few instances and fixed parameters; other variants (such as MAX–MIN Ant System) and settings behave differently.
Reinforcement learning (RL), a branch of ML, makes this idea explicit. An agent interacts with an environment: in each state it takes an action, receives a reward and moves to a new state, a Markov decision process. It learns a policy that maximises the total reward. Building a TSP tour city by city is exactly such a sequence of decisions, which is why RL appears throughout this tutorial.
Surveys to go deeper
- Bengio, Lodi & Prouvost (2021). Machine learning for combinatorial optimization: a methodological tour d'horizon. EJOR.
- Talbi (2021). Machine learning into metaheuristics: a survey and taxonomy. ACM Computing Surveys.
- Karimi-Mamaghan et al. (2022). Machine learning at the service of meta-heuristics for solving combinatorial optimization problems: a state-of-the-art. EJOR.
- Mazyavkina et al. (2021). Reinforcement learning for combinatorial optimization: a survey. Computers & Operations Research.
- Zhang, Mei, Nguyen & Zhang (2024). Survey on genetic programming and machine learning techniques for heuristic design in job shop scheduling. IEEE TEVC.
- Liu et al. (2024). A systematic survey on large language models for algorithm design. arXiv.
1.3 How this tutorial is organised
The tutorial follows two complementary directions, each with its own family of sections. In the first, EC is the learner: it learns heuristics that solve combinatorial optimisation problems. In the second, ML is the helper: it makes EC solvers better.
EC for learning CO heuristicsEvolution searches a space of heuristics, both constructive (build a solution step by step) and improvement (repeatedly change a solution), and keeps those that work best on training instances.
2 GP learns a construction heuristicGP evolves the rule that picks the next city when building a tour, and the design choices that make this work.Demo 3 3 LLMs as evolutionary operatorsLarge language models write and modify heuristic code inside an evolutionary loop.Demo 4 4 GP learns an improvement heuristicGP evolves the utility function that tells guided local search which edge to penalise next.Demo 5ML for improving EC solvers for COEC solvers are mostly improvement (search) heuristics that refine solutions over many iterations. ML helps them choose how to search.
5 ML selects, composes and configures EC solversAt the algorithm level: which algorithm, which operators and which parameter values, learned offline or during a run.Demo 6 6 ML guides the search inside EC solversInside a run: learned models tell the solver which components look promising, which part of a solution to change, and which new solutions to try.Demo 7Section 7 then looks beyond EC, at end-to-end neural solvers and learning inside tree search and exact solvers, the main alternatives to compare against. Section 8 sums up the open challenges, and Section 9 checks your understanding. Demos 1 and 2 above (TSP and ant colony optimisation) give the background for all of them.
2. Genetic Programming Learns a Construction Heuristic
Learning for combinatorial optimisation can target two things: learning to construct (good initial) solutions, and learning to search the solution space (to improve solutions). It can use two kinds of signal: supervised learning imitates optimal solutions or decisions collected on training instances, which requires solving them first; reinforcement learning needs no solutions, only a way to score the solutions the learned policy produces. Neural networks trained in these ways are discussed in Section 7.
EC offers a third route, which has much in common with RL but searches over programs instead of network weights. To use EC to learn a heuristic, we must:
- Define a space of heuristics: a framework (an algorithm template that takes an instance and returns a solution) with one or more components left open, and a representation for those components (for example, GP trees built from problem features).
- Define how to evaluate a heuristic: training instances and a performance measure (solution quality, run time, interpretability…). The evaluation is a black box: noisy, non-differentiable and discrete.
- Search the space with EC, which handles black-box, non-differentiable and multi-objective problems naturally.
EC can learn both constructive and improvement heuristics. Two examples from the GECCO tutorial, one of each kind:
- Constructing TSP tours. The framework starts with an empty tour and repeatedly appends an unvisited city until all are visited. The learned component decides which city next, as in the RL approach S2V-DQN [Dai et al., 2017, NeurIPS].
- Guided local search for large vehicle routing problems. The framework is guided local search, which repeatedly penalises the edge with the highest utility to escape local optima; GP learns the utility function in GPGLS [Liu et al., 2024, PPSN], extended with adaptive curriculum learning [Liu et al., 2026, EvoStar, Best Student Paper]. Section 4 builds a small version of this idea for the TSP.
2.1 Example: GP learns a TSP construction heuristic
Genetic programming (GP) is the main EC technique for this. It evolves computer programs, usually represented as trees whose leaves are terminals (features and constants) and internal nodes are functions (+, −, ×, max…), using selection, subtree crossover and subtree mutation. (New to GP? See the Genetic Programming tutorial; for a full example on dynamic scheduling, see the GP for Job Shop Scheduling tutorial.)
Let's make the TSP example real. The framework builds a tour from city 0. At each step it computes a priority for every unvisited city using five features, and moves to the city with the smallest priority:
- D
- distance from the current city to the candidate
- DS
- distance from the candidate back to the start
- NN
- distance from the candidate to its nearest other unvisited city
- AVG
- average distance from the candidate to the other unvisited cities
- R
- fraction of cities still unvisited
- + − × ÷
- arithmetic (protected ÷: dividing by zero returns 1)
- max, min
- conditional choices: the larger or smaller of two values
Fitness: how good is a heuristic?
In most evolutionary algorithms, each individual is a solution, such as one tour, and its fitness is simply its length. In a GP hyper-heuristic, each individual is a rule for building solutions. A rule has no length of its own: to find out how good it is, we have to use it and look at the tours it builds, just as a chess strategy is judged by the games it wins. GP evaluates each candidate tree in four steps, shown below with a running example: the tree priority = D − AVG. It likes cities that are close (small D), but subtracts their average distance to the other unvisited cities (AVG), so a city far from all the others gets a lower, better priority.
Step 1 Plug it in
Put the tree into the priority slot of the framework. Together they form a complete construction heuristic: at each step, compute the tree's priority for every unvisited city and move to the smallest.
Example. On training instance 2, the tour has gone 0 → 11 → 10 and must choose the next city. Two candidates are closest:
- City 12: D = 0.13, AVG = 0.48, priority = −0.35. It is the closest, so nearest neighbour goes here.
- City 16: D = 0.15, AVG = 0.59, priority = −0.43. Slightly further, but far from the other unvisited cities (the long grey lines), so its priority is smaller and
D − AVGgoes here.
Picking up this outlying city now avoids a long detour to fetch it later.
D − AVG (black dashes). Grey lines: the distances AVG averages for city 16.Step 2 Run it
Build one tour with the heuristic on each of the 10 training instances (30 random cities each), making a decision like the one above at each of the 29 steps. The same 10 instances are used for every tree, so that the comparison is fair.
Example. On training instance 6 (right), nearest neighbour keeps grabbing the closest city, leaves outlying cities behind, and at the end has to fetch them with long jumps across the map: look for the long coral edges that cross the tour. D − AVG clears outlying cities on the way, so its tour has no such jumps.
D − AVG. Ratio = 4.36 ÷ 5.79 = 0.75.Step 3 Normalise
Divide each tour length by the length of the nearest-neighbour tour on the same instance. A ratio of 0.9 means a tour 10% shorter than nearest neighbour's; 1.1 means 10% longer.
Example. On instance 6, the ratio is 4.36 ÷ 5.79 = 0.75. Over all 10 training instances (right), D − AVG wins on 7 (bars below 1) and loses on 3 (bars above 1).
D − AVG ÷ nearest neighbour's on each training instance. Teal: shorter than nearest neighbour; coral: longer.Step 4 Average
The fitness is the average of the ratios over the training instances. Lower is better, and 1 means "as good as nearest neighbour".
Example. The average of the 10 ratios (the solid line in Step 3's chart) is 0.931: the tours of D − AVG are about 7% shorter than nearest neighbour's on average. Averaging matters: judged on instance 3 alone, the tree would look 12% worse than nearest neighbour.
GP computes a fitness like this for every tree in the population, and selection prefers lower values (right). D is nearest neighbour itself, so its fitness is exactly 1; D + DS prefers cities near the start and heads home too early.
Why divide by nearest neighbour? Some instances naturally need longer tours than others: for example, nearest neighbour's tour is 6.26 long on training instance 10 but only 4.85 on instance 4. If we averaged raw lengths, the long instances would dominate the fitness. Ratios put every instance on the same scale, and give the fitness a clear meaning.
Training is not testing. The fitness only measures performance on the training instances, which GP sees again and again, so a tree can fit them better than it deserves. After evolution, the best tree is therefore tested on unseen instances, including larger ones, to check that it generalises (Stage 2 of Demo 3). Fitness evaluation is also where the time goes: with the defaults (population 50, 20 generations), GP builds up to 50 × 21 × 10 ≈ 10,000 tours in one run.
Putting these pieces together, one GP run looks like this:
Nearest neighbour itself is the heuristic priority = D. Can evolution find something better?
How to use this demo
- Stage 1 · Training. Choose the building blocks: tick the terminals (hover over each one to see what it means) and the functions that GP may use.
- Set the GP hyper-parameters with the sliders, or keep the defaults (Default settings restores them).
- Press Evolve (press it again to stop). After each generation, the chart shows the best training ratio (tour length divided by nearest neighbour's; below the dashed line at 1 is better), and the best heuristic is shown as a formula and as a tree.
- Stage 2 · Deployment. When evolution ends, the box in Stage 2 reports how the heuristic does on unseen 30- and 100-city instances, and the two maps compare its tour with nearest neighbour's on one 100-city instance.
- Watch your heuristic build a tour step by step in the panel at the bottom. It shows the best heuristic when evolution ends, or when you press Stop, and builds a tour with it and with nearest neighbour on the same unseen 30-city instance.
- Next step ▶ or ▶ Play adds one city at a time to both tours; ◀ Back undoes a step, and Restart goes back to city 0.
- First disagreement jumps to the first step where the two rules choose different cities.
- Next instance moves to another of the 20 unseen instances.
- On each map the dashed line is the next move. On the right map, a dotted line marks the closest city whenever your heuristic skips it.
- The table lists the feature values and scores of the best candidate cities. The box above it explains which features made your heuristic prefer a city that is further away.
Stage 1 · Training GP evolves a heuristic on the training instances
GP sees only the training instances (30 cities each). Fitness is the mean tour length on them, divided by nearest neighbour's.
The rest of the offspring are copied unchanged (reproduction): if crossover + mutation exceeds 1, mutation is reduced to fit. Bigger populations, more generations and more training instances take longer.
Press Evolve: with the default settings (population 50, 20 generations, 10 training instances) a run takes about one second.
The formula is GP's best heuristic so far, redrawn after every generation. In the tree, leaves are terminals (features or constants) and each inner node applies its function to its two children.
Stage 2 · Deployment The evolved heuristic is used on unseen instances
The heuristic is now fixed: no more evolution. It is applied to new instances it never saw in training, including larger ones, and compared with nearest neighbour.
When evolution finishes, the best heuristic is tested on unseen instances, including larger ones than it was trained on.
Both tours are built on the same unseen 100-city instance, larger than the 30-city training instances.
Step by step: nearest neighbour vs your evolved heuristic
Both heuristics start at city 0 and repeatedly move to the unvisited city with the smallest score. Nearest neighbour scores a city only by its distance D from the current city. Your evolved heuristic combines D with the other features: DS (distance back to city 0), NN (distance to the nearest other unvisited city), AVG (average distance to the other unvisited cities) and R (the fraction of cities still unvisited). Step through and look for the moments where it does not take the closest city, and for what that choice saves later.
Your evolved heuristic: the evolved heuristic
- Training instances = 1: the heuristic is tuned to a single instance and often does no better than nearest neighbour on unseen ones (overfitting). With 20, the training and test ratios move closer.
- Population size = 10: too little diversity; evolution often stalls at nearest neighbour itself.
- Maximum depth = 2: only tiny formulas are allowed, so the best heuristics cannot be expressed.
- Tournament size (selection pressure) and the crossover/mutation balance: their effect is small in a run this short. Can you see one?
- Untick
D: without the most basic feature, evolution struggles. - Function set: keep only
+and−, or onlymaxandmin. Which functions do good heuristics need? Smaller function sets also give shorter, more readable trees.
Caveat: the hyper-parameter effects above are averages over six runs per setting on unseen 30-city instances (ratio 0.93 with the defaults; 1.03 with one training instance, 0.99 with population 10, 0.95 with depth 2); single runs vary a lot. With the default settings, in four of our runs, the evolved heuristics were 4–10% shorter than nearest neighbour on unseen 30-city instances, and three of the four were also 4–5% shorter on 100-city instances, while one was 1% longer. These are small, uniformly random instances, a short GP run and a simple framework; such results may not hold for other instance types or sizes. Constructive heuristics are also usually followed by local search in practice.
2.2 Design questions
Demo 3 fixed many design choices for you: the framework, the features, the training instances and the selection method. The GECCO tutorial organises these choices into four groups of questions, discussed in turn below.
Which framework? Which terminals and functions? Which model structure? Which grammar?
Which training instances? Which performance measures? How to make evaluation cheaper (surrogates)?
How to select parents? How to design or adapt the genetic operators?
How to learn for many related problems (multitask) and reuse knowledge (transfer)?
Representation
The framework is usually designed from intuition and domain knowledge: take an existing algorithm, identify the component(s) to learn, and parametrise them. In flexible job shop scheduling, for example, each operation can be processed by several machines, so two decisions are needed: routing (which machine) and sequencing (which operation next). The same rules can behave very differently in different frameworks.
Representation: strategies for the framework, the terminals, the model structure and the grammar.
| Question | Strategy | How it works |
|---|---|---|
| Framework | Non-delay framework | Routes an operation to a machine as soon as the operation is ready. [Yska et al., 2018, EuroGP] |
| Delayed routing | Waits until a candidate machine is idle, so routing decisions use more up-to-date information. [Xu et al., 2021, Evolutionary Computation] | |
| Terminals | Feature selection | Including every feature that might matter makes the search space huge. Important features are those used by many different good heuristics: collect a diverse set of good heuristics in a single GP run with niching and surrogate evaluation, measure each terminal's contribution, and keep the terminals with high aggregated importance. [Mei et al., 2016, GECCO; Mei et al., 2017, IEEE TETCI] |
| Model structure | Tree GP | Abstract syntax trees, as in Demo 3: the most common structure. |
| Linear GP | Sequences of register instructions, which represent directed acyclic graphs and make it easy to reuse building blocks. | |
| Cross-representation GP | Evolves tree and linear representations together. [Huang et al., 2025, Evolutionary Computation] | |
| Multi-tree GP | Each individual holds several cooperating rules, for example one for routing and one for sequencing. | |
| Ensembles | Several rules vote on each decision. [Xu et al., 2024, IEEE TEVC] | |
| Grammar | Grammar-guided GP | Restricts how features may be combined: a smaller search space and more interpretable rules, at the risk of disconnecting the space and losing effectiveness. [Nguyen et al., 2013, IEEE TEVC] |
| Units-based type systems | Only combine features whose physical units match, so that rules stay meaningful; see the Explainable AI by GP tutorial. |
Evaluation
Fitness evaluation, usually by simulation on training instances, dominates the cost of GP. The strategies below choose what to evaluate on, what to measure and how to evaluate more cheaply.
Evaluation: strategies for the training instances, the performance measures and cheaper evaluation with surrogate models.
| Question | Strategy | How it works |
|---|---|---|
| Training instances | Instance rotation | Uses a different subset of training instances in each generation, like mini-batches in ML: a wide range of instances for generalisation without evaluating on all of them every time. [Hildebrandt et al., 2010, GECCO] |
| Active sampling | Picks the most informative instances: those that best distinguish good from bad heuristics, or that are not yet solved well. [Karunakaran et al., 2019, IEEE CEC] | |
| Co-evolving instances | Evolves the training instances together with the solvers. [Tang et al., 2021, IEEE TEVC] | |
| Performance measures | Average normalised quality | The usual measure of effectiveness, averaged over the training instances. Iterative frameworks need a stopping point during evaluation (a trade-off between accuracy and cost), and stochastic heuristics need several runs. |
| Multi-objective GP | Adds model size, a proxy for interpretability, as a second objective. The population easily collapses to small but poor rules; α-dominance, adapted during the search, controls this balance (shown for arc routing). [Wang et al., 2023, IEEE TEVC] | |
| Surrogate models | Simplified models | Smaller, faster instances that remain correlated with the real ones. [Nguyen et al., 2017, IEEE Transactions on Cybernetics] |
| Phenotypic characterisation | Describes a rule by its behaviour on a fixed set of decision situations, then predicts its fitness from similar rules already evaluated. With brood recombination, many offspring are generated and only those with the best predicted fitness are fully evaluated. [Hildebrandt & Branke, 2015, Evolutionary Computation] | |
| Multi-fidelity surrogates | Several sub-populations use surrogates of different fidelity and share parents; the highest-fidelity one produces the final rule. [Zhang et al., 2022, IEEE Transactions on Cybernetics] |
The GP for Job Shop Scheduling tutorial has a demo of how training instances affect generalisation.
Search
Search: strategies for selecting parents and for designing the genetic operators.
| Question | Strategy | How it works |
|---|---|---|
| Parent selection | Tournament selection | Compares individuals by one aggregated fitness, as in Demo 3. |
| Lexicase selection | Considers the training cases (here, instances) one at a time in random order, keeping only the individuals that are best on each case until one remains. It favours specialists that excel on some instances, which maintains diversity. [Helmuth et al., 2015, IEEE TEVC] It has been applied to large-scale dynamic flexible job shop scheduling. [Xu et al., 2024, IEEE TEVC] | |
| Genetic operators | Adaptive mutation | Samples terminals more often if they occur in better individuals. [Riley et al., 2016, IEEE CEC] |
| Recombinative guidance | Replaces the subtrees that contribute less to an individual's behaviour, measured by correlation. [Zhang et al., 2021, IEEE TEVC] |
Generality and beyond
A single heuristic is rarely best for all scenarios, but learning a specialist for every scenario is too costly. Two strategies share what is learned across scenarios:
Generality: strategies for learning heuristics for many related scenarios.
| Question | Strategy | How it works |
|---|---|---|
| Many scenarios at once | Surrogate-assisted multitask GP | Learns heuristics for several scenarios at once, with sub-populations that exchange material through crossover or migration; surrogate models assess the offspring cheaply. [Zhang et al., 2021, IEEE TEVC] |
| Task-relatedness-based multitask GP | Measures how related the scenarios are, so that each one shares material mainly with related scenarios. [Zhang et al., 2023, IEEE TEVC] | |
| Reusing earlier tasks | Transfer learning | Reuses knowledge from earlier tasks. It decides what to transfer (subtrees, feature importance), when (at initialisation or during breeding) and how (directly, or by adjusting probabilities), while avoiding negative transfer. [Mei et al., 2021, book chapter in Automated Design of Machine Learning and Search Algorithms; Ardeh et al., 2022, IEEE TEVC] |
3. Large Language Models as Evolutionary Operators
Since 2023, a new kind of heuristic learner has emerged: instead of GP's random subtree operators, a large language model (LLM) writes and modifies the code of heuristics inside an evolutionary loop. The LLM brings prior knowledge from the code and text it was trained on; evolution provides selection pressure through an automatic evaluator.
Representative LLM-driven methods for designing heuristics and algorithms.
| Approach | Method | How it works |
|---|---|---|
| Evolving heuristics | FunSearch | Evolves programs with an LLM and an evaluator; found new constructions for the cap set problem and better heuristics for online bin packing. [Romera-Paredes et al., 2024, Nature] |
| Evolution of Heuristics (EoH) | Evolves both natural-language "thoughts" and code, designing heuristics for problems such as TSP and bin packing with far fewer LLM queries. [Liu et al., 2024, ICML] | |
| ReEvo | Adds short- and long-term reflection: the LLM compares better and worse heuristics and writes "verbal gradients" that guide the next generation; applied as a language hyper-heuristic to many problems and solvers, including ACO and guided local search. [Ye et al., 2024, NeurIPS] | |
| MCTS-AHD | Replaces the population with a Monte Carlo search tree over all generated heuristics, so that temporarily poor ideas are not discarded too early. [Zheng et al., 2025, ICML] | |
| Evolving whole algorithms | LLaMEA | Generates complete metaheuristics, benchmarked on continuous black-box optimisation. [van Stein & Bäck, 2025, IEEE TEVC] |
| AlphaEvolve | An autonomous coding agent that improves whole code bases against automated evaluators, reporting new results in mathematics and computing infrastructure. [Novikov et al., 2025, arXiv] | |
| LLM as the optimiser | Optimisation by prompting | The LLM proposes solutions directly from a prompt that lists previous solutions and their scores; works best for small problems. [Yang et al., 2024, ICLR] |
Genetic programming and LLM-driven evolution compared as ways to design heuristics.
| Genetic programming | LLM-driven evolution | |
|---|---|---|
| Search space | Expressions from chosen terminals and functions | Arbitrary code, including loops and data structures |
| Variation | Random subtree crossover and mutation | Prompts to an LLM to improve, combine or rewrite programs |
| Domain knowledge | Built in through the terminal set and framework | Comes from the LLM's training data and the prompts |
| Cost per offspring | Microseconds to create; evaluation dominates | An LLM call (seconds and money); evaluation still needed |
| Interpretability | Small formulas, readable if kept small | Readable code, but can be long and hard to verify |
| Main risks | Bloat, overfitting to training instances | Cost, reproducibility, evaluation leakage, overfitting |
The two are complementary rather than competing: GP is cheap, controllable and well understood; LLMs can propose richer algorithmic ideas. Hybrids are appearing, for example using LLMs to explain GP-evolved scheduling heuristics [Xu et al., 2025, arXiv]. For a broad review, see the survey [Liu et al., 2024] listed in Section 1.2.
To see the loop in action, Demo 4 evolves the same kind of TSP construction heuristic as Demo 3, but as code written by a (simulated) LLM. The operators follow Evolution of Heuristics (EoH): explore a new idea, combine two parents, modify one parent, or tune its parameters.
No real LLM runs in your browser. A small simulator plays the LLM: it answers each prompt by writing a new idea and code, drawing on a fixed set of ideas an LLM might suggest, and it sometimes writes buggy code, as real LLMs do. Everything else is real: the prompts, the code evaluation on 10 training instances and the survivor selection. The Python code can call a real LLM instead.
How to use this demo
- Set the population size and how often the simulated LLM writes buggy code. Changing either one restarts the run.
- Press Next LLM call to run one step of the loop. The four numbered boxes on the left show it in order: the operator and parents chosen, the exact prompt, the LLM's reply (an idea and its code), and what happened when the code was evaluated.
- On the right, the table lists the current population, best first (hover over a row to see its code), and the chart tracks the best score against the number of LLM calls. The box below tests the best heuristic on unseen instances.
- Run 20 calls plays 20 steps automatically (press it again to stop); Restart starts a new run.
- Select parents and an operator
Press Next LLM call. The first calls ask the LLM for initial heuristics; nearest neighbour (
score = dist) is already in the population. - Prompt sent to the LLM
…
- LLM response
…
- Evaluate and select survivors
…
The population, best first. Score = tour length ÷ nearest neighbour's on the training instances (lower is better). The newest heuristic is highlighted; hover over a row to see its code.
After a few calls, the best heuristic is also tested on unseen instances.
- the LLM sees the parents' ideas, code and scores, and its edits are meaningful ("pick up isolated cities"), not random subtree swaps;
- ideas that sound sensible can still score worse than nearest neighbour ("head home near the end" does), so the evaluator, not the LLM, decides what survives;
- some responses crash or duplicate an existing heuristic: each still costs an LLM call. Raise the buggy-code rate to see how much budget is wasted.
Caveat: this is a teaching simulator, not a benchmark. How often it proposes each idea, and how often it writes buggy code, are our own choices, so its results (in our 20 runs, the best training score averaged 0.94 after 10 calls and 0.92 after 40, close to Demo 3's GP) say nothing about how well a real LLM would do. Real LLMs can propose ideas outside any fixed list, which is their main attraction, but also cost far more per offspring than GP.
4. Genetic Programming Learns an Improvement Heuristic
Sections 2 and 3 learned constructive heuristics, which build one solution step by step. Many of the strongest solvers are improvement heuristics instead: they start from a complete solution and keep changing it. This section shows that GP can learn the key component of a classic improvement metaheuristic, guided local search, with exactly the same recipe as Section 2.
4.1 Guided local search in a nutshell
Local search, such as 2-opt in Demo 1, stops at a local optimum: no single move improves the tour, although better tours exist. Guided local search (GLS) escapes by changing the landscape instead of the moves [Voudouris & Tsang, 1999, EJOR]:
- Every solution feature, here every edge, has a penalty P, initially 0.
- At a local optimum, compute the utility of penalising each edge in the tour. The classic utility is C / (1 + P): long edges are suspicious, but an edge that has already been penalised often deserves a rest.
- Penalise the edge with the highest utility: its P grows by 1.
- Run local search again on the augmented cost, the tour length plus λ times the penalties of the tour's edges. Penalised edges now look longer, so the search moves away from them. Keep the best real tour seen, and repeat.
The utility function decides where the search goes next, yet the classic one is a one-line formula designed by hand. Better choices exist:
Ways to design the GLS utility function, from hand-designed to learned.
| Design | Approach | How it works |
|---|---|---|
| Hand-designed | Classic utility | C / (1 + P): penalise long edges that have not been penalised often. [Voudouris & Tsang, 1999, EJOR] |
| Knowledge-guided local search | Penalises vehicle routing edges using problem-specific features such as their "width". [Arnold & Sörensen, 2019, Computers & Operations Research] | |
| Learned by GP | GPGLS | GP learns the utility function for large-scale vehicle routing. [Liu et al., 2024, PPSN] |
| Adaptive curriculum learning | Trains GPGLS on gradually larger instances, making training on large instances affordable. [Liu et al., 2026] |
4.2 Example: GP learns the GLS utility function for the TSP
The recipe is the same as in Section 2, with a different framework and slot:
- Framework: GLS with 2-opt, starting from the 2-opt local optimum of the nearest-neighbour tour, with 40 penalties and λ = 0.3 × (local optimum length ÷ number of cities).
- Slot: the utility function. GP builds it from three features of an edge in the current tour,
C,PandR(see the figure), and the constant1. - Fitness: on each training instance (40 cities), divide the best GLS tour by the local optimum it started from, and average. Lower is better. The classic utility scores about 0.97: GLS shortens the 2-opt tours by about 3%.
How to use this demo
- Stage 1 · Training. Choose the instance type: 40 cities in clusters, or spread uniformly. If you like, untick terminals (hover over each one to see what it means) or functions.
- Set the population size, the number of generations and the number of training instances, or keep the defaults (Default settings restores them).
- Press Evolve (press it again to stop); a run takes a few seconds. After each generation, the chart shows the best training ratio (the best GLS tour divided by the 2-opt local optimum it started from; lower is better), and the dashed line shows the classic utility C / (1 + P). The best utility is shown as a formula above the chart and as a tree beside it.
- Stage 2 · Deployment. When evolution ends, the table compares the evolved and classic utilities on unseen instances (the better value is in bold), and two charts show how GLS converges with each utility, averaged over the unseen 40- and 80-city instances. The two maps and the small chart show both GLS runs on one unseen 80-city instance: which edges each utility penalised, and how the best tour improved with each penalty.
Stage 1 · Training GP evolves a utility function on the training instances
GP sees only the training instances (40 cities each, of the chosen type). Fitness is the mean ratio of the best GLS tour to the 2-opt local optimum it started from.
Press Evolve: with the default settings a run takes a few seconds.
The formula is GP's best utility function so far, redrawn after every generation. In the tree, leaves are terminals (features or constants) and each inner node applies its function to its two children.
Stage 2 · Deployment GLS with the evolved utility is used on unseen instances
The utility function is now fixed: no more evolution. GLS uses it on new instances it never saw in training, including larger 80-city ones, and is compared with GLS using the classic utility C / (1 + P).
Mean ratio on unseen instances of the chosen type, classic vs evolved utility (lower is better; the better one in bold).
When evolution finishes, the best utility function is tested on unseen instances.
Convergence on all unseen instances: after each penalty, the best tour so far ÷ the 2-opt local optimum, averaged over the instances (lower is better).
A closer look at one unseen 80-city instance: the edges each utility chose to penalise, and how the best tour improved.
On both maps, the orange edges are the ones GLS penalised; thicker means penalised more often (same scale on both maps). Both runs start from the same 2-opt local optimum and apply 40 penalties.
- Read the formula. Many evolved utilities subtract a multiple of
P, so the same edge is not penalised over and over, and many useR, which the classic utility ignores. - Untick
R: GP now has the same information as the classic utility. Can it still beat it? - Training instances = 1: the utility fits one instance and does worse on unseen ones.
- Switch to uniform instances and compare with clustered ones: which instance type leaves more room for a learned utility?
Caveat: in eight runs per instance type with the default settings, the evolved utilities were on average about as good as the classic one on unseen 40-city instances (ratio 0.971 vs 0.972 on clustered instances, 0.970 vs 0.971 on uniform ones). On the larger 80-city instances, all eight evolved utilities beat the classic one on clustered instances (0.971 vs 0.978 on average), and six of eight did on uniform ones. With one training instance the average on unseen clustered instances was 0.980; without R, 0.973; a random utility gave 0.990. These are small instances, a budget of 40 penalties and short GP runs; GPGLS reports its gains on large vehicle routing instances with much larger budgets.
5. Machine Learning Selects, Composes and Configures EC Solvers
The second family turns the direction around: ML helps EC solvers. Most EC solvers for combinatorial optimisation, such as genetic and memetic algorithms, ant colony optimisation and large neighbourhood search, are improvement (search) heuristics: they refine solutions over many iterations, and every run involves many choices. ML can help at two levels: the algorithm level, covered here, and inside the search, covered in Section 6.
At the algorithm level, learning supports three design decisions. Learning can happen offline (before solving, from many training instances), online (while solving one instance), or both, with supervised, reinforcement or unsupervised learning:
Algorithm-level decisions that learning supports, with representative strategies. Offline: learned before solving, from training instances. Online: learned while solving one instance.
| Decision | Strategy | When learned | How it works |
|---|---|---|---|
| Algorithm selection Which algorithm for this instance? | Feature-based selection | Offline | Describe training instances by features, run the candidate algorithms on them, and learn a model that predicts the best algorithm (or each algorithm's performance) from the features. For a new instance, compute its features and run the predicted algorithm. [Kerschke et al., 2019, Evolutionary Computation] |
| Instance space analysis | Offline | Projects instances into a 2D space based on their features and shows the region (footprint) where each algorithm performs well. It explains algorithms' strengths and weaknesses, reveals gaps in benchmark sets, and supports selection. [Smith-Miles et al., 2014, Computers & Operations Research] | |
| Algorithm composition Which components to combine? | Learned component prediction | Offline | An LSTM is trained to predict the algorithmic components, such as local search operators, of a local search algorithm, automating its design. [Meng & Qu, 2024, Expert Systems with Applications] |
| Adaptive operator selection | Offline or online | Chooses which operator to apply at each step of the search, using credit from the operators' past improvements or features of the search state. The selection policy can be learned online, while solving one instance (for example adaptive pursuit or multi-armed bandits, as in the demo below), or offline, for example by RL on many training instances, and then applied to new ones. Offline examples include deep RL agents that pick the next destroy and repair operator of large neighbourhood search from the search state. [Kallestad et al., 2023, EJOR; Johnn et al., 2023, OLA] | |
| Hybrid offline–online selection | Offline + online | Two operator selection modules, one learned from offline experience on previously solved problems and one from online experience on the current problem, are combined by an adaptive policy that decides during the run how much to rely on each. [Pei et al., 2024, GECCO] | |
| Algorithm configuration Which parameter values? | irace | Offline | Iteratively samples configurations, biased towards the best ones found so far, and races them on training instances, using statistical tests to discard poor ones early. [López-Ibáñez et al., 2016, Operations Research Perspectives] |
| SMAC | Offline | Sequential model-based optimisation: fits a model (a random forest) that predicts performance from the configuration and instance features, and uses it to choose which configurations to evaluate next. [Hutter et al., 2011, LION] | |
| Dynamic algorithm configuration | Offline training, online use | Learns a policy that changes parameter values during a run, depending on the state of the search. The policy is typically trained with RL on many training instances, then applied while solving new ones. [Biedenkapp et al., 2020, ECAI; Adriaensen et al., 2022, JAIR] |
Here is online adaptive operator selection in action. A local search for the TSP has three operators: 2-opt (reverse a segment), swap (exchange two cities) and relocate (move one city). Each step picks an operator, tries one random move with it, and keeps the move only if the tour gets shorter. The two versions differ only in how they pick the operator:
- Uniform (no learning): picks each operator with probability 1/3 at every step, however well it has done so far. This is the baseline.
- Adaptive pursuit (online learning) [Thierens, 2005, GECCO]: keeps, for each of the K = 3 operators, a quality estimate Q and a selection probability P (initially 1/K). After every move, it updates them in three steps:
- Reward. r measures how good the move was: by default, the percentage by which it shortened the tour (0 if the move was rejected). The demo also offers a success reward: r = 1 if the move was accepted, 0 otherwise.
- Quality. Only the operator just used is updated: Q ← Q + α (r − Q), with learning rate α between 0 and 1. This moving average weights recent rewards most, so Q follows the operator's current usefulness as the search moves on.
- Pursuit. The operator with the highest Q is the current winner. Every probability moves a fraction β (the pursuit rate) of the way towards a target: P ← P + β (target − P), where the target is Pmax = 1 − (K − 1) Pmin for the winner and Pmin for the others. The probabilities always sum to 1, and none falls below Pmin, so the other operators are still tried now and then and can take over if they become more useful.
Each parameter controls a trade-off, which you can explore in Demo 6:
The parameters of adaptive pursuit (defaults in the demo in brackets).
| Parameter | Small values | Large values |
|---|---|---|
| Learning rate α (0.1) | Q averages over many past moves: stable, but slow to react, so the probabilities move away from uniform later. α = 0 never learns. | Q follows only the last few rewards, and most moves earn no reward, so the winner changes very often. At α = 1, Q is just the last reward, the winner is nearly random at every move, and selection ends up close to uniform. |
| Pursuit rate β (0.005) | The probabilities drift slowly, so selection stays close to uniform for longer. β = 0 is uniform selection. | The probabilities jump to the current winner almost at once, between Pmax and Pmin: greedy, and sensitive to a lucky reward. |
| Minimum probability Pmin (0.1) | Strong exploitation of the winner; losing operators are rarely tried, so a change in which operator is best is noticed late. With Pmin = 0, a losing operator's probability falls to almost 0; its Q is then never updated, and it returns only if the other operators' Q fall below its old estimate. | More exploration. Pmin = 1/K ≈ 0.33 makes every target 1/K: uniform selection. |
How to use this demo
- Choose the instance type: 50 cities spread uniformly, or in clusters.
- Set the adaptive pursuit parameters (explained above): the reward, the learning rate α, the pursuit rate β and the minimum probability Pmin. Default settings restores α = 0.1, β = 0.005 and Pmin = 0.1.
- Press Run on a new instance (press it again to stop). Two local searches start from the same random tour and try 20,000 moves each: one picks among 2-opt, swap and relocate uniformly at random, the other adaptively, with your parameters.
- Top chart: the tour length of both versions. Bottom chart: the adaptive version's selection probability P of each operator, averaged over each block of 400 moves, with dashed lines at Pmax and Pmin. The map shows the adaptive version's current tour, and the text above the charts gives the numbers.
- Compare settings: change a parameter and press Re-run this instance. The instance, the starting tour and the uniform run stay the same, so any change in the adaptive run comes from your parameters.
Press Run: both versions start from the same random tour and use the same random numbers where possible.
- Pursuit rate: with β = 0.001, the probabilities leave 1/3 slowly and smoothly; with β = 0.1, they swing between Pmax and Pmin.
- Why these defaults? Try β = 0.02 and Pmin = 0.05. The probabilities lock onto one operator for hundreds of moves, then flip to another. The losing operators are rarely tried, so their Q stays at an old value; the winner earns mostly zero rewards, so its Q sinks below that old value and the lead changes on noise. A slower β and a larger Pmin keep every Q up to date.
- Minimum probability: with Pmin = 0, an operator's probability can drop to 0 for long stretches; with Pmin = 0.33, all three stay at 1/3 and the adaptive run behaves like the uniform one.
- Learning rate: with α = 1, the probabilities stay close to 1/3, although the winner changes all the time. Why? (Hint: most moves earn a reward of 0.)
- Success reward: every accepted move counts the same, whatever its size. Does 2-opt still get the highest probability early on?
Caveat: over 20 instances per type, with the default settings adaptive and uniform selection gave similar tours after 2,000 moves (7.67 vs 7.69 on uniform instances, 3.64 vs 3.68 on clustered) and slightly shorter tours after 20,000 (5.94 vs 5.98, 2.95 vs 2.98); 2-opt took about 42% of the moves in the first 4,000, falling to about 35% later. With β = 0.02 and Pmin = 0.05, adaptive selection was faster early on uniform instances (7.36 after 2,000 moves) but its probabilities swing much more. The benefit of adaptive operator selection depends on the operator set, the reward definition, the parameters and the budget; with a good fixed operator mix, adaptation may bring little.
6. Machine Learning Guides the Search Inside EC Solvers
Section 5 tuned the solver from the outside. ML can also work inside a run and tell the solver where to look. Each subsection answers one question: which solution components are promising (6.1), which part of a solution to change (6.2), and which new solutions to try (6.3). Across the literature, the most competitive results often come from such combinations of learned models and search, rather than from learning alone.
6.1 Heatmaps that prune and bias the search
A heatmap is an estimate, for each solution component (such as an edge of a TSP), of how likely it is to appear in a good solution. Two questions matter: how the heatmap guides the search, and how the heatmap is obtained, whether learned, generated or computed directly. Demo 7 then trains a simple heatmap and uses it to guide ant colony optimisation.
How a heatmap guides the search
A heatmap is only an estimate, so it is rarely decoded greedily into a solution. Instead, a search algorithm uses it to decide where to look.
Ways to use a heatmap in search, with examples.
| Use | Example | How it works |
|---|---|---|
| Prune the search space | Candidate sets for LKH | The heatmap builds the candidate edge lists of the strong LKH local search, which only tries moves along candidate edges. [Xin et al., 2021, NeurIPS] |
| Problem reduction | Edges with a low score are removed before an exact or heuristic solver runs on the smaller problem. [Sun et al., 2021, OR Spectrum] | |
| Subset problems | The same idea for vertices: vertices unlikely to be in any optimal solution are removed before maximum clique enumeration. [Lauri & Dutta, 2019, AAAI] | |
| Bias construction | DeepACO | The heatmap replaces the hand-made heuristic information η of ant colony optimisation. [Ye et al., 2023, NeurIPS] |
| GFACS | As DeepACO, with a heatmap trained for diverse solutions (see below). [Kim et al., 2025, AISTATS] | |
| Guide tree search | Beam search | Builds tours edge by edge and keeps the partial tours with the highest heatmap probability. [Joshi et al., 2019, arXiv] |
| Monte Carlo tree search | The heatmap sets the prior of each move in MCTS, which then improves tours with k-opt moves. [Fu et al., 2021, AAAI] | |
| Warm-start an exact solver | Solution prediction for MIP | The "heatmap" is a predicted value for each binary variable; a constraint keeps the MIP solver near the prediction, so it finds good solutions sooner. [Ding et al., 2020, AAAI] |
How a heatmap is obtained
Heatmaps differ in where the training signal comes from: labels from solved instances, rewards from the solutions the search builds, a surrogate loss, a generative model of good solutions, or no learning at all.
How heatmaps are obtained, with examples.
| Approach | Example | How it obtains the heatmap |
|---|---|---|
| Supervised, hand-crafted features | Edge classifiers | Each edge of solved instances is labelled 1 if it is in the optimal tour (from the Concorde solver) and 0 otherwise. It is described by four cost features (its cost compared with the cheapest edges at its two ends) and two statistics from many random tours (how often it appears in the shorter ones, and how its presence correlates with tour length). A support vector machine learns to classify the edges; its score is the heatmap. [Sun et al., 2021, OR Spectrum] |
| Supervised, graph neural networks | GCN heatmap | A deep graph convolutional network reads the city coordinates and distances and outputs a probability for every edge. It is trained with a cross-entropy loss against optimal tours from Concorde. [Joshi et al., 2019, arXiv] |
| Att-GCN | A graph network is trained the same way, but only on small instances. For a large instance, many small subgraphs are sampled and rescaled, the network predicts a heatmap for each, and the sub-heatmaps are merged into one heatmap for the whole instance. [Fu et al., 2021, AAAI] | |
| NeuroLKH | A sparse graph network, which only looks at each city's nearest neighbours, outputs a score for each edge and a penalty for each city. The edge scores are trained to match optimal tours (supervised). The penalties need no labels: they are trained to make the 1-tree lower bound on the tour length as large as possible, the same goal LKH pursues when it computes penalties itself (unsupervised). [Xin et al., 2021, NeurIPS] | |
| Reinforcement learning (no labels; as in Demo 7) | DeepACO | A graph network outputs the heatmap, and ants build tours from it. The network is trained with policy gradients (REINFORCE): edges used in tours shorter than the average of the batch are made more likely. [Ye et al., 2023, NeurIPS] |
| DIMES | The heatmap is a set of continuous parameters over the edges that defines a distribution of tours. A graph network outputs these parameters, and REINFORCE trains it on many tours sampled in parallel. Meta-learning gives a starting point from which a few fine-tuning steps adapt the heatmap to each test instance. [Qiu et al., 2022, NeurIPS] | |
| GFlowNets | GFACS | A graph network outputs the heatmap, as in DeepACO, but it is trained with a GFlowNet objective instead of REINFORCE. The ants then sample good tours more often, while still producing many different ones, not just the single best one. [Kim et al., 2025, AISTATS] |
| Unsupervised surrogate loss | UTSP | A graph network outputs the heatmap and is trained with no solved instances. Its loss has two parts: the total edge length weighted by the heatmap, which favours short edges, and a surrogate term that pushes the heatmap to describe a single closed cycle through all cities. [Min et al., 2023, NeurIPS] |
| Generative (diffusion) | DIFUSCO | Training takes optimal solutions, written as 0/1 edge indicators, adds random noise to them (Gaussian or Bernoulli) and teaches a graph network to remove it. To produce a heatmap, the network starts from pure noise and removes it step by step; repeating this with different noise gives several heatmaps. [Sun & Yang, 2023, NeurIPS] |
| T2T | Trained as a diffusion model, like DIFUSCO. At test time, it repeatedly adds some noise to the current solution and removes it again, using the gradient of the objective to steer each step towards shorter tours. [Li et al., 2023, NeurIPS] | |
| No learning | SoftDist | No training. Each edge gets a score from a softmax over the negative edge lengths at each city, so short edges get high scores. One temperature parameter, tuned on validation instances, sets how sharply the scores favour short edges. [Xia et al., 2024, ICML] |
Supervised methods need solved instances, which become expensive for large problems; RL, GFlowNet and unsupervised methods avoid labels but are harder to train. Many methods are trained on small instances and must generalise to larger ones, by sparse graphs, subgraph merging or per-instance adaptation. Section 7 returns to DIMES and DIFUSCO as neural solvers.
A small version of DeepACO [Ye et al., 2023, NeurIPS]: the heatmap is trained by reinforcement learning and then replaces the heuristic information η of the ACO you met in Demo 2. Instead of a graph neural network, the heatmap is a simple formula with three learned weights.
How to use this demo
- Stage 1: choose the instance type and the number of epochs, then press Train the heatmap. In each epoch, 20 ants build tours on each of 20 training instances using the heatmap alone, and REINFORCE makes the choices of the shorter-than-average tours more likely. Watch the training curve fall and the heatmap on a training instance sharpen.
- Stage 2: press Run on a new instance. ACO runs on one unseen, larger instance twice, side by side and with the same random numbers: once guided by the learned heatmap, once by the classic 1/dβ. The two maps show each version's best tour so far over its heuristic information (shading), and the chart draws both convergence curves, iteration by iteration.
- Change β of the classic heuristic and press Re-run this instance: the instance and the random numbers stay the same, so only β changes the outcome.
Stage 1 · Training Reinforcement learning shapes the heatmap
Training sees only the 20 training instances (30 cities each) and needs no optimal tours: the only signal is the length of the tours the ants build. The weights start at 0, a uniform heatmap.
Press Train the heatmap: 60 epochs take about half a second, shown step by step.
Stage 2 · Deployment ACO guided by the heatmap on unseen instances
The weights are now fixed. Each run takes one unseen 50-city instance of the same type, larger than the training instances, and runs ACO (20 ants, 100 iterations) with each kind of heuristic information η.
Train the heatmap first.
- Learned vs classic: with the default β = 2, run a few new instances: the learned heatmap is ahead from the first iteration and ends with the shorter tour (on all of the first 10 instances of either type). Now raise β to 6 and re-run: the classic heuristic catches up, and each version wins about half the time. Look at the learned weight on log relative length (about −4.8, like β = 4.8): training has rediscovered a sharp preference for short edges, plus a bonus for mutual near neighbours. A hand-tuned distance heatmap is a strong rival, which is the point of the SoftDist debate [Xia et al., 2024, ICML].
- Fewer epochs: train for 10 or 20 epochs. How far does the heatmap get, and does ACO still benefit?
- Instance types: train on uniform instances, then switch to clustered and retrain. Do the learned weights change?
Caveat: with the default 60 epochs, averaged over the first 10 unseen 50-city instances, ACO reached 0.88 (uniform) and 0.86 (clustered) of the nearest-neighbour tour after 100 iterations with the learned heatmap; 0.98 and 0.94 with 1/d2; and 0.88 and 0.87 with 1/d6. Single instances vary. With three weights, the heatmap can only reweight distance and neighbour ranks; DeepACO's graph neural network can learn far richer patterns, and pays off most when good components are not obvious from distances.
Heatmaps also have known issues:
- Symmetry. When an instance has many optimal solutions (symmetries), the heatmap averages them: in the maximum independent set problem, every node may be equally likely, which carries no information.
- Feasibility. Some components essential to feasibility do not look like typical solution components, so pruning by the heatmap can remove them [Bresich et al., 2025, LOD].
6.2 Learning which part of a solution to change
Most improvement steps change only part of a solution and keep the rest:
- a mutation changes a few genes;
- a local search move swaps or reverses a few elements;
- a ruin-and-recreate (destroy-and-repair) step removes some components and puts them back, as in large neighbourhood search (LNS);
- a decomposition step fixes most of the solution and hands the rest, a sub-problem, to an exact solver.
Each step must decide where to change. In a large solution, most parts are already fine, so a random choice wastes most of the effort. A good choice frees components that are wrong together, so that they can be fixed together.
A learned model turns this decision into a prediction. It scores each candidate part (a set of genes, variables, customers or jobs) by how much changing it is expected to improve the current solution, and the operator then works on the high-scoring parts. The model sees only cheap features of how the part sits in the current solution; the expensive test, actually changing the part, is needed only to create training data. There are several ways to learn the scores:
- Supervised regression: change many parts, record each improvement, and fit a model that predicts it (the example below).
- Imitation and contrastive learning: learn to rank parts the way a slow expert would, from the expert's good and bad choices.
- Reinforcement learning: no labels; the improvement after each step is the reward, so the model can also learn choices that pay off only several steps later.
- Online model building: during the run, learn from the population which variables depend on each other, and change those groups together (linkage learning).
Example: learning where to rebuild a tour
The tours built by nearest neighbour in Section 2.1 are mostly good but have a few bad spots. An improvement step rebuilds a region: it removes a city and its 5 nearest cities from the tour and puts them back where they add the least length, trying every insertion order. Rebuilding one region takes much more time than computing a few features, so we want to know before rebuilding which region is worth it.
Step 1 Collect examples
Take the nearest-neighbour tour on each of 10 training instances (30 random cities each). Form 30 regions per instance, one around each city, and rebuild each region. The label is the improvement, as a percentage of the tour length (0 if the tour gets no shorter).
Example. On training instance 3 (right), rebuilding three regions gives very different results:
- Region A: 17.9% shorter (5.61 → 4.61). Its cities were fetched by long detours.
- Region B: 7.4% shorter.
- Region C: 0%. Its cities already sit neatly in the tour, so the rebuild was wasted.
Over the 300 regions, 77% improve the tour at all, but by very different amounts.
Step 2 Learn to predict the improvement
Describe each region by two features, computed from the current tour alone, without rebuilding:
- detour: the extra length the tour pays to visit each city of the region, d(prev, c) + d(c, next) − d(prev, next), averaged over the region and divided by the mean nearest-neighbour distance;
- crossings: the number of crossings that involve the tour edges of the region.
Least squares on the 300 examples gives the model
predicted improvement (%) = 4.7 × detour + 0.94 × crossings − 1.3
Example. Region A (detour 2.06, 5 crossings) is predicted to improve by 13.1% (actual 17.9%); B (detour 0.46, 4 crossings) by 4.6% (actual 7.4%); C (detour 0.23, 0 crossings) by −0.2%, i.e. not at all (actual 0%). The scores are not exact, but over the 300 regions (right) they correlate well with the actual improvement (correlation 0.82), which is all we need to rank the regions.
Step 3 Use it in the search
On a new tour, score all 30 regions (cheap: no rebuilding), rebuild the top-scored region, and repeat. A region that gives no improvement is skipped until the tour changes.
Example. On unseen instance 1 (right), the larger the halo, the higher the score. The top-scored region (outlined) is also the best of all 30 when each is actually rebuilt (7.5% shorter).
Over 10 unseen instances (chart, right), after 3 rebuilds the learned score has shortened the tour to 0.87 of its starting length, against 0.94 when the region is chosen at random. Trying all 30 regions at every step and keeping the best reaches 0.85, but needs 30 times as many rebuilds.
The same recipe applies to other problems and operators: change parts (genes, variables, customers, jobs) and record the gain, describe each part by features of the current solution, and learn a score. Richer models, such as graph neural networks, replace our two hand-made features. Methods in the literature differ in what a "part" is and in how the score is learned:
Learning which part of a solution to change.
| What the part is | Method | How it learns which part to change |
|---|---|---|
| Genes varied together in an EA | Linkage learning (GOMEA) | Online, during the run: learns from the population which variables depend on each other (a linkage tree), and varies each group together when mixing solutions. [Thierens & Bosman, 2011, GECCO] |
| Region of a solution to rewrite | Local rewriting | An RL region-picking policy chooses which part of the solution to rewrite, and a second policy chooses how to rewrite it; the reward is the improvement. [Chen & Tian, 2019, NeurIPS] |
| Sub-problem for a solver | Learning to delegate | Supervised regression, as in our example: predicts how much re-optimising each sub-problem (a few nearby routes of a large vehicle routing problem) with a solver would improve the solution, and hands the best one to the solver. [Li et al., 2021, NeurIPS] |
| Variables or components to free in large neighbourhood search | Learned decompositions (integer programs) | Learns to split the variables into subsets to free and re-optimise in turn, by imitating the best decompositions found by sampling, or by RL. [Song et al., 2020, NeurIPS] |
| RL destroy policy | An RL policy decides, for each variable, whether to free it in the next step, with the solver re-optimising the freed variables. [Wu et al., 2021, NeurIPS] | |
| Contrastive learning | Learns from good and bad destroy sets collected by a slow expert method, so that the model scores the variables in good destroy sets higher. [Huang et al., 2023, ICML] | |
| Learning LNS | Learns which part of a staff roster to destroy and rebuild. [Oberweger et al., 2022, CPAIOR] | |
| GFlowNet destroy sets | Samples destroy sets in proportion to how much they are expected to improve the solution, giving diverse good choices (ongoing work in Günther Raidl's group). |
Which operator to apply (for example, which destroy and repair method) is a different, algorithm-level choice: it is adaptive operator selection, covered in Section 5.
6.3 Learned models as variation operators
In an evolutionary algorithm, new candidate solutions come from variation operators: mutation, crossover, and the repair that often follows them to restore feasibility. Hand-made operators are usually blind: they change a solution at random, without knowing which changes tend to give good solutions, so most offspring are worse than their parents. A learned operator has seen many good solutions, or has been rewarded for producing them, so its offspring tend to land where good solutions are. The learned model only proposes; the EA still evaluates the offspring and selects as usual.
A learned model can propose solutions in two ways:
- From scratch for a given instance, for example to build an initial population or restart the search.
- From a parent: it takes an existing solution, usually after part of it has been changed or destroyed, and completes it. This is a true variation operator, and it keeps the offspring close to a good parent.
There are three main ways to learn it:
- Online, from the population: estimation of distribution algorithms (EDAs) fit a probability model to the selected solutions in each generation and sample offspring from it. No training is needed before the run, but nothing is carried over to new instances.
- Offline, from good solutions: corrupt good solutions with noise and learn to remove it. Diffusion models repeat this over many small steps. The example below uses a single step.
- Offline, from rewards: when no good solutions are available, RL rewards the model for producing good solutions; generative flow networks (GFlowNets) learn to sample solutions in proportion to their reward.
Example: learning to repair a corrupted solution
The maximum independent set problem asks for as many nodes of a graph as possible such that no two chosen nodes are joined by an edge. Our graphs have 100 random points, joined when they are closer than 0.14. A strong mutation flips 20 random nodes of the parent (chosen ↔ not chosen), which usually creates conflicts. A repair then goes through the nodes in some order and adds each node whose neighbours are not yet chosen, so the result is always feasible. The order decides how good the offspring is:
- random repair keeps the nodes that are still chosen first, in random order, then tries the others in random order;
- learned repair orders all nodes by a model's probability that they belong to a good solution.
Step 1 Make training pairs by adding noise
Find a good independent set on each of 10 training graphs (with a long run of an EA). Corrupt each set 10 times by flipping 20 random nodes. Each node of each noisy set becomes one example: its features in the noisy set, and its label, whether it is in the clean set. This gives 10,000 examples, with no expert needed beyond the good sets.
Example. On training graph 1 (right), the clean set has 30 nodes. Flipping 20 nodes (circled) adds 14 and removes 6, giving 38 chosen nodes with 28 conflicts (coral edges). The model must learn to undo this.
Step 2 Learn to denoise
Fit a logistic regression that predicts, for each node, the probability that it is in the clean set, from four features of the noisy set. Training maximises the likelihood of the labels:
logit = 0.72 + 2.60 × chosen − 1.45 × chosen neighbours − 0.11 × degree − 0.36 × free neighbours
The model has learned sensible rules from data alone: keep a chosen node unless it conflicts with others, prefer nodes with few neighbours, and avoid nodes that would block neighbours that are otherwise free (not chosen and with no other chosen neighbour).
Example. On the noisy set of Step 1, the darker a node, the higher its probability (left). Repairing in that order gives a feasible set of 29 nodes (right). 24 of them are in the clean set: the result is nearly as large, but a different solution, which is what a variation operator should produce.
Step 3 Use it as a variation operator
To make an offspring, flip 20 random nodes of the parent, then repair with the learned order. Compare it with random repair, and with a hand-made greedy repair (keep chosen nodes with the fewest conflicts first, then add the others by smallest degree).
Example. From a good parent on each of 10 unseen graphs, each operator made 100 offspring (left chart). After random repair, only 8% of offspring are as large as their parent; the hand-made greedy repair reaches 35%, and the learned repair 54%.
In a simple EA (one parent, 10 offspring per generation), the learned repair reaches an average of 31.4 nodes after 8 generations; the hand-made repair needs 19, and random repair is still at 31.3 after 40 (right chart).
Caveat: with a mild mutation (6 flips instead of 20), all three repairs gave nearly the same results, because a few flips leave little to repair. A learned operator pays off when the operator makes large changes, and those large changes are what let an EA escape from local optima.
The same recipe applies to other problems: collect good solutions (or a reward), learn a model that completes partial or corrupted solutions, and use it in place of a blind operator. Methods in the literature differ in the model and in how it is learned:
Learned models that propose new solutions.
| Model | How it is learned | How it proposes new solutions | Uses |
|---|---|---|---|
| Estimation of distribution algorithms (EDAs) | Online: fit to the selected solutions of the current population in each generation. [Mühlenbein & Paaß, 1996, PPSN] | Sample offspring from the model, in place of crossover and mutation. | Binary and permutation problems |
| Denoising diffusion | Offline: learn to remove noise from good solutions, over many small steps. [Salvà Soler & Raidl, 2025, LOD] | The variation operator of an EA, the same idea as our example with a neural network and many denoising steps. | Maximum independent set |
| Neural repair operator | Offline, by RL: rewarded by the length of the repaired routes. [Hottung & Tierney, 2020, ECAI] | After a hand-made destroy step, rebuilds the destroyed part of the routes; sampling gives many candidate repairs. | Vehicle routing (neural LNS) |
| Generative flow networks (GFlowNets) | Offline, by reward: learn to sample solutions with probability proportional to their reward. [Bengio et al., 2021, NeurIPS; Zhang et al., 2023, NeurIPS] | Many diverse good solutions rather than one. | The prior of ACO (GFACS, Section 6.1); destroy sets in LNS (Section 6.2) |
7. Beyond EC: Neural Solvers and Learning in Other Solvers
Both families above keep EC at the centre. This section looks at related ML approaches without an EC solver: end-to-end neural solvers, which construct or improve solutions by themselves, and learned guidance inside tree search and exact solvers. They are the main alternatives to compare against, and several of their ideas, such as heatmaps, feed back into EC solvers (Section 6).
7.1 Neural construction: autoregressive and non-autoregressive solvers
Autoregressive models construct solutions one component at a time with a neural policy. Non-autoregressive and diffusion models predict whole solutions or heatmaps in a fixed number of steps and can sample many diverse solutions in parallel.
Representative neural construction solvers.
| Family | Method | Key idea |
|---|---|---|
| Autoregressive | S2V-DQN | A graph neural network trained with Q-learning. [Dai et al., 2017, NeurIPS] |
| Attention Model | A transformer encoder–decoder trained with REINFORCE for TSP and vehicle routing. [Kool et al., 2019, ICLR] | |
| POMO | Exploits multiple start points and symmetries for better training and inference. [Kwon et al., 2020, NeurIPS] | |
| Non-autoregressive | DIMES | Learns a continuous heatmap with meta-learning, scaling to large TSPs. [Qiu et al., 2022, NeurIPS] |
| DIFUSCO | A graph-based denoising diffusion model that generates heatmaps. [Sun & Yang, 2023, NeurIPS] | |
| T2T | Adds gradient search at test time to a diffusion model. [Li et al., 2023, NeurIPS] |
Frequent issues:
- Training: RL training can be unstable.
- Latency: autoregressive models need one network call per component.
- Generalisation: models often degrade on larger instances than those seen in training.
- Diversity: policies can collapse to a single solution.
- Gap to classical solvers: on many problems, state-of-the-art classical solvers are still better.
- Post-processing matters: greedy decoding, local search or tree search remains important for good results.
7.2 Neural improvement
Neural models can also learn improvement heuristics, or adapt themselves to each instance:
Representative neural improvement methods.
| Approach | Method | How it works |
|---|---|---|
| Learn local search moves | Learning improvement heuristics | A self-attention policy picks 2-opt moves for routing. [Wu et al., 2022, IEEE TNNLS] |
| DACT | A dual-aspect collaborative transformer that encodes node and position information separately. [Ma et al., 2021, NeurIPS] | |
| Neural k-opt | Learns flexible k-opt moves for routing problems. [Ma et al., 2023, NeurIPS] | |
| Adapt to each instance | Efficient active search | Fine-tunes a subset of the trained model's parameters on each test instance. [Hottung et al., 2022, ICLR] |
7.3 Generalisation, foundation models and lifelong learning
The biggest recent push is towards neural solvers that generalise across sizes and problem variants:
Responses to the generalisation challenge of neural solvers.
| Challenge | Method | How it works |
|---|---|---|
| Scale | LEHD | A light encoder with a heavy decoder, trained on small instances, generalises to TSP and CVRP instances with up to 1,000 nodes. [Luo et al., 2023, NeurIPS] |
| Many variants, one model | MVMoE | A multi-task model with a mixture of experts. [Zhou et al., 2024, ICML] |
| RouteFinder | Covers 48 vehicle routing variants and adapts to new attributes with adapter layers. [Berto et al., 2025, TMLR] | |
| GOAL | Shares one backbone across routing, scheduling, packing and graph problems. [Drakulic et al., 2025, ICLR] | |
| Lifelong learning | LLR-BC | When a deployed solver must learn new routing tasks over time, fine-tuning can cause catastrophic forgetting; LLR-BC consolidates past behaviour, weighting low-confidence decisions more. [Pei et al., 2026, ICLR] |
| Fair comparison | RL4CO | A benchmark library that unifies 27 problem environments and 23 baselines. [Berto et al., 2025, KDD] |
7.4 Learning inside tree search and exact solvers
Learning inside tree search, beam search and exact solvers.
| Setting | Method | How it works |
|---|---|---|
| Tree search | Learned probability maps | A graph convolutional network predicts several probability maps that guide a tree search for maximum independent set and related problems. [Li et al., 2018, NeurIPS] |
| AlphaZero-style search | AlphaZero amplifies a neural network's evaluations with Monte Carlo tree search through self-play [Silver et al., 2018, Science]; it inspired solvers for graph problems. [Abe et al., 2019; Huang et al., 2019, arXiv] | |
| Beam search | Learning beam search | A neural network trained by self-play estimates the value of partial solutions to guide beam search, giving new best results on longest common subsequence benchmarks. [Huber & Raidl, 2021, LOD] |
| Exact solvers | Learning to branch | Graph neural networks imitate strong branching to speed up branch and bound. [Gasse et al., 2019, NeurIPS] |
| Neural diving | Learns to fix variables to find good solutions quickly. [Nair et al., 2020, arXiv] |
8. Challenges and Future Directions
This is a highly active area, and learning is promising for improving on classical optimisation. But:
Open challenges and current responses.
| Challenge | Why it matters | Responses |
|---|---|---|
| Competitiveness | End-to-end ML approaches are usually not yet competitive with carefully engineered classical solvers on standard benchmarks. | Combine learning with search. |
| Generalisation | Models trained on small or uniform instances often fail on larger or structurally different ones. | Training instance design, multitask and lifelong learning, foundation models. |
| Data and training cost | Supervised learning needs (near-)optimal solutions, which are expensive; RL needs no labels but is often tricky to train; evolutionary and LLM-driven design need many evaluations, and LLM calls add monetary and environmental cost. | Surrogates, curricula, cheaper evaluation and fewer LLM queries. |
| Fair evaluation | Comparisons depend heavily on hardware, time limits and baselines, as the heatmap debate in Section 6.1 shows. | Shared benchmarks and reporting standards. |
| Interpretability and trust | Learned heuristics and neural policies must be understood before deployment in high-stakes settings. | Small symbolic models, simplification and explanation methods (see the Explainable AI by GP tutorial). |
| Reproducibility of LLM-based design | Proprietary models change over time, and their training data may already contain known heuristics, which complicates claims of discovery. | Open models, fixed versions and contamination checks. |
9. Check Your Understanding
1. Why do we use heuristics instead of exact methods for large TSP instances?
2. In ant colony optimisation, what plays the role of learned experience?
3. When GP learns a heuristic, what does it search over?
4. What makes a phenotypic-characterisation surrogate cheap?
5. Which kind of individual does lexicase selection favour, compared with tournament selection?
6. In LLM-driven heuristic design such as FunSearch or EoH, what does the LLM replace?
7. In guided local search, what does the utility function decide?
8. What is a known weakness of learned heatmaps?
Where to Go Next
- More tutorials: Genetic Programming, Job Shop Scheduling, GP for Job Shop Scheduling (training instances, surrogates and deployment in depth) and Explainable AI by GP.
- Code and libraries: RL4CO for neural combinatorial optimisation, irace for algorithm configuration, and GPJSS for GP hyper-heuristics in job shop scheduling.
- Books: Zhang, Nguyen, Mei & Zhang (2021). Genetic Programming for Production Scheduling. Springer.
- My research: the machine learning for optimisation and genetic programming research themes list our papers.
How to cite
If this tutorial helps your work, please cite the GECCO tutorial it is based on:
@inproceedings{mei2026emlco,
author = {Mei, Yi and Raidl, G{\"u}nther R.},
title = {Evolutionary Computation Meets Machine Learning for Combinatorial Optimisation},
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference Companion (GECCO '26 Companion)},
year = {2026},
publisher = {ACM},
doi = {10.1145/3795101.3807746}
}