Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: tests
on: [push, pull_request]
on:
push:
branches: [main] # PR branches are covered by pull_request (avoids duplicate runs)
pull_request:
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -10,3 +13,40 @@ jobs:
python-version: "3.12"
- run: pip install -e ".[dev]"
- run: pytest -q

package:
# the installed package (not just a checkout) must find its data
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install build && python -m build --wheel
- run: pip install dist/*.whl
- name: Smoke test outside the checkout
working-directory: /tmp
run: |
python -c "
import indflex as fx
from indflex.coordinate import load_vpp_case
r = fx.solve(fx.build_lstn(fx.load_plant('cement_golmohamadi2020'), fx.daily_price('2022-07', 1)))
assert r.status == 'optimal', r.status
assert load_vpp_case().n == 135
print('installed package OK:', fx.data.DATA_DIR)
"

notebooks:
# notebook 03 needs a Gurobi license and is not run here
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
notebook: [01_stn_vs_lstn, 02_rtn_vs_crtn, 04_d3r, 05_vpp]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev]"
- run: jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=1200 --output-dir /tmp notebooks/${{ matrix.notebook }}.ipynb
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__/
.pytest_cache/
*.egg-info/
.DS_Store
dist/
src/indflex/_data/
Binary file removed LSTN_matlab/LYU_Ruike_LSTN.pdf
Binary file not shown.
Binary file removed LSTN_matlab/LYU_Ruike_LSTN.pptx
Binary file not shown.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bids = bid(case) # LP; bids.lam

| Step | Paper | Original code | Video |
|---|---|---|---|
| LSTN | R. Lyu et al., *IEEE ISGT Europe*, 2023 | [`LSTN_matlab/`](LSTN_matlab) | |
| LSTN | R. Lyu et al., *IEEE ISGT Europe*, 2023 ([slides](https://github.com/ruikelyu/indflex/releases/tag/slides-lstn-isgt2023)) | [`matlab/lstn/`](matlab/lstn) | |
| cRTN | R. Lyu et al., "Efficient Scheduling of Discrete Industrial Processes through Continuous Modeling," *IEEE Trans. Smart Grid*, in press ([link](https://ieeexplore.ieee.org/document/11082423)) | [repo](https://github.com/ruikelyu/Efficient-Scheduling-of-Discrete-Industrial-Processes) | [Bilibili](https://www.bilibili.com/video/BV1cdurzbEgi) |
| PSI | R. Lyu et al., "Production Scheduling Identification…," *IEEE Trans. Smart Grid* 16(2), 2025 | [repo](https://github.com/ruikelyu/Production-Scheduling-Identification) | [Bilibili](https://www.bilibili.com/video/BV1bXQDYcE8Y) |
| D3R | R. Lyu et al., "Data-Driven Dimension Reduction for Industrial Load Modeling Using Inverse Optimization," *IEEE Trans. Smart Grid* 16(3), 2025 | [repo](https://github.com/ruikelyu/Data-Driven-Dimension-Reduction) | [Bilibili](https://www.bilibili.com/video/BV1JFQ1YwEsK) |
Expand All @@ -84,8 +84,9 @@ The paper repositories remain the reference for reproducing each paper exactly;
- `notebooks/`: one interactive notebook per step (sources in `tools/build_notebooks.py`)
- `docs/`: concept pages and figures
- `data/`: plain-text inputs. Plants (YAML), PJM prices and factory fleets (CSV), the VPP case (JSON and RegD signal)
- `tests/`: the Python models checked against the original MATLAB code (`tests/fixtures`, regenerated by `tools/matlab_reference/` and `tools/extract_paper_fixtures.py`)
- `STN_Implementation/`, `LSTN_matlab/`, `RTN_Implementation/`: the original MATLAB/YALMIP implementations, unchanged
- `tests/`: the Python models checked against the original MATLAB code (`tests/fixtures`, regenerated by `tools/matlab_reference/` and `tools/convert/paper_fixtures.py`)
- `tools/`: notebook and figure builders; `tools/convert/` turns the original MATLAB-era data into the plain-text files in `data/`
- `matlab/`: the original MATLAB/YALMIP implementations of STN, LSTN and RTN ([`matlab/README.md`](matlab/README.md))

## Citation

Expand All @@ -95,11 +96,7 @@ If this toolkit helps your work, please cite the paper for the step you use (tab

## Original MATLAB implementations

The folders below contain the original MATLAB implementations of State-Task Networks (STN), Linear State-Task Networks (LSTN) and Resource-Task Networks (RTN). They need MATLAB, YALMIP and a commercial solver (Gurobi or CPLEX). Each folder contains its own README.

- `STN_Implementation/`: State-Task Networks (STN)
- `LSTN_matlab/`: Linear State-Task Networks (LSTN)
- `RTN_Implementation/`: Resource-Task Networks (RTN)
The original MATLAB/YALMIP implementations of the State-Task Network (STN), Linear State-Task Network (LSTN) and Resource-Task Network (RTN) are in [`matlab/`](matlab/README.md) (`stn/`, `lstn/`, `rtn/`). They need MATLAB, YALMIP and a commercial solver (Gurobi or CPLEX).

Feel free to raise issues or submit PRs if you have any questions or suggestions. Thank you for your interest and support!

Expand All @@ -121,8 +118,6 @@ Feel free to raise issues or submit PRs if you have any questions or suggestions
- `src/indflex/`:Python 工具包
- `notebooks/`:每个步骤一个交互式笔记本
- `docs/`:原理说明与图片
- `STN_Implementation/`:状态任务网络(STN)的原始 MATLAB 实现
- `LSTN_matlab/`:线性状态任务网络(LSTN)的原始 MATLAB 实现
- `RTN_Implementation/`:资源任务网络(RTN)的原始 MATLAB 实现
- `matlab/`:状态任务网络(STN)、线性状态任务网络(LSTN)和资源任务网络(RTN)的原始 MATLAB 实现

如果您有任何疑问或建议,欢迎提出问题或提交 PR。感谢您的关注和支持!
Loading
Loading