From f43bd746450a9d9058f3ad252261fa667220da39 Mon Sep 17 00:00:00 2001 From: Luke Kiernan Date: Thu, 17 Sep 2026 14:59:59 -0600 Subject: [PATCH] Pass the evaluation data into calculate_aux_variable_value! The loop already holds the evaluator that just ran, so hand it to the aux-var calculation instead of making the implementation look it up. POM's power-flow read-back searched for it with a `findlast` over a `Dict`, which returns an arbitrary evaluator once more than one is registered. Co-Authored-By: Claude Opus 5 (1M context) --- src/common_models/interfaces.jl | 2 ++ src/core/optimization_container.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common_models/interfaces.jl b/src/common_models/interfaces.jl index f52e2da1..77d9e3e3 100644 --- a/src/common_models/interfaces.jl +++ b/src/common_models/interfaces.jl @@ -206,6 +206,8 @@ end """ Extension point: Calculate auxiliary variable values. Concrete implementations in PowerOperationsModels for specific aux variable types. +Evaluator-bound aux variables get the `AbstractEvaluationData` that produced them +as a fourth argument, so the implementation does not have to look it up. """ function calculate_aux_variable_value! end diff --git a/src/core/optimization_container.jl b/src/core/optimization_container.jl index ca1fb9f6..9841558c 100644 --- a/src/core/optimization_container.jl +++ b/src/core/optimization_container.jl @@ -1332,7 +1332,7 @@ function calculate_aux_variables!( @debug "Processing evaluator $(T)" evaluate!(data, container, system) for key in evaluator_aux_var_keys - calculate_aux_variable_value!(container, key, system) + calculate_aux_variable_value!(container, key, system, data) end end end