Skip to content

Commit 83c4ec6

Browse files
committed
Merge branch 'parmest-doc-update' of https://github.com/slilonfe5/pyomo into parmest-doc-update
2 parents 9d1cb97 + 857f49c commit 83c4ec6

File tree

18 files changed

+128
-535
lines changed

18 files changed

+128
-535
lines changed

.github/workflows/test_branches.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
PYENV: pip
100100

101101
- os: windows-latest
102-
python: 3.12
102+
python: 3.14
103103
test_docs: 1
104104
TARGET: win
105105
PYENV: conda
@@ -236,8 +236,11 @@ jobs:
236236
if: matrix.PYENV == 'conda'
237237
uses: conda-incubator/setup-miniconda@v3
238238
with:
239+
conda-remove-defaults: true
239240
auto-update-conda: false
240241
python-version: ${{ matrix.python }}
242+
channels: conda-forge, gurobi, ibmdecisionoptimization, fico-xpress
243+
use-mamba: true
241244

242245
# This is necessary for qt (UI) tests; the package utilized here does not
243246
# have support for OSX.
@@ -317,27 +320,7 @@ jobs:
317320
run: |
318321
# Set up environment
319322
conda config --set always_yes yes
320-
conda config --set auto_update_conda false
321323
conda config --set channel_priority strict
322-
conda config --remove channels defaults
323-
conda config --append channels nodefaults
324-
conda config --append channels conda-forge
325-
# Try to install mamba
326-
CONDA_VER=$(conda --version | cut -d\ -f2)
327-
if test 23.10 = "`echo -e "23.10\n$CONDA_VER" | sort -V | tail -1`"; then
328-
# Note: removed '--update-deps' on 2025-02-28 to work around
329-
# broken libffi(?)
330-
conda install -q -y -n base conda-libmamba-solver \
331-
|| MAMBA_FAILED=1
332-
if test -z "$MAMBA_FAILED"; then
333-
echo "*** Activating the mamba environment solver ***"
334-
conda config --set solver libmamba
335-
fi
336-
fi
337-
# Add the rest of the channels
338-
conda config --append channels gurobi
339-
conda config --append channels ibmdecisionoptimization
340-
conda config --append channels fico-xpress
341324
# Print environment info
342325
echo "*** CONDA environment: ***"
343326
conda info
@@ -375,10 +358,8 @@ jobs:
375358
echo ""
376359
echo "*** Install Pyomo dependencies ***"
377360
# For windows, cannot use newer setuptools because of APPSI compilation issues
378-
# There seems to be some specific problem with platformdirs 4.5.0
379-
# on win 3.13/3.14 as of 2025-10-23
380361
if test "${{matrix.TARGET}}" == 'win'; then
381-
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES setuptools<74.0.0 platformdirs!=4.5.0"
362+
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES setuptools<74.0.0"
382363
fi
383364
# Note: this will fail the build if any installation fails (or
384365
# possibly if it outputs messages to stderr)

.github/workflows/test_pr_and_main.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ jobs:
9393
fail-fast: false
9494
matrix:
9595
os: [ubuntu-latest, macos-latest, windows-latest]
96-
# FIXME: pinning to 3.14.0 until 3.14.1 is removed from runner tool cache
97-
python: [ '3.10', 3.11, 3.12, 3.13, 3.14.0 ]
96+
python: [ '3.10', 3.11, 3.12, 3.13, 3.14 ]
9897
other: [""]
9998
category: [""]
10099

@@ -289,8 +288,11 @@ jobs:
289288
if: matrix.PYENV == 'conda'
290289
uses: conda-incubator/setup-miniconda@v3
291290
with:
291+
conda-remove-defaults: true
292292
auto-update-conda: false
293293
python-version: ${{ matrix.python }}
294+
channels: conda-forge, gurobi, ibmdecisionoptimization, fico-xpress
295+
use-mamba: true
294296

