Skip to content

fix: Silent network optimization failure - #2256

Merged
fneum merged 4 commits into
PyPSA:masterfrom
pkroening:fix-2255
Aug 11, 2026
Merged

fix: Silent network optimization failure#2256
fneum merged 4 commits into
PyPSA:masterfrom
pkroening:fix-2255

Conversation

@pkroening

@pkroening pkroening commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #2255.

Changes proposed in this Pull Request

  1. Check "warning" against status instead of condition
  2. Move warning check below infeasibility check, since infeasibility conditions come with a warning status
  3. Rewrite checks with linopy constants to add indirect context
  4. Add entry to release_notes.md

Checklist

Required:

  • Changes are tested locally and behave as expected.
  • Code and workflow changes are documented.
  • A release note entry is added to doc/release_notes.md.
  • The description is human-written and any AI-generated content is marked.

Copilot AI lite review requested due to automatic review settings August 4, 2026 19:21
@pkroening pkroening changed the title fix: Silent network optimization failure #2255 fix: Silent network optimization failure Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a silent failure mode in scripts/solve_network.py by ensuring solver warnings are detected correctly (using solver status, not termination condition) and reported as hard errors, preventing export of unsolved networks.

Changes:

  • Use linopy.constants (SolverStatus, TerminationCondition) for clearer, more explicit status/termination checks.
  • Check infeasibility conditions before handling warning status (since infeasibility may also come with warning status).
  • Add a release note entry documenting the new error behavior for warning status.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/solve_network.py Updates solver result validation logic to raise on warning status and to detect infeasibility via explicit termination-condition constants.
doc/release_notes.md Documents the behavioral change (raise error when solver status is warning).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/solve_network.py
@pkroening
pkroening marked this pull request as ready for review August 4, 2026 20:33
@pkroening

Copy link
Copy Markdown
Contributor Author

I want to add that this PR was created without AI. This is my first PR and I was not aware that Copilot reviews by default. I have now opted out. :)

@fneum fneum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Thank you very much!

@fneum
fneum enabled auto-merge (squash) August 11, 2026 16:13
@fneum
fneum disabled auto-merge August 11, 2026 16:13
@fneum
fneum merged commit 1194dc7 into PyPSA:master Aug 11, 2026
7 of 8 checks passed
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.

Silent network optimization failure

3 participants