Automated Heuristic Design for Unit Commitment Using Large Language Models

Junjin Lv, Chenggang Cui, Shaodi Zhang, Hui Chen, Chunyang Gong, Jiaming LiuarXiv 2025 · DOI

Abstract

The Unit Commitment (UC) problem is a critical optimization challenge in power systems, traditionally addressed through mathematical programming or metaheuristics. This paper presents a novel approach using FunSearch (Function Space Search), which leverages Large Language Models (LLMs) to automatically design and evolve heuristic algorithms. By treating the LLM as a code generator rather than a direct solver, the framework iteratively improves generator schedules through an automated evaluation loop. Experimental results on the Chengde benchmark system demonstrate that FunSearch significantly outperforms traditional Genetic Algorithms, achieving a 97% reduction in sampling time and a 6.7% reduction in total operating costs.

Introduction

The Unit Commitment (UC) problem involves determining the optimal start-up and shut-down schedule for generating units to meet electricity demand over a specific horizon, typically 24 hours. This must be achieved at minimum cost while adhering to complex physical constraints such as load balance, unit power limits, and minimum up/down times. Mathematically, UC is a large-scale, mixed-integer nonlinear constrained optimization problem.

Traditional methods like Lagrangian relaxation and Genetic Algorithms (GA) often struggle with the increasing complexity of modern grids, frequently requiring excessive computational time or failing to find near-optimal solutions. This research explores the intersection of LLM-based creative reasoning and rigorous power system optimization to overcome these limitations.

Methodology: The FunSearch Framework

Rather than prompting an LLM to solve numerical problems directly—a task prone to "hallucinations"—the authors implement FunSearch. This framework tasks the LLM with writing Python-based heuristics (algorithms) to solve the UC problem.

The iterative FunSearch evolution process, showing the loop between LLM generation, program evaluation, and database storage.

The system operates through an evolutionary loop:

  1. Generator (LLM): A pre-trained model receives problem specifications and suggests code improvements.
  2. Evaluator (Sandbox): The generated code is executed in a secure environment to check physical constraints and calculate operating costs.
  3. Program Database: Successful heuristics are stored and used as prompts for subsequent iterations, allowing the system to perform a search in "function space."

This approach ensures that the LLM's output is grounded by a deterministic evaluator, preventing physically impossible grid schedules.

Experimental Results

The framework was tested using the Chengde system benchmark, featuring 10 generating units over a 24-hour period. The performance was compared against a standard Genetic Algorithm (GA).

Metric Genetic Algorithm (GA) FunSearch (LLM-based) Improvement
Sampling Time (s) 240 6.6 ~97% faster
Evaluation Time (s) 14.5 3.9 ~73% faster
Operating Cost ($) 5236 4884 ~6.7% lower cost
Visualization of the Unit Commitment Schedule and the resulting Power Demand vs. Generation curve, showing effective demand matching with minimal surplus.

As shown in the figures, FunSearch successfully generates schedules that closely track the demand profile while maintaining system constraints. The significant reduction in sampling time highlights the efficiency of evolving heuristics over performing raw population-based searches like GA.

Discussion and Conclusion

The core insight of this work is that LLMs are more effective at designing algorithms than performing direct numerical optimization. By evolving strategies in the form of code, FunSearch provides a robust, fast, and cost-effective alternative to traditional UC solvers.

Future work will focus on scaling this approach to larger grids with hundreds of units and investigating the generalizability of evolved heuristics across different grid topologies. While the risk of LLM hallucinations remains, the inclusion of a rigorous evaluation sandbox effectively mitigates these concerns in a production environment.

Summary updated

BibTeX
@misc{lv2025automated,
  author = {Junjin Lv and Chenggang Cui and Shaodi Zhang and Hui Chen and Chunyang Gong and Jiaming Liu},
  title = {{Automated Heuristic Design for Unit Commitment Using Large Language Models}},
  year = {2025},
  eprint = {2506.12495},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.12495},
}
Figure