Skip to content

Commit fa9cecb

Browse files
authored
Merge branch 'main' into add_cuopt_direct_solver_plugin
2 parents 90adbf4 + dc503c2 commit fa9cecb

File tree

102 files changed

+3977
-1566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3977
-1566
lines changed

.github/workflows/release_wheel_creation.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,8 @@ jobs:
5959

6060
steps:
6161
- uses: actions/checkout@v4
62-
- name: Create pyproject.toml
63-
run: |
64-
# Per the cibuildwheel documentation, you can technically use
65-
# CIBW_BEFORE_BUILD to do these steps; however, as of the newest
66-
# version (2.21.3) this feature does not work. This is a hack
67-
# to make cibuildwheel recognize our pre-build requirements
68-
echo -e '[build-system]\n\nrequires = [ "setuptools", "wheel", "cython", "pybind11" ]' > $GITHUB_WORKSPACE/pyproject.toml
69-
cat $GITHUB_WORKSPACE/pyproject.toml
70-
ls -la $GITHUB_WORKSPACE
7162
- name: Build wheels
72-
uses: pypa/cibuildwheel@v2.21.3
63+
uses: pypa/cibuildwheel@main
7364
with:
7465
output-dir: dist
7566
env:
@@ -118,17 +109,8 @@ jobs:
118109
uses: docker/setup-qemu-action@v3
119110
with:
120111
platforms: all
121-
- name: Create pyproject.toml
122-
run: |
123-
# Per the cibuildwheel documentation, you can technically use
124-
# CIBW_BEFORE_BUILD to do these steps; however, as of the newest
125-
# version (2.21.3) this feature does not work. This is a hack
126-
# to make cibuildwheel recognize our pre-build requirements
127-
echo -e '[build-system]\n\nrequires = [ "setuptools", "wheel", "cython", "pybind11" ]' > $GITHUB_WORKSPACE/pyproject.toml
128-
cat $GITHUB_WORKSPACE/pyproject.toml
129-
ls -la $GITHUB_WORKSPACE
130112
- name: Build wheels
131-
uses: pypa/cibuildwheel@v2.21.3
113+
uses: pypa/cibuildwheel@main
132114
with:
133115
output-dir: dist
134116
env:
@@ -158,10 +140,11 @@ jobs:
158140
- name: Install dependencies
159141
run: |
160142
python -m pip install --upgrade pip
161-
pip install twine wheel setuptools pybind11
143+
pip install build twine wheel setuptools pybind11
162144
- name: Build pure python wheel
163145
run: |
164-
python setup.py --without-cython sdist --format=gztar bdist_wheel
146+
export PYOMO_SETUP_ARGS=--without-cython
147+
python -m build --wheel --outdir dist --config-setting="--build-option=--without-cython"
165148
- name: Upload artifact
166149
uses: actions/upload-artifact@v4
167150
with:
@@ -189,10 +172,11 @@ jobs:
189172
- name: Install dependencies
190173
run: |
191174
python -m pip install --upgrade pip
192-
pip install twine wheel setuptools pybind11
175+
pip install build twine wheel 'setuptools>=65' pybind11
193176
- name: Build generic tarball
194177
run: |
195-
python setup.py --without-cython sdist --format=gztar
178+
export PYOMO_SETUP_ARGS=--without-cython
179+
python -m build --sdist --outdir dist --config-setting="--build-option=--without-cython"
196180
- name: Upload artifact
197181
uses: actions/upload-artifact@v4
198182
with:

.github/workflows/test_branches.yml

