Update notebook demo to run on Colab; add explanatory text#335
Update notebook demo to run on Colab; add explanatory text#335siddharth-krishna merged 5 commits intomainfrom
Conversation
tests/notebook-demo.ipynb
Outdated
| } | ||
| ], | ||
| "source": [ | ||
| "%pip install gdx2py gamspy-base git+https://github.com/etsap-TIMES/xl2times.git" |
There was a problem hiding this comment.
Update this after release
There was a problem hiding this comment.
Should we make a release before merging this PR then?
Regression test results on commit d411ec4This comment will be updated when new commits are added to the PR. |
tests/notebook-demo.ipynb
Outdated
| "var_act = g._find_symbol(\"VAR_ACT\")\n", | ||
| "print(g._get_symtype(var_act)) # No idea what this means\n", | ||
| "# But the symbol exists in the file, it's just not a parameter\n", | ||
| "# Perhaps gdx2py doesn't support this type?" |
There was a problem hiding this comment.
@olejandro no luck with these 2 new parameters. If I use gdxdump, I see them both having many lines of data in them. Any hints on what to extract and how to present their data?
There was a problem hiding this comment.
Let's figure this out later... I'll reach out to GAMS to ask about the future of the package.
There was a problem hiding this comment.
Pull Request Overview
This PR adapts the existing Jupyter notebook demo to run seamlessly on Google Colab, adds explanatory text for context, and updates setup and execution steps for both Colab and local environments.
- Convert initial code cell to markdown introductory text.
- Add Colab-specific installation and resource‐download steps.
- Insert environment‐aware path logic and expand explanatory markdown.
| "def inspect_solution():\n", | ||
| " with gdx2py.GdxFile(path.join(output_dir, \"scenario.gdx\"), gams_dir=directory) as g:\n", | ||
| " with gdx2py.GdxFile(\n", | ||
| " str(Path(output_dir) / \"scenario.gdx\"), gams_dir=directory\n", |
There was a problem hiding this comment.
| " str(Path(output_dir) / \"scenario.gdx\"), gams_dir=directory\n", | |
| " Path(output_dir) / \"scenario.gdx\", gams_dir=directory\n", |
tests/notebook-demo.ipynb
Outdated
| } | ||
| ], | ||
| "source": [ | ||
| "g = gdx2py.GdxFile(str(Path(output_dir) / \"scenario.gdx\"), gams_dir=directory)\n", |
There was a problem hiding this comment.
| "g = gdx2py.GdxFile(str(Path(output_dir) / \"scenario.gdx\"), gams_dir=directory)\n", | |
| "g = gdx2py.GdxFile(Path(output_dir) / \"scenario.gdx\", gams_dir=directory)\n", |
This PR updates the notebook demo to work on Google Colab. It also adds some text to explain what the demo is about and what else can be done (but just a sketch, please suggest how to extend/improve it!). The Demo 3 model is downloaded from a link to my drive.
Here is a shareable link to open the notebook from this branch on Colab:
https://colab.research.google.com/github/etsap-TIMES/xl2times/blob/sid/colab-demo/tests/notebook-demo.ipynb