One of the most frustrating experiences in gene46 — and in Genetic Algorithms generally — is when evolution stagnates. You're swiping, generations are ticking up, but the art stops improving. Every card looks the same. This is called getting trapped in a local optimum, and understanding why it happens is the key to escaping it.
1. What Is a Local Optimum?
In optimization, a global optimum is the best possible solution anywhere in the search space. A local optimum is a solution that appears best when you only look at nearby options — but much better solutions exist further away.
The Mountain Analogy
Imagine you're blindfolded in a mountain range, trying to find the highest peak. You can feel the slope under your feet, so you always walk uphill. Eventually you reach a summit — you can't go higher in any direction.
But are you at the highest mountain? You don't know. You might be on a small hill while a much taller peak exists just over the valley. Gradient-based optimization gets stuck here. GAs, with their population-level search, try to avoid this — but they too can get trapped.
2. Why GAs Get Trapped in Local Optima
In a GA, premature convergence — all individuals becoming genetically similar — is the main cause of getting stuck in local optima. Once the population converges:
- Crossover just shuffles similar genes, producing nearly identical offspring.
- The low mutation rate rarely produces changes large enough to escape the current fitness region.
- The GA is effectively exploring only a tiny neighborhood of the search space.
In gene46, this manifests as every card in a generation looking nearly identical — you've hit a local optimum in the aesthetic fitness landscape.
3. Standard GA Techniques for Escaping Local Optima
Niching & Fitness Sharing
Distribute the population across multiple fitness peaks simultaneously by penalizing individuals that are too similar to each other (fitness sharing). This maintains diversity and explores multiple regions concurrently.
Island Model (Parallel GAs)
Run multiple independent GA populations ("islands") in parallel, and occasionally migrate individuals between islands. Each island converges to a different local optimum, and migration allows cross-pollination between them.
Simulated Annealing Hybrid
Occasionally accept worse solutions (with decreasing probability over time, like a cooling metal). This allows temporary fitness decreases to escape local optima valleys.
Increased Mutation Rate
When stagnation is detected, temporarily increase the mutation rate to inject new genetic diversity — then reduce it again once diversity is restored.
4. gene46's Solution: The Fork Feature
gene46 implements a player-accessible version of the island model through the Fork feature. When you fork a thread:
- The current thread continues evolving along its current trajectory.
- A new thread is created as an identical copy of the current state.
- You can now apply a completely different selection strategy on the fork.
- The two branches explore different regions of the aesthetic fitness landscape simultaneously.
Practical Fork Strategy
When evolution stagnates around Gen 20–30:
- Fork the thread.
- In Branch A: continue your current selection strategy.
- In Branch B: deliberately select the individuals you would normally reject — the unusual outliers, the "weird" ones. This forces exploration of unexplored fitness regions.
- After 5–10 generations, compare the two branches. Often, Branch B opens up stunning new territory.
5. Why Local Optima Actually Matter in Creative Evolution
In traditional optimization, local optima are pure failure. In creative evolution like gene46, local optima are more nuanced:
- Each local optimum represents a distinct aesthetic style — a coherent visual language the evolution has converged on.
- Staying in a local optimum and refining it can produce extremely polished, consistent art.
- Escaping to a new local optimum means discovering a completely different style.
The Fork feature lets you do both simultaneously — maintaining and refining one style while exploring new territory in a parallel branch. This mirrors how professional artists work: mastering one style while experimenting in another.
📚 References
- Goldberg, D.E. & Richardson, J. (1987), Genetic Algorithms with Sharing for Multimodal Function Optimization
- Whitley, D. et al. (1999), Island Model Genetic Algorithms, Evolutionary Computation
- Wikipedia: Local Optimum