Lines changed: 9 additions & 7 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
@@ -654,14 +654,15 @@ jobs:
654654
655655
- name: Install Pyomo
656656
run: |
657+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
657658
echo ""
658659
echo "Clone Pyomo-model-libraries..."
659660
URL=https://github.com/Pyomo/pyomo-model-libraries.git
660661
git clone -b ${SRC_REF##*/} $URL || git clone -b main $URL
661662
echo ""
662663
echo "Install Pyomo..."
663664
echo ""
664-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
665+
$PYTHON_EXE -m pip install -e .
665666
echo ""
666667
echo "Set custom PYOMO_CONFIG_DIR"
667668
echo ""
@@ -790,7 +791,7 @@ jobs:
790791
echo ""
791792
echo "Install Pyomo..."
792793
echo ""
793-
python setup.py develop
794+
python -m pip install -e .
794795
echo ""
795796
echo "Set custom PYOMO_CONFIG_DIR"
796797
echo ""
@@ -868,13 +869,14 @@ jobs:
868869
869870
- name: Install Pyomo
870871
run: |
872+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
871873
echo ""
872874
echo "Clone Pyomo-model-libraries..."
873875
git clone https://github.com/Pyomo/pyomo-model-libraries.git
874876
echo ""
875877
echo "Install Pyomo..."
876878
echo ""
877-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
879+
$PYTHON_EXE -m pip install -e .
878880
echo ""
879881
echo "Set custom PYOMO_CONFIG_DIR"
880882
echo ""

.github/workflows/test_pr_and_main.yml

Lines changed: 8 additions & 6 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
@@ -706,14 +706,15 @@ jobs:
706706
707707
- name: Install Pyomo
708708
run: |
709+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
709710
echo ""
710711
echo "Clone Pyomo-model-libraries..."
711712
URL=https://github.com/Pyomo/pyomo-model-libraries.git
712713
git clone -b ${SRC_REF##*/} $URL || git clone -b main $URL
713714
echo ""
714715
echo "Install Pyomo..."
715716
echo ""
716-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
717+
$PYTHON_EXE -m pip install -e .
717718
echo ""
718719
echo "Set custom PYOMO_CONFIG_DIR"
719720
echo ""
@@ -843,7 +844,7 @@ jobs:
843844
echo ""
844845
echo "Install Pyomo..."
845846
echo ""
846-
python setup.py develop
847+
python -m pip install -e .
847848
echo ""
848849
echo "Set custom PYOMO_CONFIG_DIR"
849850
echo ""
@@ -921,13 +922,14 @@ jobs:
921922
922923
- name: Install Pyomo
923924
run: |
925+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
924926
echo ""
925927
echo "Clone Pyomo-model-libraries..."
926928
git clone https://github.com/Pyomo/pyomo-model-libraries.git
927929
echo ""
928930
echo "Install Pyomo..."
929931
echo ""
930-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
932+
$PYTHON_EXE -m pip install -e .
931933
echo ""
932934
echo "Set custom PYOMO_CONFIG_DIR"
933935
echo ""

.github/workflows/typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ EOF = "EOF"
7171
lst = "lst"
7272
# Abbreviation of gamma (used in stochpdegas1_automatic.py)
7373
gam = "gam"
74+
# Regex search term from contrib/solver/solvers/ipopt
75+
ond = "ond"
7476
# AS NEEDED: Add More Words Below

.jenkins.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#
2929
# DISABLE_COVERAGE: if nonempty, then coverage analysis is disabled
3030
#
31-
# PYOMO_SETUP_ARGS: passed to the 'python setup.py develop' command
31+
# PYOMO_SETUP_ARGS: passed to the 'pip install' command
3232
# (e.g., to specify --with-cython)
3333
#
3434
# PYOMO_DOWNLOAD_ARGS: passed to the 'pyomo download-extensions' command
@@ -94,7 +94,7 @@ if test -z "$MODE" -o "$MODE" == setup; then
9494
echo "PyUtilib not found; skipping"
9595
fi
9696
pushd "$WORKSPACE/pyomo" || exit 1
97-
python setup.py develop $PYOMO_SETUP_ARGS || exit 1
97+
pip install -e . || exit 1
9898
popd
9999
#
100100
# DO NOT install pyomo-model-libraries

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Python package dependencies
2121
IPOPT
2222
-----
2323

24-
IPOPT can be downloaded from https://projects.coin-or.org/Ipopt.
24+
The IPOPT project homepage is https://github.com/coin-or/Ipopt
2525

2626
Testing
2727
-------

doc/OnlineDocs/explanation/analysis/sensitivity_toolbox.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Sensitivity Toolbox
33

44
The sensitivity toolbox provides a Pyomo interface to sIPOPT and k_aug to very quickly compute approximate solutions to nonlinear programs with a small perturbation in model parameters.
55

6-
See the `sIPOPT documentation <https://projects.coin-or.org/Ipopt/wiki/sIpopt>`_ or the `following paper <https://link.springer.com/article/10.1007/s12532-012-0043-2>`_ for additional details:
6+
See the `sIPOPT documentation <https://coin-or.github.io/Ipopt/SPECIALS.html#SIPOPT>`_ or the `following paper <https://link.springer.com/article/10.1007/s12532-012-0043-2>`_ for additional details:
77

88
H. Pirnay, R. Lopez-Negrete, and L.T. Biegler, Optimal Sensitivity based on IPOPT, Math. Prog. Comp., 4(4):307--331, 2012.
99

@@ -185,7 +185,7 @@ Installing sIPOPT and k_aug
185185
The sensitivity toolbox requires either sIPOPT or k_aug to be installed and available in your system PATH. See the sIPOPT and k_aug documentation for detailed instructions:
186186

187187
* https://coin-or.github.io/Ipopt/INSTALL.html
188-
* https://projects.coin-or.org/Ipopt/wiki/sIpopt
188+
* https://coin-or.github.io/Ipopt/SPECIALS.html#SIPOPT
189189
* https://coin-or.github.io/coinbrew/
190190
* https://github.com/dthierry/k_aug
191191

doc/OnlineDocs/explanation/experimental/solvers.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,109 @@ implemented. For example, for ``ipopt``:
386386
:members:
387387
:show-inheritance:
388388
:inherited-members:
389+
390+
391+
Dual Sign Convention
392+
--------------------
393+
For all future solver interfaces, Pyomo adopts the following sign convention. Given the problem
394+
395+
.. math::
396+
397+
\begin{aligned}
398+
\min\quad & f(x) \\
399+
\text{s.t.}\quad & c_i(x) = 0 \quad \forall i \in \mathcal{E} \\
400+
& g_i(x) \le 0 \quad \forall i \in \mathcal{U} \\
401+
& h_i(x) \ge 0 \quad \forall i \in \mathcal{L}
402+
\end{aligned}
403+
404+
We define the Lagrangian as
405+
406+
.. math::
407+
408+
\begin{aligned}
409+
L(x, \lambda, \nu, \delta)
410+
&= f(x)
411+
- \sum_{i \in \mathcal{E}} \lambda_i\,c_i(x)
412+
- \sum_{i \in \mathcal{U}} \nu_i\,g_i(x)
413+
- \sum_{i \in \mathcal{L}} \delta_i\,h_i(x)
414+
\end{aligned}
415+
416+
Then, the KKT conditions are [NW99]_
417+
418+
.. math::
419+
420+
\begin{aligned}
421+
\nabla_x L(x, \lambda, \nu, \delta) &= 0 \\
422+
c(x) &= 0 \\
423+
g(x) &\le 0 \\
424+
h(x) &\ge 0 \\
425+
\nu &\le 0 \\
426+
\delta &\ge 0 \\
427+
\nu_i\,g_i(x) &= 0 \\
428+
\delta_i\,h_i(x) &= 0
429+
\end{aligned}
430+
431+
Note that this sign convention is based on the ``(lower, body, upper)``
432+
representation of constraints rather than the expression provided by a
433+
user. Users can specify constraints with variables on both the left- and
434+
right-hand sides of equalities and inequalities. However, the
435+
``(lower, body, upper)`` representation ensures that all variables
436+
appear in the ``body``, matching the form of the problem above.
437+
438+
For maximization problems of the form
439+
440+
.. math::
441+
442+
\begin{aligned}
443+
\max\quad & f(x) \\
444+
\text{s.t.}\quad & c_i(x) = 0 \quad \forall i \in \mathcal{E} \\
445+
& g_i(x) \le 0 \quad \forall i \in \mathcal{U} \\
446+
& h_i(x) \ge 0 \quad \forall i \in \mathcal{L}
447+
\end{aligned}
448+
449+
we define the Lagrangian to be the same as above:
450+
451+
.. math::
452+
453+
\begin{aligned}
454+
L(x, \lambda, \nu, \delta)
455+
&= f(x)
456+
- \sum_{i \in \mathcal{E}} \lambda_i\,c_i(x)
457+
- \sum_{i \in \mathcal{U}} \nu_i\,g_i(x)
458+
- \sum_{i \in \mathcal{L}} \delta_i\,h_i(x)
459+
\end{aligned}
460+
461+
As a result, the signs of the duals change. The KKT conditions are
462+
463+
.. math::
464+
465+
\begin{aligned}
466+
\nabla_x L(x, \lambda, \nu, \delta) &= 0 \\
467+
c(x) &= 0 \\
468+
g(x) &\le 0 \\
469+
h(x) &\ge 0 \\
470+
\nu &\ge 0 \\
471+
\delta &\le 0 \\
472+
\nu_i\,g_i(x) &= 0 \\
473+
\delta_i\,h_i(x) &= 0
474+
\end{aligned}
475+
476+
477+
Pyomo also supports "range constraints" which are inequalities with both upper
478+
and lower bounds, where the bounds are not equal. For example,
479+
480+
.. math::
481+
482+
-1 \leq x + y \leq 1
483+
484+
These are handled very similarly to variable bounds in terms of dual sign
485+
conventions. For these, at most one "side" of the inequality can be active
486+
at a time. If neither side is active, then the dual will be zero. If the dual
487+
is nonzero, then the dual corresponds to the side of the constraint that is
488+
active. The dual for the other side will be implicitly zero. When accessing
489+
duals, the keys are the constraints. As a result, there is only one key for
490+
a range constraint, even though it is really two constraints. Therefore, the
491+
dual for the inactive side will not be reported explicitly. Again, the sign
492+
convention is based on the ``(lower, body, upper)`` representation of the
493+
constraint. Therefore, the left side of this inequality belongs to
494+
:math:`\mathcal{L}` and the right side belongs to :math:`\mathcal{U}`.

0 commit comments

Comments
 (0)