Repository navigation
Support multidimensional slope-to-breakpoint conversion - #1013
Open
MaykThewessen wants to merge 2 commits into
Open
MaykThewessen wants to merge 2 commits into
MaykThewessen wants to merge 2 commits into
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
MaykThewessen
marked this pull request as ready for review
October 6, 2026 15:55
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
AI-assisted implementation and factual description, written with GPT-6.
Slopes.to_breakpoints()currently rejects a DataArray with both snapshot and component dimensions, although piecewise formulations already accept those dimensions. This adds a vectorized conversion for multiple entity dimensions, with scalar or DataArray initial values, exact entity-coordinate alignment and trailing NaN padding. Existing single-entity conversion stays unchanged.The change supports the snapshot-dependent cost proposal in PyPSA #1914. Breakpoint coordinates remain positional, as in the existing API.
Validation: 136 slope/conversion tests passed, including 28 new cases for broadcasting, initial values, coordinate mismatch, ragged inputs and empty inputs. Ruff lint and formatting passed. Tests ran against this branch's source; no solver calls were needed for this mathematical conversion.
python -m pytest test/test_piecewise_constraints.py test/test_piecewise_snapshot_slopes.py -q -k 'SlopesToPointsPrivate or SlopesToBreakpoints or SlopesValueType or SlopesValidationErrors or snapshot_slopes' -o addopts=Downstream validation with the paired patches passed 7244 tests and a representative 1008-hour solve with six accepted 168-hour chunks. The integration removed 246 to 282 eligible LP Generator rows per chunk while retaining physical tranche outputs. Reloaded results had no thermal violations or slack, and snapshot-weighted generator operating costs exactly matched the original tranche accounting. This compatible scenario explicitly disabled ramp penalties; positive per-tranche ramp costs remain an aggregation exclusion by default. The Linux downstream locked environment installation and quick suite also passed. These results do not establish annual behaviour or a performance gain.