Close Enough? Turning GENCO Predictions into Feasible AC Solutions

#28
by Criens - opened

1. Introduction

Can a GENCO AC-OPF prediction with small residuals be turned into an independently verified feasible operating point, with limited adjustments and a small change in generation cost?

This study investigates AC feasibility restoration for GENCO predictions on the IEEE14 and IEEE30 systems. The workflow combines separately trained GENCO models, constrained optimization, and an independent AC constraint checker. Restoration is formulated as minimizing the normalized deviation from a prediction subject to AC power-flow equations and operating limits. The resulting solutions are independently checked against these constraints.

The study compares four approaches, namely raw GENCO predictions, feasibility restoration, cold-start AC-OPF, and GENCO-initialized AC-OPF. The evaluation examines feasibility, prediction adjustments, generation cost, and end-to-end runtime to assess how much correction is needed and what computational cost it incurs.

2. Experimental setup

I trained separate GENCO AC-OPF models for IEEE14 and IEEE30 using OpenGridFM's gridfm-graphkit, with 200 epochs and seed 42 for each grid. Each model is evaluated on its corresponding grid using its best-validation checkpoint and saved normalization statistics. The model parameters remain fixed throughout the restoration experiment.

For each grid, I sampled 10 validation cases and 50 held-out test cases from the recorded partitions using seed 42. The workflow was checked on the validation cases before evaluating all four methods on the same test cases.

3. AC model and restoration methods

For a case with n buses and m active generators, the operating point and complex bus voltages are

x=(θ,v,p,q),θ,v,q∈Rn,p∈Rm,Vi=viejθi. x=(\theta,v,p,q),\qquad \theta,v,q\in\mathbb{R}^{n},\quad p\in\mathbb{R}^{m},\qquad V_i=v_i e^{\mathrm{j}\theta_i}.

Here p is generator active power in MW, and q is bus-aggregate reactive generation in MVar. Voltage magnitudes are in p.u. and angles are in radians. Let C_g map active generators to buses, and let C_f and C_t select the from-end and to-end bus voltages of each branch. The exported admittance matrices include the source branch parameters and bus shunts and are scaled so that the following expressions return complex powers in MW + jMVar:

Sbus(V)=diag⁡(V)YV‾,Sf(V)=diag⁡(CfV)YfV‾,St(V)=diag⁡(CtV)YtV‾. \begin{aligned} S^{\mathrm{bus}}(V)&=\operatorname{diag}(V)\overline{YV},\\ S^f(V)&=\operatorname{diag}(C_fV)\overline{Y_fV},\\ S^t(V)&=\operatorname{diag}(C_tV)\overline{Y_tV}. \end{aligned}

For fixed case parameters a, the AC feasible set is

F(a)={x:Cgp−Pd=Re⁡Sbus(V),q−Qd=Im⁡Sbus(V),p‾g≤pg≤p‾g,g=1,…,m,q‾i≤qi≤q‾i,i=1,…,n,v‾i≤vi≤v‾i,i=1,…,n,θi=θiref,i∈Bref,∣Sℓα(V)∣≤S‾ℓ,ℓ∈Lrated,α∈{f,t},Δ‾ℓ≤θf(ℓ)−θt(ℓ)≤Δ‾ℓ,ℓ∈Langle}. \mathcal{F}(a)=\left\{x:\begin{aligned} C_gp-P^d&=\operatorname{Re}S^{\mathrm{bus}}(V),\\ q-Q^d&=\operatorname{Im}S^{\mathrm{bus}}(V),\\ \underline p_g&\le p_g\le\overline p_g,\qquad g=1,\ldots,m,\\ \underline q_i&\le q_i\le\overline q_i,\qquad i=1,\ldots,n,\\ \underline v_i&\le v_i\le\overline v_i,\qquad i=1,\ldots,n,\\ \theta_i&=\theta_i^{\mathrm{ref}},\qquad i\in\mathcal{B}_{\mathrm{ref}},\\ |S^\alpha_\ell(V)|&\le\overline S_\ell,\qquad \ell\in\mathcal{L}_{\mathrm{rated}},\quad\alpha\in\{f,t\},\\ \underline\Delta_\ell&\le\theta_{f(\ell)}-\theta_{t(\ell)}\le\overline\Delta_\ell, \qquad\ell\in\mathcal{L}_{\mathrm{angle}} \end{aligned}\right\}.

