refactor: openTEPES/{oT_IO,oT_Solver,cases}/ layered subpackages + Benders#123
Open
erikfilias wants to merge 6 commits into
Open
refactor: openTEPES/{oT_IO,oT_Solver,cases}/ layered subpackages + Benders#123erikfilias wants to merge 6 commits into
erikfilias wants to merge 6 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.
a144d84 to
c52e59d
Compare
…review
Addresses Andrés' review on the io-schema-split PR:
1. Resolve the two "cases" folders: rename repo-root cases/ (the larger
paper/study cases) to case_studies/, keeping openTEPES/cases/ as the
packaged-and-distributed (PyPI) set. No name collision left.
2/3. Move the src/ modules up to the package root, flat alongside the other
openTEPES_*.py modules, and drop the src/ subpackage:
openTEPES_IO_Schema -> openTEPES_InputSchema
openTEPES_IO_Source -> openTEPES_InputSource
openTEPES_IO_CSVSource -> openTEPES_InputCSVSource
openTEPES_IO_DuckDBSource -> openTEPES_InputDuckDBSource
openTEPES_Solver_ProblemSolving -> openTEPES_ProblemSolving
openTEPES_Solver_Benders -> openTEPES_ProblemSolvingBenders
openTEPES_Solver_DualExtraction -> openTEPES_ProblemSolvingDualExtraction
openTEPES_Solver_Persistent -> openTEPES_ProblemSolvingPersistent
openTEPES_Solver_Tuning -> openTEPES_ProblemSolvingTuning
The input-source layer keeps an Input* token (kept distinct from the
InputData layer, which is pending its own split) rather than collapsing into
InputData*. Public names stay re-exported from the package top level
(from openTEPES import open_source, ProblemSolving, lshaped, ...). README
Architecture section and CHANGELOG updated to the flat layout.
All 10 CI tests pass under HiGHS (6 single-stage, multi-stage 9n7y, Benders,
2 unit).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c52e59d to
23b376a
Compare
…]tatus_*.json The 9n / 9n_heat / sSEP run-status JSONs were per-run test output committed by accident. Remove them from the index (kept on disk) and extend .gitignore — the existing oT_Run_Status_*.json pattern did not match the openTEPES_* prefix or the lower-case run_status variant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…studies Per Andrés' suggestion. Documents that case_studies/ holds two study-specific datasets — Optimal-Power-Grid-Design (cycle-based AC-OPF expansion, SEGAN 2024) and TSO-DSO_coordination (local flexibility services in TEP, PSCC 2022) — and how they differ from the packaged/CI reference cases in openTEPES/cases/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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)