Skip to content

Commit 0da9794

Browse files
authored
Merge branch 'Pyomo:main' into Example-seed-issue
2 parents c19d59f + 9a7ff8d commit 0da9794

35 files changed

+1485
-297
lines changed

.github/workflows/test_branches.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ jobs:
7676
fail-fast: false
7777
matrix:
7878
os: [ubuntu-latest]
79-
python: [3.13]
79+
python: ['3.13.3'] # FIXME: Remove specific 3.13 version once logging tests are fixed
8080
other: [""]
8181
category: [""]
8282

8383
include:
8484
- os: ubuntu-latest
85-
python: 3.13
85+
python: '3.13.3' # FIXME: Remove specific 3.13 version once logging tests are fixed
8686
test_docs: 1
8787
TARGET: linux
8888
PYENV: pip
@@ -348,7 +348,7 @@ jobs:
348348
if test "${{matrix.TARGET}}" == linux; then
349349
EXCLUDE="casadi numdifftools $EXCLUDE"
350350
fi
351-
if [[ "${{matrix.TARGET}}" == win && "${{matrix.python}}" == "3.13" ]]; then
351+
if [[ "${{matrix.TARGET}}" == win && "${{matrix.python}}" == 3.13* ]]; then
352352
# As of Nov 7, 2024, qtconsole is not compatible with python 3.13 on win
353353
EXCLUDE="qtconsole $EXCLUDE"
354354
fi
@@ -373,7 +373,7 @@ jobs:
373373
fi
374374
# Note: this will fail the build if any installation fails (or
375375
# possibly if it outputs messages to stderr)
376-
conda install --update-deps -q -y $CONDA_DEPENDENCIES
376+
conda install --update-deps -q -y python="${{matrix.python}}" $CONDA_DEPENDENCIES
377377
if test -z "${{matrix.slim}}"; then
378378
# xpress.init() (xpress 9.5.1 from conda) hangs indefinitely
379379
# on GHA/Windows under Python 3.10 and 3.11. Exclude that

.github/workflows/test_pr_and_main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
fail-fast: false
8989
matrix:
9090
os: [ubuntu-latest, macos-latest, windows-latest]
91-
python: [ 3.9, '3.10', 3.11, 3.12, 3.13 ]
91+
python: [ 3.9, '3.10', 3.11, 3.12, '3.13.3' ] # FIXME: Remove specific 3.13 version once logging tests are fixed
9292
other: [""]
9393
category: [""]
9494

@@ -400,7 +400,7 @@ jobs:
400400
if test "${{matrix.TARGET}}" == linux; then
401401
EXCLUDE="casadi numdifftools $EXCLUDE"
402402
fi
403-
if [[ "${{matrix.TARGET}}" == win && "${{matrix.python}}" == "3.13" ]]; then
403+
if [[ "${{matrix.TARGET}}" == win && "${{matrix.python}}" == 3.13* ]]; then
404404
# As of Nov 7, 2024, qtconsole is not compatible with python 3.13 on win
405405
EXCLUDE="qtconsole $EXCLUDE"
406406
fi
@@ -425,7 +425,7 @@ jobs:
425425
fi
426426
# Note: this will fail the build if any installation fails (or
427427
# possibly if it outputs messages to stderr)
428-
conda install --update-deps -q -y $CONDA_DEPENDENCIES
428+
conda install --update-deps -q -y python="${{matrix.python}}" $CONDA_DEPENDENCIES
429429
if test -z "${{matrix.slim}}"; then
430430
# xpress.init() (xpress 9.5.1 from conda) hangs indefinitely
431431
# on GHA/Windows under Python 3.10 and 3.11. Exclude that

doc/OnlineDocs/_templates/recursive-base.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
# import everything from the module containing this class so that
88
# doctests for the class docstrings see the correct environment
99
from {{ module }} import *
10+
try:
11+
from {{ module }} import _autosummary_doctest_setup
12+
_autosummary_doctest_setup()
13+
except ImportError:
14+
pass
1015

1116
.. currentmodule:: {{ module }}
1217

doc/OnlineDocs/_templates/recursive-class.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
# import everything from the module containing this class so that
88
# doctests for the class docstrings see the correct environment
99
from {{ module }} import *
10+
try:
11+
from {{ module }} import _autosummary_doctest_setup
12+
_autosummary_doctest_setup()
13+
except ImportError:
14+
pass
1015

1116
.. currentmodule:: {{ module }}
1217

doc/OnlineDocs/_templates/recursive-enum.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
# import everything from the module containing this class so that
88
# doctests for the class docstrings see the correct environment
99
from {{ module }} import *
10+
try:
11+
from {{ module }} import _autosummary_doctest_setup
12+
_autosummary_doctest_setup()
13+
except ImportError:
14+
pass
1015

1116
.. currentmodule:: {{ module }}
1217

doc/OnlineDocs/_templates/recursive-module.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ Library Reference
55
{{ name | escape | underline}}
66
{% endif %}
77

