Skip to content

Restructure: matlab/ folder, packaged data, slimmer repo, more CI - #2

Merged
ruikelyu merged 2 commits into
mainfrom
restructure
Nov 8, 2026
Merged

ruikelyu merged 2 commits into
mainfrom
restructure

Conversation

@ruikelyu

@ruikelyu ruikelyu commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • matlab/: the three original MATLAB folders move into matlab/{stn,lstn,rtn}, with an overview README that maps each to its Python counterpart. The scripts are unchanged and still run from their own folders.

  • Slides out of the tree: the LSTN slides (pptx 10 MB + pdf 1.4 MB, about 85% of the tracked file size) are now attached to the slides-lstn-isgt2023 release and linked from the README. They remain in git history.

  • Packaging fix: data/ is now bundled into the installed package as indflex/_data. Before this, a non-editable pip install contained no data, and load_plant(...) failed.

  • Trimmed data: only the factory fleets that are used (5, 200) and the paper's 2,000-factory case are kept.

  • tools/convert/: the one-off converters move here. All paths, provenance headers, README and docs are updated.

  • CI: a job builds the wheel, installs it, and smoke-tests it outside the checkout. A second job runs notebooks 01, 02, 04 and 05 (03 needs a Gurobi license).

  • CI: pushes trigger runs only on main; pull requests are covered by pull_request (no duplicate runs).

The thesis citation, Colab badges and web-demo export were pushed after this PR was merged; they are in #3.

Test plan

  • pytest: 42 tests pass
  • Built wheel installed into a fresh venv outside the repo: loads a plant, solves an LSTN, loads the VPP case
  • tools/convert/legacy_data.py re-run from the new paths: data identical except provenance comments
  • tools/matlab_reference/make_reference.m re-run from the new paths: fixtures byte-identical
  • README quickstart runs; all relative links in README, matlab/README.md and docs/ resolve; notebook 01 executes
  • GitHub Actions: tests, package and notebook jobs

🤖 Generated with Claude Code

Summary by Sourcery

Restructure the repository and packaging so the original MATLAB code is organized, the installed Python package includes its required data, and CI validates wheels and notebooks.

New Features:

  • Bundle the project’s plant, price, fleet, and VPP data with the installed Python package so data-dependent APIs work after a wheel installation.
  • Add CI coverage for packaged-wheel smoke tests and execution of supported notebooks.

Bug Fixes:

  • Fix installed-package data discovery so non-editable installations can load plants and VPP cases.

Enhancements:

  • Reorganize the original MATLAB implementations under a documented matlab/ hierarchy and move one-off conversion utilities under tools/convert/.
  • Reduce repository size by removing unused fleet datasets and moving the LSTN presentation files to a release attachment.

CI:

  • Run tests only on pushes to main and on pull requests, avoiding duplicate branch runs.
  • Build and install the wheel in CI, smoke-test it outside the checkout, and execute notebooks 01, 02, 04, and 05.

Documentation:

  • Update README and documentation links, provenance references, and MATLAB/Python model mappings for the reorganized repository.

Tests:

  • Validate packaged data access, model solving, VPP loading, and supported notebook execution in continuous integration.

Chores:

  • Retain only the fleet cases used by tests, notebooks, and the paper’s largest example.

- Move STN_Implementation, LSTN_matlab, RTN_Implementation into
  matlab/{stn,lstn,rtn} with an overview README (scripts unchanged)
- Move the LSTN slides (11.9 MB) to the slides-lstn-isgt2023 release
- Ship data/ inside the installed package (indflex/_data); previously a
  non-editable install could not load plants, prices or the VPP case
- Keep only the factory fleets that are used (5, 200) plus the paper's
  2,000-factory case
- Move one-off converters to tools/convert/; update all paths, provenance
  headers, README and docs
- CI: build and install the wheel and smoke-test it outside the checkout;
  run the four free-solver notebooks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Trim the tracked fleet inputs to the 5-, 200-, and 2,000-factory cases used by tests, notebooks, and the paper.

  • data/fleets/lstn_fleet_10.csv (deleted)
  • data/fleets/lstn_fleet_2.csv (deleted)
  • data/fleets/lstn_fleet_20.csv (deleted)
  • data/fleets/lstn_fleet_40.csv (deleted)
  • data/fleets/lstn_fleet_80.csv (deleted)

