Skip to content

Commit 343bce0

Browse files
doc: add jupyter notebook with oetc example use (#490)
* doc: add jupyter notebook with oetc example use * doc: configure nbsphinx execution settings Enable auto-execution with inline backend configuration Exclude OETC notebook from automatic execution * doc: update styles and address warnings * refac: jupyter notebook format
1 parent 6d64d16 commit 343bce0

File tree

13 files changed

+418
-48
lines changed

13 files changed

+418
-48
lines changed

doc/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ BUILDDIR = _build
1212
help:
1313
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

15-
.PHONY: help Makefile
15+
.PHONY: help clean Makefile
16+
17+
# Clean target that removes build directory
18+
clean:
19+
@echo "Removing build directory..."
20+
rm -rf "$(BUILDDIR)"
1621

1722
# Catch-all target: route all unknown targets to Sphinx using the new
1823
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

doc/api.rst

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,32 @@ IO functions
121121
model.Model.to_netcdf
122122
io.read_netcdf
123123

124+
Solver utilities
125+
=================
126+
127+
.. autosummary::
128+
:toctree: generated/
129+
130+
solvers.available_solvers
131+
solvers.quadratic_solvers
132+
solvers.Solver
133+
134+
124135
Solvers
125-
========
136+
=======
126137

127138
.. autosummary::
128139
:toctree: generated/
129140

130-
solvers.run_cbc
131-
solvers.run_glpk
132-
solvers.run_highs
133-
solvers.run_cplex
134-
solvers.run_gurobi
135-
solvers.run_xpress
136-
solvers.run_mosek
137-
solvers.run_mindopt
138-
solvers.run_copt
141+
solvers.CBC
142+
solvers.Cplex
143+
solvers.GLPK
144+
solvers.Gurobi
145+
solvers.Highs
146+
solvers.Mosek
147+
solvers.SCIP
148+
solvers.Xpress
149+
139150

140151
Solving
141152
========

doc/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@
9090
9191
"""
9292

93-
nbsphinx_allow_errors = False
93+
nbsphinx_allow_errors = True
94+
nbsphinx_execute = "auto"
95+
nbsphinx_execute_arguments = [
96+
"--InlineBackend.figure_formats={'svg', 'pdf'}",
97+
"--InlineBackend.rc={'figure.dpi': 96}",
98+
]
99+
100+
# Exclude notebooks that require credentials or special setup
101+
nbsphinx_execute_never = ["**/solve-on-oetc*"]
94102

95103
# -- Options for HTML output -------------------------------------------------
96104

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ This package is published under MIT license.
114114
transport-tutorial
115115
infeasible-model
116116
solve-on-remote
117+
solve-on-oetc
117118
migrating-from-pyomo
118119
gurobi-double-logging
119120

doc/release_notes.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Release Notes
22
=============
33

44
Upcoming Version
5-
----------------
65

76
* Replace pandas-based LP file writing with polars implementation for significantly improved performance on large models
87
* Consolidate "lp" and "lp-polars" io_api options - both now use the optimized polars backend
@@ -37,7 +36,7 @@ Version 0.5.4
3736
**Bug Fixes**
3837

3938
* Remove default highs log file when `log_fn=None` and `io_api="direct"`. This caused `log_file` in
40-
`solver_options` to be ignored.
39+
`solver_options` to be ignored.
4140
* Fix the parsing of solutions returned by the CBC solver when setting a MIP duality
4241
gap tolerance.
4342
* Improve the mapping of termination conditions for the SCIP solver
@@ -65,8 +64,8 @@ Version 0.5.2
6564
**Bug Fixes**
6665

6766
* Fix the multiplication with of zero dimensional numpy arrays with linopy objects.
68-
This is mainly affecting operations where single numerical items from pandas objects
69-
are selected and used for multiplication.
67+
This is mainly affecting operations where single numerical items from pandas objects
68+
are selected and used for multiplication.
7069

7170
Version 0.5.1
7271
--------------
@@ -199,7 +198,7 @@ Version 0.3.9
199198

200199
* The constraint assignment with a `LinearExpression` and a constant value when using the pattern `model.add_constraints(lhs_with_constant, sign, rhs)` was fixed. Before, the constant value was not added to the right-hand-side properly which led to the wrong constraint behavior. This is fixed now.
201200

202-
* `nan`s in constants is now handled more consistently. These are ignored when in the addition of expressions (effectively filled by zero). In a future version, this might change to align the propagation of `nan`s with tools like numpy/pandas/xarray.
201+
* ``nan`` s in constants is now handled more consistently. These are ignored when in the addition of expressions (effectively filled by zero). In a future version, this might change to align the propagation of ``nan`` s with tools like numpy/pandas/xarray.
203202

204203
* Up to now the `rhs` argument in the `add_constraints` function was not supporting an expression as an input type. This is now added.
205204

doc/solve-on-oetc.nblink

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "../examples/solve-on-oetc.ipynb"
3+
}

examples/creating-expressions.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@
160160
"cell_type": "markdown",
161161
"id": "f7578221",
162162
"metadata": {},
163-
"source": [
164-
".. important::\n",
165-
" When combining variables or expression with dimensions of the same name and size, the first object will determine the coordinates of the resulting expression. For example: "
166-
]
163+
"source": ".. important::\n\n\tWhen combining variables or expression with dimensions of the same name and size, the first object will determine the coordinates of the resulting expression. For example:"
167164
},
168165
{
169166
"cell_type": "code",

examples/creating-variables.ipynb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,7 @@
467467
"cell_type": "markdown",
468468
"id": "77e264e2",
469469
"metadata": {},
470-
"source": [
471-
".. important::\n",
472-
"\n",
473-
" **New in version 0.3.6**\n",
474-
"\n",
475-
" As pandas objects always have indexes, the `coords` argument is not required and is ignored is passed. Before, it was used to overwrite the indexes of the pandas objects. A warning is raised if `coords` is passed and if these are not aligned with the pandas object. "
476-
]
470+
"source": ".. important::\n\n **New in version 0.3.6**\n\n As pandas objects always have indexes, the `coords` argument is not required and is ignored is passed. Before, it was used to overwrite the indexes of the pandas objects. A warning is raised if `coords` is passed and if these are not aligned with the pandas object."
477471
},
478472
{
479473
"cell_type": "code",

0 commit comments

Comments
 (0)