8+
.. testsetup:: *
9+
10+
# import everything from the module containing this class so that
11+
# doctests for the class docstrings see the correct environment
12+
from {{ module }} import *
13+
try:
14+
from {{ module }} import _autosummary_doctest_setup
15+
_autosummary_doctest_setup()
16+
except ImportError:
17+
pass
18+
19+
.. currentmodule:: {{ module }}
20+
821
.. automodule:: {{ fullname }}
922
:undoc-members:
1023

doc/OnlineDocs/errors.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ Common Warnings/Errors
88
for backwards compatibility, DO NOT recycle old ID (no longer used)
99
numbers.
1010
11-
.. doctest::
12-
:hide:
11+
.. testsetup::
1312

14-
>>> import pyomo.environ as pyo
13+
import pyomo.environ as pyo
14+
# Ensure that all logged messages are sent to stdout
15+
# (so they show up in the doctest output and can be tested)
16+
import pyomo.common.log as _log
17+
_log.pyomo_handler.__class__ = _log.StdoutHandler
1518

1619
.. py:currentmodule:: pyomo.environ
1720

doc/OnlineDocs/explanation/developer_utils/deprecation.rst

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,29 @@ Deprecation
99
-----------
1010

1111
We offer a set of tools to help with deprecation in
12-
``pyomo.common.deprecation``.
12+
:py:mod:`pyomo.common.deprecation`.
1313

1414
By policy, when deprecating or moving an existing capability, one of the
1515
following utilities should be leveraged. Each has a required
1616
``version`` argument that should be set to current development version (e.g.,
1717
``"6.6.2.dev0"``). This version will be updated to the next actual
1818
release as part of the Pyomo release process. The current development version
19-
can be found by running ``pyomo --version`` on your local fork/branch.
19+
can be found by running
20+
21+
``pyomo --version``
22+
23+
on your local fork/branch.
2024

2125
.. currentmodule:: pyomo.common.deprecation
2226

2327
.. autosummary::
2428

2529
deprecated
2630
deprecation_warning
27-
relocated_module
31+
moved_module
2832
relocated_module_attribute
2933
RenamedClass
3034

31-
.. autodecorator:: pyomo.common.deprecation.deprecated
32-
:noindex:
33-
34-
.. autofunction:: pyomo.common.deprecation.deprecation_warning
35-
:noindex:
36-
37-
.. autofunction:: pyomo.common.deprecation.relocated_module
38-
:noindex:
39-
40-
.. autofunction:: pyomo.common.deprecation.relocated_module_attribute
41-
:noindex:
42-
43-
.. autoclass:: pyomo.common.deprecation.RenamedClass
44-
:noindex:
45-
4635

4736
Removal
4837
-------
@@ -52,10 +41,8 @@ warning, pending extenuating circumstances. The functionality should
5241
be deprecated, following the information above.
5342

5443
If the functionality is documented in the most recent
55-
edition of [`Pyomo - Optimization Modeling in Python`_], it may not be removed
56-
until the next major version release.
57-
58-
.. _Pyomo - Optimization Modeling in Python: https://doi.org/10.1007/978-3-030-68928-5
44+
edition of :ref:`Pyomo - Optimization Modeling in Python <pyomobookiii>`,
45+
it may not be removed until the next major version release.
5946

6047
For other functionality, it is preferred that ample time is given
6148
before removing the functionality. At minimum, significant functionality

doc/OnlineDocs/explanation/solvers/pynumero/tutorial.linear_solver_interfaces.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Interface to MA27
4242
>>> status = solver.do_numeric_factorization(A)
4343
>>> x, status = solver.do_back_solve(rhs)
4444
>>> np.max(np.abs(A*x - rhs)) <= 1e-15
45-
True
45+
np.True_
4646

4747

4848
Interface to MUMPS

