arXiv:2610.35160cs.AIOct 2026

Manuscript Offprint

arXiv:2610.35160

AutoEnergyDesign: An LLM-Driven Agent for Automatic Energy System Design Optimization

Amedeo Buonanno, Salvatore Fabozzi, Maria Valenti

Abstract

The design optimization of building energy systems represents a complex, high-dimensional search problem involving discrete technology selections, continuous sizing parameters, and intricate economic trade-offs. When each design must be evaluated by a year-long simulation, the mixed-integer nature of the problem and its non-convex cost surface make the search expensive for black-box optimizers, which typically require hundreds of evaluations. This paper presents AutoEnergyDesign, a framework that leverages Large Language Models (LLMs) as autonomous optimization agents for energy system configuration. The framework employs an iterative experimentation loop where an LLM agent reasons over previous simulation results, proposes configuration modifications and learns in context from the outcome of each simulation, while a git-based version control mechanism automatically reverts suboptimal changes. The agent couples a reasoning model with an explicit memory organisation (procedural instructions, semantic domain knowledge, episodic trial history with a per-experiment decision log, a reflective note, and the working context of the session), a constrained action interface, and an environment-grounded keep/revert feedback signal. We formulate the complete mathematical model encompassing eight distinct energy technologies (photovoltaic panels, micro-wind turbines, combined heat and power units, solar thermal collectors, gas boilers, battery storage, heat pumps, and inverters) with detailed Net Present Cost (NPC) calculations including capital expenditures, operational expenditures, and end-of-horizon salvage value over a 25-year horizon. The proposed methodology is evaluated on a case study based on measured building load profiles, against established baselines including random search, Tree-structured Parzen Estimator (TPE) Bayesian optimization, and a (1+1)(1+1) evolution strategy that shares the agent's acceptance rule. The agent is instantiated with three Claude models of increasing capability.

(Haiku 5.5, Sonnet 5.5 and Opus 5.5), each run ten times with a budget of 50 simulations, and compared with random search, TPE and the (1+1)(1+1) evolution strategy, run for 300 evaluations over ten seeds. With all three models the agent reaches a Net Present Cost of about 3.53 MEUR, 1.20%1.20\% below the best value found by TPE and 0.23%0.23\% below the best value of the evolution strategy. The agent comes within 1%1\% of this design after a median of 18 (Opus) to 27.5 (Haiku) simulations, whereas among the baselines only the evolution strategy does so, in half of its seeds and after a median of 192 evaluations. Opus 5.5 reaches the best design in all ten runs, Sonnet 5.5 in six, with two runs that never come within 1%1\% of it, and Haiku 5.5 comes within 1%1\% of it in every run but reaches it exactly in only one. The framework also produces an auditable trace of every decision, establishing a foundation for accessible, transparent, and effective energy system optimization through natural language reasoning and automated experimentation.

Keywords: Agentic AI, LLM agents, Energy system optimization, Large Language Models, Building energy design, Automated experimentation

1 Nomenclature

Table 1 summarizes the variables and symbols used throughout the mathematical formulation.

Table 1: Variables and symbols used in the model