295297
# This is necessary for qt (UI) tests; the package utilized here does not
296298
# have support for OSX.
@@ -370,27 +372,7 @@ jobs:
370372
run: |
371373
# Set up environment
372374
conda config --set always_yes yes
373-
conda config --set auto_update_conda false
374375
conda config --set channel_priority strict
375-
conda config --remove channels defaults
376-
conda config --append channels nodefaults
377-
conda config --append channels conda-forge
378-
# Try to install mamba
379-
CONDA_VER=$(conda --version | cut -d\ -f2)
380-
if test 23.10 = "`echo -e "23.10\n$CONDA_VER" | sort -V | tail -1`"; then
381-
# Note: removed '--update-deps' on 2025-02-28 to work around
382-
# broken libffi(?)
383-
conda install -q -y -n base conda-libmamba-solver \
384-
|| MAMBA_FAILED=1
385-
if test -z "$MAMBA_FAILED"; then
386-
echo "*** Activating the mamba environment solver ***"
387-
conda config --set solver libmamba
388-
fi
389-
fi
390-
# Add the rest of the channels
391-
conda config --append channels gurobi
392-
conda config --append channels ibmdecisionoptimization
393-
conda config --append channels fico-xpress
394376
# Print environment info
395377
echo "*** CONDA environment: ***"
396378
conda info
@@ -428,10 +410,8 @@ jobs:
428410
echo ""
429411
echo "*** Install Pyomo dependencies ***"
430412
# For windows, cannot use newer setuptools because of APPSI compilation issues
431-
# There seems to be some specific problem with platformdirs 4.5.0
432-
# on win 3.13/3.14 as of 2025-10-23
433413
if test "${{matrix.TARGET}}" == 'win'; then
434-
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES setuptools<74.0.0 platformdirs!=4.5.0"
414+
CONDA_DEPENDENCIES="$CONDA_DEPENDENCIES setuptools<74.0.0"
435415
fi
436416
# Note: this will fail the build if any installation fails (or
437417
# possibly if it outputs messages to stderr)

.github/workflows/typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,10 @@ gam = "gam"
7575
ond = "ond"
7676
# GAMS_writer
7777
PATHC = "PATHC"
78+
# Bimap - tries to correct to Bitmap
79+
Bimap = "Bimap"
80+
# cmo - tries to correct to com
81+
cmo = "cmo"
82+
# Substituters
83+
Substituters = "Substituters"
7884
# AS NEEDED: Add More Words Below

doc/OnlineDocs/explanation/analysis/parmest/covariance.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Covariance Matrix Estimation
44
============================
55

6-
The goal is parameter estimation (see :ref:`driversection` Section) is to estimate unknown model parameters
6+
The goal of parameter estimation (see :ref:`driversection` Section) is to estimate unknown model parameters
77
from experimental data. When the model parameters are estimated from the data, their accuracy is measured by
88
computing the covariance matrix. The diagonal of this covariance matrix contains the variance of the
99
estimated parameters which is used to calculate their uncertainty. Assuming Gaussian independent and identically

doc/OnlineDocs/explanation/analysis/parmest/datarec.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ The following example returns model values from a Pyomo Expression.
4444