doc/OnlineDocs/explanation/solvers/pyros.rst

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,10 @@ Observe that the log contains the following information:
963963
:linenos:
964964
965965
==============================================================================
966-
PyROS: The Pyomo Robust Optimization Solver, v1.3.6.
967-
Pyomo version: 6.9.2
968-
Commit hash: 41cd797e0
969-
Invoked at UTC 2025-03-13T16:20:31.105320+00:00
966+
PyROS: The Pyomo Robust Optimization Solver, v1.3.8.
967+
Pyomo version: 6.9.3dev0
968+
Commit hash: unknown
969+
Invoked at UTC 2025-05-05T00:00:00.000000+00:00
970970
971971
Developed by: Natalie M. Isenberg (1), Jason A. F. Sherman (1),
972972
John D. Siirola (2), Chrysanthos E. Gounaris (1)
@@ -1025,34 +1025,33 @@ Observe that the log contains the following information:
10251025
------------------------------------------------------------------------------
10261026
Itn Objective 1-Stg Shift 2-Stg Shift #CViol Max Viol Wall Time (s)
10271027
------------------------------------------------------------------------------
1028-
0 3.5838e+07 - - 5 1.8832e+04 0.693
1029-
1 3.5838e+07 1.2289e-09 1.5876e-12 5 3.7762e+04 1.514
1030-
2 3.6129e+07 2.7244e-01 3.6878e-01 3 1.1093e+02 2.486
1031-
3 3.6269e+07 3.7352e-01 4.3227e-01 1 2.7711e+01 3.667
1032-
4 3.6285e+07 7.6526e-01 2.8426e-11 0 4.3364e-05g 6.291
1028+
0 3.5838e+07 - - 5 1.8832e+04 0.759
1029+
1 3.5838e+07 2.9329e-09 5.0030e-10 5 2.1295e+04 1.573
1030+
2 3.6285e+07 7.6526e-01 2.0398e-01 2 2.2457e+02 2.272
1031+
3 3.6285e+07 7.7212e-13 1.2525e-10 0 7.2940e-08g 5.280
10331032
------------------------------------------------------------------------------
10341033
Robust optimal solution identified.
10351034
------------------------------------------------------------------------------
10361035
Timing breakdown:
10371036
10381037
Identifier ncalls cumtime percall %
10391038
-----------------------------------------------------------
1040-
main 1 6.291 6.291 100.0
1039+
main 1 5.281 5.281 100.0
10411040
------------------------------------------------------
1042-
dr_polishing 4 0.334 0.083 5.3
1043-
global_separation 27 0.954 0.035 15.2
1044-
local_separation 135 3.046 0.023 48.4
1045-
master 5 1.027 0.205 16.3
1046-
master_feasibility 4 0.133 0.033 2.1
1047-
preprocessing 1 0.013 0.013 0.2
1048-
other n/a 0.785 n/a 12.5
1041+
dr_polishing 3 0.155 0.052 2.9
1042+
global_separation 27 1.280 0.047 24.2
1043+
local_separation 108 2.200 0.020 41.7
1044+
master 4 0.727 0.182 13.8
1045+
master_feasibility 3 0.103 0.034 1.9
1046+
preprocessing 1 0.021 0.021 0.4
1047+
other n/a 0.794 n/a 15.0
10491048
======================================================
10501049
===========================================================
10511050
10521051
------------------------------------------------------------------------------
10531052
Termination stats:
1054-
Iterations : 5
1055-
Solve time (wall s) : 6.291
1053+
Iterations : 4
1054+
Solve time (wall s) : 5.281
10561055
Final objective value : 3.6285e+07
10571056
Termination condition : pyrosTerminationCondition.robust_optimal
10581057
------------------------------------------------------------------------------
@@ -1133,6 +1132,58 @@ The constituent columns are defined in the
11331132
current iteration.
11341133

11351134

1135+
Separation Priority Ordering
1136+
----------------------------
1137+
The PyROS solver supports custom prioritization of
1138+
the separation subproblems (and, thus, the constraints)
1139+
that are automatically derived from
1140+
a given model for robust optimization.
1141+
Users may specify separation priorities through:
1142+
1143+
- (Recommended) :class:`~pyomo.core.base.suffix.Suffix` components
1144+
with local name ``pyros_separation_priority``,
1145+
declared on the model or any of its sub-blocks.
1146+
Each entry of every such
1147+
:class:`~pyomo.core.base.suffix.Suffix`
1148+
should map a
1149+
:class:`~pyomo.core.base.var.Var`
1150+
or :class:`~pyomo.core.base.constraint.Constraint`
1151+
component to a value that specifies the separation
1152+
priority of all constraints derived from that component
1153+
- The optional argument ``separation_priority_order``
1154+
to the PyROS :py:meth:`~pyomo.contrib.pyros.pyros.PyROS.solve`
1155+
method. The argument should be castable to a :py:obj:`dict`,
1156+
of which each entry maps the full name of a
1157+
:class:`~pyomo.core.base.var.Var`
1158+
or :class:`~pyomo.core.base.constraint.Constraint`
1159+
component to a value that specifies the
1160+
separation priority of all constraints
1161+
derived from that component
1162+
1163+
Specification via :class:`~pyomo.core.base.suffix.Suffix` components
1164+
takes precedence over specification via the solver argument
1165+
``separation_priority_order``.
1166+
Moreover, the precedence ordering among
1167+
:class:`~pyomo.core.base.suffix.Suffix`
1168+
components is handled by the Pyomo
1169+
:class:`~pyomo.core.base.suffix.SuffixFinder` utility.
1170+
1171+
A separation priority can be either
1172+
a (real) number (i.e., of type :py:class:`int`, :py:class:`float`, etc.)
1173+
or :py:obj:`None`.
1174+
A higher number indicates a higher priority.
1175+
The default priority for all constraints is 0.
1176+
Therefore a constraint can be prioritized [or deprioritized]
1177+
over the default by mapping the constraint to a positive [or negative] number.
1178+
In practice, critical or dominant constraints are often
1179+
prioritized over algorithmic or implied constraints.
1180+
1181+
Constraints that have been assigned a priority of :py:obj:`None`
1182+
are enforced subject to only the nominal uncertain parameter realization
1183+
provided by the user. Therefore, these constraints are not imposed robustly
1184+
and, in particular, are excluded from the separation problems.
1185+
1186+
11361187
Feedback and Reporting Issues
11371188
-------------------------------
11381189
Please provide feedback and/or report any problems by opening an issue on

0 commit comments

Comments
 (0)