Skip to content

Simple SCOPF model leveraging MadNLP two-stage solver#49

Open
michel2323 wants to merge 1 commit into
mainfrom
scopf-schur-twostage
Open

Simple SCOPF model leveraging MadNLP two-stage solver#49
michel2323 wants to merge 1 commit into
mainfrom
scopf-schur-twostage

Conversation

@michel2323

@michel2323 michel2323 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Add a lightweight N-1 security-constrained AC OPF independent of the GOC3 machinery, in both monolithic and Schur-decomposable forms:

  • scopf_model (src/scopf_simple.jl): replicates the base AC OPF across a scenario dimension (column 1 = base, 2..K+1 = contingencies), supporting generator and branch outages with bounded corrective generator recourse. Includes the MATPOWER rateA == 0 ("unlimited") fix. polar and rect forms.
  • scopf_twostage_model (src/scopf_twostage.jl): the same problem on a TwoStageExaCore (base = first stage, each contingency = an EachScenario block), solved with MadNLP's SchurComplementKKTSystem; returns the Schur partition tags as a 4th value.
  • examples/scopf.jl: CLI-driven driver (case/mode/form/gpu/inertia/...) over the matching <case>.Ctgs line-contingency list, plus case9/case118 data.
  • test/scopf_tests.jl: case9 N-1 agreement test (CPU single vs CPU/GPU two-stage) on objective and base/scenario dispatch, wired into runtests.jl.

@michel2323 michel2323 force-pushed the scopf-schur-twostage branch from fc983f9 to 6e44636 Compare June 24, 2026 13:18
Add a lightweight N-1 security-constrained AC OPF independent of the GOC3
machinery, in both monolithic and Schur-decomposable forms:

- scopf_model (src/scopf_simple.jl): replicates the base AC OPF across a
  scenario dimension (column 1 = base, 2..K+1 = contingencies), supporting
  generator and branch outages with bounded corrective generator recourse.
  Includes the MATPOWER rateA == 0 ("unlimited") fix. polar and rect forms.
- scopf_twostage_model (src/scopf_twostage.jl): the same problem on a
  TwoStageExaCore (base = first stage, each contingency = an EachScenario
  block), solved with MadNLP's SchurComplementKKTSystem; returns the Schur
  partition tags as a 4th value.
- examples/scopf.jl: CLI-driven driver (case/mode/form/gpu/inertia/...) over
  the matching <case>.Ctgs line-contingency list, plus case9/case118 data.
- test/scopf_tests.jl: case9 N-1 agreement test (CPU single vs CPU/GPU
  two-stage) on objective and base/scenario dispatch, wired into runtests.jl.
- Pin MadNLP + MadNLPGPU to the schur-design-constraints branch via [sources]
  so Pkg.test (local and CI) gets the SchurComplementKKTSystem support; the
  registry release rejects it. README/docs touchups.
@michel2323 michel2323 force-pushed the scopf-schur-twostage branch from f97b01f to 1fb3efe Compare June 24, 2026 14:47
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.20588% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.81%. Comparing base (89e36fd) to head (1fb3efe).

Files with missing lines Patch % Lines
src/scopf_twostage.jl 72.10% 41 Missing ⚠️
src/scopf_simple.jl 83.20% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
- Coverage   88.86%   86.81%   -2.05%     
==========================================
  Files           9       11       +2     
  Lines        1275     1547     +272     
==========================================
+ Hits         1133     1343     +210     
- Misses        142      204      +62     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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