The loads are P^d and Q^d. The sets in the last three lines identify reference buses, branches with positive thermal ratings, and branches with active angle-difference limits. Bounds and limits are taken from each case after removing inactive equipment. The selected cases have one active generator per generator bus, so the bus-aggregate reactive-generation bounds match the individual generator bounds.

Let x^\widehat{x} denote the denormalized GENCO prediction. Restoration locally solves

D(x,x^), \underset{x\in\mathcal{F}(a)}{\operatorname{minimize}}\quad D(x,\widehat{x}),

where the normalized distance is

D(x,x^)=14[1n∑i=1n(vi−v^isiv)2+1n∑i=1n(θi−θ^i1 rad)2+1m∑g=1m(pg−p^gsgp)2+1n∑i=1n(qi−q^isiq)2]. \begin{aligned} D(x,\widehat{x})=\frac14\Biggl[ &\frac1n\sum_{i=1}^{n}\left(\frac{v_i-\widehat v_i}{s_i^v}\right)^2 +\frac1n\sum_{i=1}^{n}\left(\frac{\theta_i-\widehat\theta_i}{1\,\mathrm{rad}}\right)^2\\ &+\frac1m\sum_{g=1}^{m}\left(\frac{p_g-\widehat p_g}{s_g^p}\right)^2 +\frac1n\sum_{i=1}^{n}\left(\frac{q_i-\widehat q_i}{s_i^q}\right)^2 \Biggr]. \end{aligned}

The scales are

siv=max⁡(v‾i−v‾i, 0.01),sgp=max⁡(p‾g−p‾g, 1 MW),siq=max⁡(q‾i−q‾i, 1 MVar). \begin{aligned} s_i^v&=\max(\overline v_i-\underline v_i,\,0.01),\\ s_g^p&=\max(\overline p_g-\underline p_g,\,1\,\mathrm{MW}),\\ s_i^q&=\max(\overline q_i-\underline q_i,\,1\,\mathrm{MVar}). \end{aligned}

Each variable group is averaged first, and the four groups receive equal weight. Angles use the same fixed reference. The original prediction remains the distance target when the initial solver point is clipped to variable bounds.

The four methods are:

  1. Raw GENCO: return the prediction and independently check its feasibility.
  2. GENCO + restoration: locally minimize the distance defined above over the AC feasible set.
  3. Cold-start AC-OPF: minimize generation cost from zero angles, unit voltage, and midpoint generation bounds, clipped to variable bounds.
  4. GENCO-initialized AC-OPF: minimize the same generation cost starting from the GENCO prediction.

The two AC-OPF baselines locally solve

C(p),C(p)=∑g=1m(c0g+c1gpg+c2gpg2). \underset{x\in\mathcal{F}(a)}{\operatorname{minimize}}\quad C(p), \qquad C(p)=\sum_{g=1}^{m}\left(c_{0g}+c_{1g}p_g+c_{2g}p_g^2\right).

All three optimization methods use CasADi and IPOPT. Restoration targets minimum change, while the two AC-OPF baselines target generation cost.

4. Feasibility checks and tolerance sensitivity

A separate NumPy evaluator recomputes complex power injections and branch flows and checks all nine constraint groups. For equality constraints and inequalities written with a zero right-hand side, violations are

νkeq(x)=∣hk(x)∣,νkineq(x)=max⁡{gk(x),0}, \nu_k^{\mathrm{eq}}(x)=|h_k(x)|,\qquad \nu_k^{\mathrm{ineq}}(x)=\max\{g_k(x),0\},

where the constraints are h_k(x) = 0 and g_k(x) <= 0, respectively. Thermal violations use the excess apparent-power magnitude above the branch rating.

Power-related violations are divided by the system base power of 100 MVA. Voltage and angle violations are expressed in p.u. and radians. Using d_k = 100 for power violations measured numerically in MW, MVar, or MVA, and d_k = 1 for voltage and angle violations, define

ν~k(x)=νk(x)dk,η(x)=max⁡kν~k(x). \widetilde\nu_k(x)=\frac{\nu_k(x)}{d_k},\qquad \eta(x)=\max_k\widetilde\nu_k(x).

Here, k indexes individual scalar constraints across the nine constraint groups.

A scenario passes when all checked quantities are finite and

η(x)≤ε,ε=10−5. \eta(x)\le\varepsilon,\qquad\varepsilon=10^{-5}.

02_constraint_heatmap

The heatmaps show the maximum violation within each constraint group for every test scenario. Blue indicates values below the tolerance, and red indicates exceedances. Raw predictions exhibit power-balance and reactive-generation-limit violations, with additional from-end thermal-limit violations on IEEE30. After restoration, every checked constraint group passes in all test cases.

03_tolerance_sensitivity

The tolerance-sensitivity curves show how the fraction of feasible scenarios changes with the acceptance tolerance. The vertical line marks 1e-5. All curves recheck the same fixed predictions and solutions without rerunning optimization.

5. Restoration results

01_feasibility_overview

The overview compares joint feasibility and each scenario's maximum violation before and after restoration. At the selected tolerance, restoration and both AC-OPF baselines pass all checks in all 100 test scenarios.

Method IEEE14: cases passing / 50 IEEE30: cases passing / 50
Raw GENCO 1/50 0/50
GENCO + restoration 50/50 50/50
Cold-start AC-OPF 50/50 50/50
GENCO-initialized AC-OPF 50/50 50/50

The largest normalized violations after restoration are 3.52e-9 on IEEE14 and 2.61e-9 on IEEE30.

04_adjustment

The adjustment plots show cumulative distributions of per-scenario root-mean-square changes in active generation, reactive generation, voltage magnitude, and voltage angle. Reactive-generation RMS adjustments are evaluated at generator buses, while voltage adjustments are evaluated at all buses. Median active-generation adjustments are 0.00466 MW for IEEE14 and 0.07556 MW for IEEE30. The voltage-magnitude axis uses units of 0.001 p.u., and voltage-angle changes are shown in degrees.

For each scenario, the signed relative generation-cost difference is

ΔC(x)=100(C(p)C(pref)−1) %. \Delta_C(x)=100\left(\frac{C(p)}{C(p^{\mathrm{ref}})}-1\right)\,\%.

The reference is the stored local AC-OPF solution for that scenario. Positive values indicate higher cost, and negative values indicate lower cost.

05_cost

Generation costs are compared with each scenario's stored local AC-OPF reference solution. Mean relative cost differences after restoration are 0.0831% for IEEE14 and 0.0630% for IEEE30. The left panel shows their distributions. The right panel compares raw and restored cost differences for each scenario. Points above the diagonal indicate a cost increase during restoration.

6. Runtime and network examples

Runtime is measured on an Apple M4 Pro CPU with batch size one, two PyTorch inference threads, and BLAS thread limits set to one. Each test case is measured five times. Online timing includes preprocessing, inference where applicable, constraint checks, fresh optimization-model construction, numerical solution, extraction, and return overhead. Offline training, model loading, and startup warmup are outside the timed interval.

The table reports mean milliseconds per case. Parentheses give the standard deviation of the five repeat means.

Method IEEE14: ms/case IEEE30: ms/case
Raw GENCO + check 9.001 (0.055) 9.882 (0.098)
GENCO + restoration 19.924 (0.104) 30.618 (0.215)
Cold-start AC-OPF 10.467 (0.083) 20.164 (0.120)
GENCO-initialized AC-OPF 19.378 (0.108) 29.602 (0.245)

06_runtime

The upper panels show mean component times. The lower panels show distributions of per-case median runtimes across the five repeats. Both GENCO-assisted optimization pipelines take longer overall than cold-start AC-OPF in this CPU experiment. GENCO initialization slightly reduces solver iterations, but inference overhead outweighs the solver-time savings.

07_network_case

The network plots show the case with the largest raw normalized violation for each grid: IEEE14 scenario 247972 and IEEE30 scenario 29986. Node colors indicate the voltage-magnitude change from prediction to restoration, measured in units of 0.001 p.u. Red indicates an increase and blue a decrease. Gold rings identify generator buses. Each panel uses its own color scale.

7. Discussion

The experiments show that GENCO predictions can be converted into independently checked feasible AC operating points with small adjustments and modest reference-cost differences. Comparing restoration with GENCO-initialized AC-OPF also separates two objectives: preserving the predicted operating point and further optimizing its generation cost.

The current CPU implementation restores feasibility but takes longer overall than cold-start AC-OPF. Larger networks, batched inference, and reuse of optimization models are useful next experiments for identifying when this workflow can also reduce total runtime.

Code and resources

Acknowledgements

I thank the GridFM community for organizing the challenge and the GENCO and OpenGridFM teams for making their research and software openly available.

Team and contact

Sign up or log in to comment