Algorithmic Contextual Evolution of Heuristics (A-CEoH)
- A-CEoH is a methodology that automates the generation of domain-adaptive heuristics by integrating algorithmic context via LLM-enhanced prompt engineering.
- It embeds search algorithm code and problem-specific context into an evolutionary framework, leading to heuristics that outperform expert baselines in efficiency and solution quality.
- The framework generalizes across various combinatorial optimization problems, offering robust, scalable, and empirically validated heuristic strategies for logistics and puzzles.
Algorithmic - Contextual Evolution of Heuristics (A-CEoH) is a methodology for automating the generation and evolution of guiding heuristics in search algorithms, specifically tailored to combinatorial optimization problems such as the Unit-Load Pre-Marshalling Problem (UPMP). By tightly integrating algorithmic code and problem-specific context into LLM-based prompt structures, A-CEoH enables the synthesis of sophisticated, domain-adaptive heuristic functions that not only rival but frequently surpass expert-crafted baselines in both solution quality and computational efficiency (Bömer et al., 27 Jan 2026).
1. Conceptual Foundations
A-CEoH extends the "Evolution of Heuristics" (EoH) evolutionary framework by leveraging both problem context (such as instance structure, move definitions, and constraints) and algorithmic context—notably, the actual procedural code of the tree search algorithm to which the heuristics will be applied. The key insight is that LLMs, when provided with in-context exposure to the mechanics of a search process (e.g., the A* driver), evolve heuristics that are explicitly harmonized with the search algorithm's requirements and information flow (Bömer et al., 27 Jan 2026).
This integrated prompt engineering contrasts with earlier evolution frameworks (EoH, CEoH) that provided only problem descriptions or relied on hand-crafted prompt templates. By augmenting prompts with code implementing the search skeleton itself, as well as concrete data-structure definitions and constraints, A-CEoH produces Python-coded heuristics accompanied by explicit logic rationales ("thoughts") that directly optimize the search algorithm's objective function.
2. Mathematical and Algorithmic Framework
Within A-CEoH, the evolutionary design of heuristics is embedded in a loop where populations of candidate scoring functions undergo cycles of mutation and crossover (exploration and modification), fitness evaluation, and selection. The main workflow comprises (Bömer et al., 27 Jan 2026):
- Initialization: Generate an initial pool of heuristic functions via zero-shot prompting.
- Algorithmic Context Embedding: Each LLM prompt includes the full (or stubbed) code of the actual driver algorithm (e.g., A*), together with state representations (e.g., Python lists for stacks) and small instance examples.
- Evolution Strategies: Typical operators include:
- E₁: Generate entirely new heuristics not based on parent code.
- E₂: Combine key ideas from parents.
- M₁/M₂: Modify parent code or tweak weights to optimize empirical fitness.
- Fitness Evaluation: Fitness is measured as relative deviation from a known lower bound on move count, averaged over a training set:
where is the number of moves by heuristic and is the provable lower bound (Bömer et al., 27 Jan 2026).
- Selection: The top performers by fitness are advanced to the next generation.
Crucially, the prompt construction enforces that resulting code is compatible with the provided driver (e.g., function score_state(state: List[List[int]]) -> float) and adheres to the state transitions, move definitions, and search orderings required by the algorithm (Bömer et al., 27 Jan 2026).
3. Application to the Unit-Load Pre-Marshalling Problem (UPMP)
The UPMP tasks the system with reorganizing unit loads in block-stacking warehouses, such that no "blocking" occurs—each stack is sorted so that higher-priority loads are never rendered inaccessible by lower-priority ones (Pfrommer et al., 2022, Bömer et al., 27 Jan 2026).
In the A-CEoH context, the A* search algorithm is adopted to find minimal-move solutions, with nodes corresponding to warehouse layouts, transitions mapping relocations, and heuristics assessing the estimated remaining moves. Candidate heuristics generated by A-CEoH might, for instance, count the number of blocking containers, assign penalties for containers out of priority sequence, or integrate more domain-specific attributes unearthed via prompt evolution cycles (Bömer et al., 27 Jan 2026).
Performance is benchmarked across a suite of randomly generated UPMP instances, with constraints such as a maximum search depth and timeouts. Metrics include the number of solved instances, total moves, A* node expansions, and CPU time.
4. Quantitative Results and Comparative Assessment
A-CEoH demonstrates significant improvements, measured both in training and generalization scenarios:
- On standard UPMP testbeds, PA-CEoH (prompt augmented with both algorithmic and problem context) enables LLMs to consistently match the move count of optimal A* searches on training data, and often solve all held-out test cases under tight computational budgets, exceeding both human-expert and classical hand-engineered heuristics by margins ranging from 2× to 3× in CPU and search-tree size reduction (Bömer et al., 27 Jan 2026).
- Representative results (for 5×5×1 instances at 80% fill):
| Approach | Solved (Test) | Fitness (Test) | Mean Time (s) | |--------------------|--------------|---------------|---------------| | Qwen2.5-PA-CEoH | 30/30 | 0.1388 | 0.151 | | GPT4o-PA-CEoH | 30/30 | 0.1055 | 0.098 | | Expert Heuristic | 27/30 | 0.0968 | 0.440 |
- A-CEoH heuristics display robust generalization, solving instances with increased warehouse size, tiering, or filling beyond those encountered during training.
- Prompt augmentation with code context materially improves fitness for mid-sized and open-source LLMs (e.g., Qwen2.5-Coder:32B), ensuring the generated heuristic logic is tightly coupled to the underlying search process (Bömer et al., 27 Jan 2026).
5. Theoretical Significance and Structural Properties
A-CEoH is fundamentally domain-agnostic. Embedding the algorithmic context allows the framework to produce heuristics sufficiently aligned with arbitrary tree search policies. The evolutionary prompt structure systematically explores and combines the local search landscape of heuristic functions, leading to both convergence and functional diversity.
This address a recurrent limitation in manual heuristic construction—a reliance on designer intuition and problem familiarity—by transferring synthesis to a controlled, scalable, and evolvable LLM-centered paradigm (Bömer et al., 27 Jan 2026, Bömer et al., 5 Mar 2025). Formal analysis of the evolutionary search through fitness landscapes, combined with the expressiveness of LLMs under context-rich prompting, renders A-CEoH a significant advance for niche logistical optimization problems with limited prior art.
6. Broader Implications and Transferability
A-CEoH is readily generalizable to a broad spectrum of heuristic-guided search settings—any context for which the tree search logic and state transitions can be encoded for in-context learning by a code-capable LLM. This encompasses, but is not limited to: multi-bay or multi-access UPMPs, general block relocation, container stowage, and potentially classical puzzles such as the sliding puzzle problem (SPP) (Bömer et al., 27 Jan 2026).
For practitioners, best practices include providing clear algorithmic drivers, task-specific I/O examples, and constraints within prompts. Empirical evidence underscores that even comparatively small LLMs, when prompt-augmented, are able to autonomously discover heuristics matching or surpassing domain-specific rules, enabling rapid deployment to new problem classes (Bömer et al., 27 Jan 2026, Bömer et al., 5 Mar 2025).
7. Open Directions and Limitations
While A-CEoH achieves near-parity with expert A* in the studied UPMP domain, its performance is sensitive to the expressiveness of the prompt, the evolution operator regimen, and the capabilities of the underlying LLM. As observed, explicit context is essential for smaller models, while large models (e.g., GPT-4O) may sometimes match or outperform CEoH without detailed prompt augmentation (Bömer et al., 5 Mar 2025). Future directions include adaptation to stochastic/dynamic optimization settings, integration with self-play reinforcement, and application to continuous-control search paradigms.
Potential limitations arise in settings with extremely large combinatorial spaces or highly non-local constraints, where even evolved heuristics may underperform without additional structural insight.
References
- "Algorithmic Prompt-Augmentation for Efficient LLM-Based Heuristic Design for A* Search" (Bömer et al., 27 Jan 2026)
- "Leveraging LLMs to Develop Heuristics for Emerging Optimization Problems" (Bömer et al., 5 Mar 2025)
- "Solving the unit-load pre-marshalling problem in block stacking storage systems with multiple access directions" (Pfrommer et al., 2022)