Optimization, electricity markets and machine learning.
AlphaSearch: Agentic AI for Price Arbitrage in Energy Systems
BESS market channel optimization is oftentimes implemented as a mixed-integer linear programming (MILP) optimization routine running on point price forecasts. This paper does something I find pretty remarkable: the authors fine-tune Qwen2.5-Math-1.5B on perfect-foresight MILP oracle schedules and, in their 4-hour Italy example, recover 97.55% of the perfect-foresight value. The same MILP running on the RF point forecast recovers only 87.04%. In essence, MILP-to-LLM distillation / imitation learning expressed as supervised language-model fine-tuning. ...
Bellman recursion for BESS optimization
BESS market channel optimization, dynamic programming and Bellman recursion connect the value function, policy, SoC and continuation value. In FlexOpt #003 (https://x.com/gwlthr/status/2091482606369997207?s=20) we looked at a simplified example which we extend slightly: Imagine a two-hour BESS, 1 MW / 2 MWh, with unit efficiency, no fees or degradation costs, no terminal SoC constraint and zero value for SoC left after T+2, and the following hourly prices: 80 Euro / MWh at time T (now) 150 Euro / MWh at time T+1 50 Euro / MWh at time T+2 ...
BESS policy and value functions in dynamic programming
In BESS and flexibility market channel optimization, the Bellman value function V and policy p do two different things. Imagine a two-hour BESS, 1 MW / 2 MWh, with unit efficiency, no fees or degradation costs, no terminal SoC constraint and zero value for SoC left after the later hour, and the following two hourly prices: €80/MWh now €150/MWh later The value function V(t, SoC) gives us the optimal value attainable starting at time t with energy SoC in the BESS. The policy p(t, SoC) tells us which action to take at time t given the state of the asset, here only SoC. For simplicity our action space will be three actions: buy 1 MW, hold, sell 1 MW. ...
BESS optimization, SoC, intraday arbitrage and opportunity cost
In BESS optimization, the SoC-dependent opportunity cost of an intraday arbitrage decision is the continuation value of the energy left after dispatch. Assume 1 MWh stored, 100% efficiency, a 1 MW power limit and one-hour time steps: • €80/MWh at T • €20/MWh at T+1 • €150/MWh at T+2 Holding the MWh until T+2 earns €150. Discharging at T, recharging at T+1, then discharging at T+2 earns: €80 − €20 + €150 = €210 ...
SoC state equations
A BESS optimizer isn’t a collection of independent buy/sell decisions. The state of charge (SoC) of the asset is what connects buy/sell decisions across the delivery time axis. SoC is the memory of the system, with its own set of constraints. SoC(t+1) = SoC(t) + η_c p_c(t) Δt - p_d(t) Δt / η_d A dispatch decision at time t — for example charging power p_c(t) or discharging power p_d(t) — changes the feasible set later in time by changing SoC. ...