SymbolDescriptionUnit
xDesign decision vector (technology activation and sizing)-
u1:T\mathbf{u}_{1:T}Sequence of operational decision vectors over the horizon-
tTime index (hour)h
TTotal number of simulation time stepsh
dteld_{t}^{\text{el}}Exogenous electricity demand at time tkW
dtheatd_{t}^{\text{heat}}Exogenous heat demand (space heating + DHW) at time tkWth\text{kW}_{\text{th}}
dtcoold_{t}^{\text{cool}}Exogenous cooling demand at time tkWth\text{kW}_{\text{th}}
ptsupp_{t}^{\text{sup}}Electricity supplied to demand at time tkW
qtheatq_{t}^{\text{heat}}Heat supplied to demand at time tkWth\text{kW}_{\text{th}}
qtcoolq_{t}^{\text{cool}}Cooling power supplied to demand at time tkWth\text{kW}_{\text{th}}
stel,stheat,stcools_{t}^{\text{el}}, s_{t}^{\text{heat}}, s_{t}^{\text{cool}}Unserved electricity, heat and cooling at time t (also written sel(t)s^{\text{el}}(t), etc.)kW, kWth\text{kW}_{\text{th}}
T\mathcal{T}Set of available technologies-
X\mathcal{X}Feasible set of design decisions-
g(x,u1:T)g(\mathbf{x}, \mathbf{u}_{1:T})Vector of technical and operational constraints-
zpvz_{\text{pv}}Binary activation variable for PV technology-
SymbolDescriptionUnit
zwtz_{\mathrm{wt}}Binary activation variable for wind-turbine technology-
zchpz_{\mathrm{chp}}Binary activation variable for CHP technology-
zstz_{\mathrm{st}}Binary activation variable for solar-thermal technology-
zboiz_{\mathrm{boi}}Binary activation variable for boiler technology-
zbatz_{\mathrm{bat}}Binary activation variable for battery technology-
zhpz_{\mathrm{hp}}Binary activation variable for heat-pump technology-
ApvA_{\mathrm{pv}}Installed photovoltaic collector aream2\mathrm{m}^2
PwtratedP_{\mathrm{wt}}^{\mathrm{rated}}Rated wind-turbine electrical powerkW
PchpelP_{\mathrm{chp}}^{\mathrm{el}}CHP nominal electrical powerkW
ηchpel\eta_{\mathrm{chp}}^{\mathrm{el}}CHP electrical efficiency-
ηchpth\eta_{\mathrm{chp}}^{\mathrm{th}}CHP thermal efficiency-
AstA_{\mathrm{st}}Installed solar-thermal collector aream2\mathrm{m}^2
PboimaxP_{\mathrm{boi}}^{\mathrm{max}}Maximum boiler thermal powerkWth\mathrm{kW}_{\mathrm{th}}
ηboi\eta_{\mathrm{boi}}Boiler thermal efficiency-
EbatmaxE_{\mathrm{bat}}^{\mathrm{max}}Battery energy capacitykWh
PbatmaxP_{\mathrm{bat}}^{\mathrm{max}}Battery maximum charge/discharge powerkW
ηbat\eta_{\mathrm{bat}}Battery round-trip efficiency-
Pinv,jmaxP_{\mathrm{inv},j}^{\mathrm{max}}Nominal power of inverter j∈{pv,bat,wt}j\in\{\mathrm{pv},\mathrm{bat},\mathrm{wt}\}kW
ηinv,j\eta_{\mathrm{inv},j}Conversion efficiency of inverter jj-
PhpmaxP_{\mathrm{hp}}^{\mathrm{max}}Heat-pump maximum thermal powerkWth\mathrm{kW}_{\mathrm{th}}
EERHeat-pump cooling energy-efficiency ratio (reversible machine)-
GHI(t)\mathrm{GHI}(t)Global horizontal irradiance at time ttW/m2\mathrm{W}/\mathrm{m}^2
ppv(t)p_{\mathrm{pv}}(t)PV electrical output at time ttkW
ηpv\eta_{\mathrm{pv}}PV conversion efficiency-
v,v(t)v, v(t)Wind speed (generic; at time tt)m/s
vin,vrated,voutv_{\mathrm{in}}, v_{\mathrm{rated}}, v_{\mathrm{out}}Wind turbine cut-in, rated, and cut-out speedsm/s
Pwind(v)P_{\mathrm{wind}}(v)Wind-turbine electrical output as a function of vvkW
pwind(t)p_{\mathrm{wind}}(t)Wind-turbine electrical output at time ttkW
pchpel(t),pchpth(t)p_{\mathrm{chp}}^{\mathrm{el}}(t), p_{\mathrm{chp}}^{\mathrm{th}}(t)CHP electrical and thermal output at time ttkW, kWth\mathrm{kW}_{\mathrm{th}}
σ\sigmaCHP heat-to-power ratio, σ=ηchpth/ηchpel\sigma=\eta_{\mathrm{chp}}^{\mathrm{th}}/\eta_{\mathrm{chp}}^{\mathrm{el}}-
p^st(t)\hat{p}_{\mathrm{st}}(t)Available solar-thermal heat output at time ttkWth\mathrm{kW}_{\mathrm{th}}
pst(t)p_{\mathrm{st}}(t)Solar-thermal heat actually used at time ttkWth\mathrm{kW}_{\mathrm{th}}
ηst\eta_{\mathrm{st}}Solar-thermal collector efficiency-
pboilergas(t)p_{\mathrm{boiler}}^{\mathrm{gas}}(t)Boiler gas consumption at time ttkWfuel\mathrm{kW}_{\mathrm{fuel}}
cboilerc_{\mathrm{boiler}}Boiler heat marginal costEUR/kWhth_{\mathrm{th}}
cgasc_{\mathrm{gas}}Natural gas priceEUR/kWh
ηstore,ηdispatch\eta_{\mathrm{store}}, \eta_{\mathrm{dispatch}}Battery charging/discharging efficiencies-
pbattcharge(t),pbattdischarge(t)p_{\mathrm{batt}}^{\mathrm{charge}}(t), p_{\mathrm{batt}}^{\mathrm{discharge}}(t)Battery charging/discharging powers at time ttkW
SymbolDescriptionUnit
COPHeat-pump coefficient of performance (fixed, heating)-
phpth(t)p_{\mathrm{hp}}^{\mathrm{th}}(t)Heat-pump heat output at time ttkWth\mathrm{kW_{th}}
php,cel(t),php,ccool(t)p_{\mathrm{hp,c}}^{\mathrm{el}}(t), p_{\mathrm{hp,c}}^{\mathrm{cool}}(t)Heat-pump electrical input and cooling output in cooling modekW, kWth\mathrm{kW_{th}}
chpc_{\mathrm{hp}}Heat-pump heat marginal costEUR/kWhth_{\mathrm{th}}
celecc_{\mathrm{elec}}Electricity purchase priceEUR/kWh
pinv,jin(t),pinv,jout(t)p_{\mathrm{inv},j}^{\mathrm{in}}(t), p_{\mathrm{inv},j}^{\mathrm{out}}(t)Source-side input and delivered output power of inverter jjkW
cchpvarc_{\mathrm{chp}}^{\mathrm{var}}CHP variable maintenance costEUR/kWhel_{\mathrm{el}}
yyYear index in the economic formulationyr
PV(C,y)\mathrm{PV}(C, y)Present value of a cash flow CC occurring at year yyEUR
rrAnnual discount rate-
NNProject horizon in yearsyr
PVfactor\mathrm{PV}_{\mathrm{factor}}Annuity present-value factor over the horizon-
CAPEXi\mathrm{CAPEX}_iInitial capital expenditure of technology iiEUR
Ri\mathcal{R}_iSet of replacement years for technology iiyr
CAPEXtotal\mathrm{CAPEX}_{\mathrm{total}}Total discounted CAPEX including replacementsEUR
frepl(L,N,r)f_{\mathrm{repl}}(L, N, r)Replacement multiplier including discounting-
L,LiL, L_iLifetime (generic or of technology ii)yr
mmReplacement index in discounted replacement sum-
CAPEXeffective,i\mathrm{CAPEX}_{\mathrm{effective},i}Effective discounted CAPEX for technology ii over the horizonEUR
OPEXfixed,i\mathrm{OPEX}_{\mathrm{fixed},i}Annual fixed OPEX for technology iiEUR/yr
OPEXfixedPV\mathrm{OPEX}_{\mathrm{fixed}}^{\mathrm{PV}}Present value of fixed OPEX over the horizonEUR
OPEXvariable\mathrm{OPEX}_{\mathrm{variable}}Annual variable operating cost from dispatchEUR/yr
NPCTotal discounted life-cycle cost (costs net of revenue)EUR
pgridimport(t)p_{\mathrm{grid}}^{\mathrm{import}}(t)Electricity imported from the grid at time ttkW
pgridexport(t)p_{\mathrm{grid}}^{\mathrm{export}}(t)Electricity exported to the grid at time ttkW
pboiler(t)p_{\mathrm{boiler}}(t)Boiler thermal output at time ttkWth\mathrm{kW_{th}}
pchpgas(t)p_{\mathrm{chp}}^{\mathrm{gas}}(t)CHP gas consumption at time ttkWfuel\mathrm{kW_{fuel}}
phpel(t)p_{\mathrm{hp}}^{\mathrm{el}}(t)Heat-pump electrical input in heating mode at time ttkW
soc(t)\mathrm{soc}(t)Battery state of charge at time ttkWh
ploadel(t)p_{\mathrm{load}}^{\mathrm{el}}(t)Electrical load in the dispatchkW
ploadheat(t),ploaddhw(t)p_{\mathrm{load}}^{\mathrm{heat}}(t), p_{\mathrm{load}}^{\mathrm{dhw}}(t)Space-heating and DHW loads in the dispatchkWth\mathrm{kW_{th}}
ploadcool(t)p_{\mathrm{load}}^{\mathrm{cool}}(t)Cooling load in the dispatchkWth\mathrm{kW_{th}}
p(t),Pratedp(t), P^{\mathrm{rated}}Generic dispatch variable of a technology and its rated limitkW
cexportc_{\mathrm{export}}Electricity export tariff in dispatch objectiveEUR/kWh
π\piPenalty cost for unserved energyEUR/kWh

2 INTRODUCTION

5

SymbolDescriptionUnit
ε\varepsilonTolerance on annual unserved energy for feasibilitykWh
Egridimport,EeltotE_{\mathrm{grid}}^{\mathrm{import}}, E_{\mathrm{el}}^{\mathrm{tot}}Annual grid import and total electrical consumptionkWh
SiS_iDiscounted salvage (residual) value of technology ii at year NNEUR
yilasty_{i}^{\mathrm{last}}Year of the last installation of technology iiyr
BBEvaluation budget (number of simulator calls)-
NaN_aNumber of experiments between two reflective synthesis turns-
KKNumber of most recent discarded designs listed in the search history-
kkExperiment index-
xk,xk⋆\mathbf{x}_k, \mathbf{x}_k^\starDesign proposed at experiment kk; best valid design after experiment kk-
σES,σES,0\sigma_{\mathrm{ES}}, \sigma_{\mathrm{ES},0}Mutation step of the (1+1)(1+1)-ES as a fraction of the grid levels; initial value-
NPC⋆\mathrm{NPC}^\starBest NPC found in the study (by any method and run)EUR
δ\deltaRelative tolerance on NPC⋆\mathrm{NPC}^\star used to count the evaluations to a near-optimal design-

References (57)