refactor: openTEPES/{oT_IO,oT_Solver,cases}/ layered subpackages + Benders#123
Open
erikfilias wants to merge 3 commits into
Open
refactor: openTEPES/{oT_IO,oT_Solver,cases}/ layered subpackages + Benders#123erikfilias wants to merge 3 commits into
erikfilias wants to merge 3 commits into
Conversation
…shaped Benders + CI extension
Layer 2 (oT_IO/): openTEPES_InputSource.py (496 lines) -> Schema/Source/CSVSource/DuckDBSource (5 files)
Layer 5 (oT_Solver/): openTEPES_ProblemSolving.py (304 lines) -> Persistent/Tuning/DualExtraction/ProblemSolving (4
files)
+ new Benders.py (classical L-shaped for transmission expansion)
Layout: all 9 case studies move to openTEPES/cases/<case>/
BREAKING: clean break, no deprecation shim. External imports must update:
from openTEPES.openTEPES_InputSource -> openTEPES.oT_IO
from openTEPES.openTEPES_ProblemSolving -> openTEPES.oT_Solver.ProblemSolving
openTEPES_run(DirName='.../openTEPES', CaseName='9n') -> DirName='.../openTEPES/cases'
CI matrix grows from 3 to 7 tests: 6 single-stage cases + 1 multi-stage (9n7y, first
multi-stage coverage) + 1 Benders compatibility test (asserts L-shaped converges to
joint-LP cost on 9n within 1e-4 relative tol). Inline coverage matrix in test_run.py
documents which case validates which feature (sSEP -> hydrogen+reservoirs already covered).
No behaviour change. 10/10 tests pass under HiGHS in 120 s. First PR of the layered-
architecture restructure proposed in Docs/architecture/opentepes_architecture_proposal.md.
…VG to README The previous commit (35ab13a) moved every bundled case study to openTEPES/cases/ but only staged the new locations — the 420 files at the old openTEPES/<case>/ paths were left tracked in HEAD even though they had been physically removed from the working tree. This commit finishes the move by staging those deletions so the repository no longer carries duplicates. Also adds a new 'Architecture' section to README.md with the layered package diagram (doc/img/openTEPES_architecture.svg, copied from the RFC at Docs/architecture/opentepes_architecture_proposal.md) so new readers can see the six-layer model at a glance.
Per maintainer preference: one src/ folder with the layer encoded in the filename (openTEPES_IO_*, openTEPES_Solver_*) instead of per-layer subfolders. Single src/__init__.py re-exports the full public surface. Pure rename — no logic change; all imports updated.
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.
Summary
Layered restructure of the openTEPES package bundled with a Benders compatibility test and CI matrix extension. Breaking import + path changes — no shim.
Structural changes
openTEPES/cases/ all 9 case studies move here (was top-level)
openTEPES/oT_IO/ Schema, Source, CSVSource, DuckDBSource (was openTEPES_InputSource.py)
openTEPES/oT_Solver/ Persistent, Tuning, DualExtraction, ProblemSolving, Benders (was openTEPES_ProblemSolving.py + new)
Breaking changes for users
New: classical Benders
oT_Solver/Benders.lshaped() — master = vNetworkInvest only, subproblem = the full openTEPES model with each candidate
pinned via an explicit equality (mutable Param) and duals read through the dual Suffix. Validates on 9n: joint LP
252.201330 MEUR vs Benders 252.201345 MEUR in 8 iterations (rel err 5.78e-08, ~5 s). Acts as a compatibility guard
for the rest of the architecture restructure.
GitHub Action - CI matrix
3 → 7 tests in tests/test_run.py:
coverage of the representative-stages pattern documented in doc/md/QA.md
reservoirs were already covered by sSEP; now visible)
multi-stage solve)