Implementation

Check packaged-data discovery and the wheel inclusion configuration together, since the installed package relies on both to load plants, prices, fleets, and VPP data.

  • pyproject.toml L30, L35-37
  • src/indflex/data.py L3-4, L20-21

Review converter and MATLAB reference path updates together with the relocated MATLAB sources, ensuring the moved scripts and inputs remain usable from their new folders.

  • tools/matlab_reference/make_reference.m L12-60 (4 small edits)

Configuration

Change CI triggers to avoid duplicate main-branch push and pull-request runs, and add wheel-install and notebook execution jobs.

  • .github/workflows/tests.yml L2-5, L16-52

Ignore newly excluded or generated repository artifacts as appropriate after the restructuring.

  • .gitignore L8-9

Documentation

Update repository guides, citations, and provenance references for the MATLAB folder move, converter relocation, and release-hosted slides.

  • README.md L68-121 (4 small edits)
  • docs/01_stn_lstn.md L40
  • docs/README.md L25
  • docs/notes_on_paper_code.md L7-8
  • matlab/README.md L1-13

Other changes

Files not grouped.

  • data/plants/cement_golmohamadi2020.yaml L1
  • data/plants/steel_powder_lu2021.yaml L1
  • data/plants/steel_powder_lu2021_lstn.yaml L1
  • data/plants/steelmaking_zhang2017.yaml L1
  • tools/convert_legacy_data.py L4-128 (9 small edits)
  • tools/extract_paper_fixtures.py L3-4, L13
  • tools/convert_vpp_data.py L6, L19
  • LSTN_matlab/LYU_Ruike_LSTN.pdf
  • LSTN_matlab/LYU_Ruike_LSTN.pptx
  • matlab/lstn/LSTN_model.m
  • matlab/lstn/LSTN_model_aggregated.m
  • matlab/lstn/README.md
  • matlab/lstn/data_generate_parameters.m
  • matlab/lstn/load_parameters_Lu_milp.xlsx
  • matlab/lstn/parameter_Lu_milp.m
  • matlab/lstn/parameter_factories/F_parameters.mat
  • matlab/lstn/parameter_factories/F_parameters_10.mat
  • matlab/lstn/parameter_factories/F_parameters_2.mat
  • matlab/lstn/parameter_factories/F_parameters_20.mat
  • matlab/lstn/parameter_factories/F_parameters_200.mat
  • matlab/lstn/parameter_factories/F_parameters_2000.mat
  • matlab/lstn/parameter_factories/F_parameters_40.mat
  • matlab/lstn/parameter_factories/F_parameters_5.mat
  • matlab/lstn/parameter_factories/F_parameters_80.mat
  • matlab/lstn/rt_hrl_lmps_202208.xlsx
  • matlab/rtn/README.md
  • matlab/rtn/add_param_and_var.m
  • matlab/rtn/generate_steelmaking_data.m
  • matlab/rtn/load_parameters_zhang_rtn.xlsx
  • matlab/rtn/main_basic_rtn.m
  • matlab/rtn/param_zhang_2017.mat
  • matlab/rtn/parameter_zhang_rtn.m
  • matlab/rtn/rt_hrl_lmps.xlsx
  • matlab/stn/README.md
  • matlab/stn/data_generate_cement.m
  • matlab/stn/data_generate_steelpowder.m
  • matlab/stn/data_price.m
  • matlab/stn/load_parameters_Golmo_milp.xlsx
  • matlab/stn/load_parameters_Lu_milp.xlsx
  • matlab/stn/rt_hrl_lmps.xlsx
  • matlab/stn/stn_demo.m
  • matlab/stn/stn_model_milp.m
  • matlab/stn/typical_load_stn.pdf

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

…runs)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ruikelyu
ruikelyu merged commit 69063d8 into main Nov 8, 2026
7 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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