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
48 changes: 38 additions & 10 deletions .github/workflows/test-binder-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ on:
pull_request:
paths:
- 'environment.yml'
- 'postBuild'
- '.gitmodules'
- '.github/workflows/test-binder-environment.yml'
push:
branches:
- main
paths:
- 'environment.yml'
- 'postBuild'
- '.gitmodules'
- '.github/workflows/test-binder-environment.yml'

jobs:
Expand All @@ -23,7 +27,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

with:
submodules: recursive

- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -47,7 +53,14 @@ jobs:
run: |
echo "Creating conda environment from environment.yml..."
mamba env create -n test-binder-env -f environment.yml


- name: Install openTEPES from submodule (mirror postBuild)
shell: bash -l {0}
run: |
conda activate test-binder-env
git submodule update --init --recursive
pip install -e ./external/openTEPES

- name: Verify environment
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -100,22 +113,37 @@ jobs:
except Exception as e:
print(f'✗ highspy import failed: {e}')
failed.append('highspy')
# Test scikit-learn-extra

# Report the openTEPES version so a downgrade is visible in the log
try:
import sklearn_extra
print('✓ scikit-learn-extra imported successfully')
except Exception as e:
print(f'✗ scikit-learn-extra import failed: {e}')
failed.append('scikit-learn-extra')

import openTEPES
print('openTEPES version:', openTEPES.__version__)
except Exception:
pass

if failed:
print(f'\n❌ {len(failed)} package(s) failed to import: {", ".join(failed)}')
sys.exit(1)
else:
print('\n✅ All core dependencies are working!')
EOF

- name: Solve the 9n case (catches a silent openTEPES downgrade)
shell: bash -l {0}
run: |
conda activate test-binder-env
python << 'EOF'
import glob
from openTEPES.openTEPES import openTEPES_run

# DIR is the parent folder of the case; CaseName is the bundled 9-node case.
openTEPES_run('notebooks', '9n', 'appsi_highs', 'Yes', 'No')

results = glob.glob('notebooks/9n/oT_Result_*9n*.csv')
print(f'9n solved, {len(results)} result file(s) written')
assert results, 'no result files written - the 9n solve did not complete'
EOF

- name: Summary
if: success()
shell: bash -l {0}
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,13 @@ dmypy.json

# Pyre type checker
.pyre/

# Folders generated by running the sweep-mode notebooks (5.x)
notebooks/sweepA_base/
notebooks/sweepA_high/
notebooks/sweepB/
notebooks/sweepC/
notebooks/sweep*_merged/

# Folders generated by running the planning/operation problem notebooks (4.x)
notebooks/work_*/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/openTEPES"]
path = external/openTEPES
url = https://github.com/IIT-EnergySystemModels/openTEPES.git
7 changes: 3 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ dependencies:
- glpk
- coincbc
- rise
- numpy<2
- scipy
- pandas
- matplotlib
- scikit-learn
- pip:
- numpy<2
- openTEPES
- tsam
- highspy
- scikit-learn-extra
# openTEPES itself is installed from the git submodule (external/openTEPES) by the
# postBuild script, in editable mode, so the tutorial uses the repository version
# instead of the PyPI release.
1 change: 1 addition & 0 deletions external/openTEPES
Submodule openTEPES added at 9fbb22
21 changes: 12 additions & 9 deletions notebooks/00-index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,24 @@
},
{
"cell_type": "markdown",
"source": [
"## 4. Execution Modes\n",
"\n",
"The openTEPES model can solve multiples problems of power system optimization like transmission expansion planning, generation expansion planning, unit commitment, optimal transmission switching, or economic dispatch.\n",
"\n",
"Here, you can find some example about how perform some of these problems:\n",
"\n",
"- [04-Execution-Modes.ipynb](04-Execution-Modes.ipynb)"
],
"source": "## 4. Planning and Operation Problems\n\nThe openTEPES model can solve several power system optimization problems, such as transmission expansion planning, generation expansion planning, unit commitment, optimal transmission switching, and economic dispatch.\n\nHere you can find examples of how to perform some of these problems:\n\n- [04-Planning-and-Operation-Problems.ipynb](04-Planning-and-Operation-Problems.ipynb)",
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "markdown",
"source": [
"## 5. Sweep Modes: running many cases at once\n",
"\n",
"These notebooks show how to run a *sweep* \u2014 many cases in one call \u2014 and collect the results. openTEPES has three sweep modes, from the most general to the fastest.\n",
"\n",
"- [05-Sweep-Modes.ipynb](05-Sweep-Modes.ipynb)"
],
"metadata": {}
}
],
"metadata": {
Expand Down
9 changes: 8 additions & 1 deletion notebooks/01-openTEPES-Demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
"In case, you prefer use your personal computer, the installation of the openTEPES model and its dependencies, please follow the section **installation** of the [README](https://github.com/IIT-EnergySystemModels/openTEPES#readme)."
]
},
{
"cell_type": "code",
"source": "# Environment check: confirm which openTEPES, Python, and solver you are running.\nimport sys\nimport openTEPES\n\nprint(\"openTEPES version:\", openTEPES.__version__)\nprint(\"Python version: \", sys.version.split()[0])\n\nimport shutil\nfor solver in (\"highs\", \"glpsol\", \"cbc\"):\n path = shutil.which(solver)\n print(f\"solver {solver:8s}:\", path if path else \"not found\")",
"metadata": {},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -407,4 +414,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
Loading
Loading