4545
>>> # Define objective
4646
>>> def SSE(model):
47-
... expr = (model.experiment_outputs[model.y[model.hour]]
48-
... - model.y[model.hour]
47+
... expr = (model.experiment_outputs[model.y]
48+
... - model.y
4949
... ) ** 2
5050
... return expr
5151

doc/OnlineDocs/explanation/analysis/parmest/driver.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,12 @@ required packages for parameter estimation in parmest:
8282
Step 1: Create the Experiment Class for the Model
8383
-------------------------------------------------
8484

85-
parmest requires that the user creates an :class:`~pyomo.contrib.parmest.experiment.Experiment` class that
86-
contains the annotated Pyomo model with labeled experiment outputs, unknown parameters, and measurement errors.
85+
parmest requires that the user create an :class:`~pyomo.contrib.parmest.experiment.Experiment` class that
86+
builds an annotated Pyomo model denoting experiment outputs, unknown parameters, and measurement errors using Pyomo `Suffix` components.
8787

88-
A labeled Pyomo model ``m`` has the following additional suffixes (Pyomo `Suffix`):
89-
90-
* ``m.experiment_outputs`` which defines experiment output (Pyomo `Param`, `Var`, or `Expression`)
91-
and their associated data values (float, int).
92-
* ``m.unknown_parameters`` which defines the mutable parameters or variables (Pyomo `Param` or `Var`)
93-
to estimate along with their component unique identifier (Pyomo `ComponentUID`).
88+
* ``m.experiment_outputs`` maps the experiment output, or measurement, terms in the model (Pyomo `Param`, `Var`, or `Expression`) to their associated data values (float, int).
89+
* ``m.unknown_parameters`` maps the model parameters to estimate (Pyomo `Param` or `Var`)
90+
to their component unique identifier (Pyomo `ComponentUID`) which is used to identify equivalent parameters across multiple experiments.
9491
Within parmest, any parameters that are to be estimated are converted to unfixed variables.
9592
Variables that are to be estimated are also unfixed.
9693

@@ -165,12 +162,10 @@ mathematical model outlined in the introduction section of this Quick Start.
165162
... return self.model
166163

167164

168-
Step 2: Load the Data and Create a List of the Model's Experiment Class
165+
Step 2: Load the Data and Create a List Experiments
169166
-----------------------------------------------------------------------
170167

171-
After creating an :class:`~pyomo.contrib.parmest.experiment.Experiment` class instance for the model, a list of the
172-
model's :class:`~pyomo.contrib.parmest.experiment.Experiment` class for all the experimental data points should be
173-
created.
168+
Load the experimental data into Python and create an instance of your :class:`~pyomo.contrib.parmest.experiment.Experiment` class for each set of experimental data. In this example, each measurement of `y` is treated as a separate experiment.
174169

175170
.. doctest::
176171

@@ -240,12 +235,9 @@ Optionally, solver options can be supplied, e.g.,
240235
Objective function
241236
^^^^^^^^^^^^^^^^^^
242237

243-
The second argument is an optional argument if the objective function has already been included in the
244-
Pyomo model, which defines the optimization objective function to use in parameter estimation. However, if the
245-
objective function has not been included in the Pyomo model, like the one in the :ref:`ExperimentClass` Section
246-
above, the user is required to supply the second argument.
238+
The second argument, ``obj_function``, is used to specify the objective function to use for parameter estimation if the user has not manually defined an objective function in their ``Experiment`` class.
247239

248-
If no objective function is specified, the Pyomo model is used "as is" and
240+
If ``obj_function`` is not specified, the Pyomo model is used "as is" and
249241
should be defined with "FirstStageCost" and "SecondStageCost"
250242
expressions that are used to build an objective for the two-stage
251243
stochastic programming problem.
@@ -254,14 +246,14 @@ If the Pyomo model is not written as a two-stage stochastic programming problem
254246
this format, the user can select the "SSE" or "SSE_weighted" built-in objective
255247
functions. If the user wants to use an objective that is different from the built-in
256248
options, a custom objective function can be defined for parameter estimation. However,
257-
covariance matrix estimation (see :ref:`covariancesection` Section) will not support this
258-
custom objective function.
249+
covariance matrix estimation (see :ref:`covariancesection` Section) is not supported
250+
for custom objective functions.
259251

260252
Parmest includes two built-in objective functions ("SSE" and "SSE_weighted") to compute
261253
the sum of squared errors between the ``m.experiment_outputs`` model values and
262254
data values.
263255

264-
Step 3: Estimate the Parameters
256+
Step 4: Estimate the Parameters
265257
-------------------------------
266258

267259
After creating the :class:`~pyomo.contrib.parmest.parmest.Estimator` object with the desired objective function,

doc/OnlineDocs/ext/pyomo_autosummary_autoenum.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,26 @@ def render(self, name, ns):
8585

8686
caller = inspect.currentframe().f_back
8787
l = caller.f_locals
88-
doc = l['doc']
88+
if 'obj_type' in l:
89+
# Sphinx >= 9.1.0
90+
doc_field = 'obj_type'
91+
else:
92+
doc_field = 'doc'
93+
doc = l[doc_field]
8994
obj = l['obj']
90-
args = {'obj': obj}
95+
args = {'obj': obj, doc_field: doc}
9196
if '_get_members' in caller.f_globals:
9297
_get_members = caller.f_globals['_get_members']
9398
if 'config' in l:
9499
# Sphinx >= 8.2.1
95-
for field in ('config', 'doc', 'events', 'registry'):
100+
for field in ('config', 'events'):
96101
args[field] = l[field]
102+
if 'registry' in l:
103+
# Sphinx < 9.1
104+
args['registry'] = l['registry']
97105
else:
98106
# Sphinx >= 7.2
99-
args.update({'doc': doc, 'app': l['app']})
107+
args['app'] = l['app']
100108
else:
101109
# Sphinx < 7.2
102110
_get_members = caller.f_locals['get_members']

0 commit comments

Comments
 (0)