Skip to content

fix(optimizer): guard relaxed physical flows - #904

Merged
frahlg merged 1 commit into
masterfrom
agent/reject-unsafe-relaxed
Aug 11, 2026
Merged

frahlg merged 1 commit into
masterfrom
agent/reject-unsafe-relaxed

Conversation

@frahlg

@frahlg frahlg commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep storage and meter direction guards when a relaxed model could profit from simultaneous charge and discharge or import and export.
  • Retry one cost-neutral storage replay with a direction guard while keeping the same deadline.
  • Keep progressive hedging off models that require mixed-integer direction guards.

Before and after

On 5b9ec177, the new regression set produced 10 failures. Shared and recourse returned internal_error under negative prices, multistage first solved an invalid LP and retried, and replay-blind cases returned ok: true with a solver objective that did not match the net plan. One meter case had simultaneous import and export; one PV-bonus case had simultaneous charge and discharge.

With this change, unsafe cases report the actual MILP formulation and replay cleanly. Safe relaxed cases remain continuous. A neutral CLARABEL cycle retries once with a storage direction guard.

Verification

  • 32 focused flow-safety tests pass.
  • 166 optimizer tests pass.
  • Full Go suite and Core to optimizer contract pass.
  • make verify-all passes, including migration checks, vet, builds, and Linux arm64, Linux amd64, and Windows amd64 cross-builds.
  • Two independent rereviews found no P0 to P3 issue.

Part of #885.

@frahlg
frahlg merged commit f36cd79 into master Aug 11, 2026
14 checks passed
@frahlg
frahlg deleted the agent/reject-unsafe-relaxed branch August 11, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant