Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New year infrastructure / CI fixes #3453

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release_wheel_creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [all]
wheel-version: ['cp39*', 'cp310*', 'cp311*', 'cp312*', 'cp313*']

Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
os: [ubuntu-latest]
arch: [all]
wheel-version: ['cp39*', 'cp310*', 'cp311*', 'cp312*', 'cp313*']

Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ jobs:
# have support for OSX.
- name: Set up UI testing infrastructure
if: ${{ matrix.TARGET != 'osx' }}
uses: pyvista/setup-headless-display-action@v2
uses: pyvista/setup-headless-display-action@v3
with:
qt: true
pyvista: false
Expand Down Expand Up @@ -428,13 +428,18 @@ jobs:
mkdir -p "$DOWNLOAD_DIR"
echo "TPL_DIR=$TPL_DIR" >> $GITHUB_ENV
echo "DOWNLOAD_DIR=$DOWNLOAD_DIR" >> $GITHUB_ENV
# Create a new PYOMO_PATH variable so we can ensure that we are actually
# getting the right PATH at the end
echo "PYOMO_PATH=$PATH" >> $GITHUB_ENV

- name: Install Ipopt
if: ${{ ! matrix.slim }}
run: |
IPOPT_DIR=$TPL_DIR/ipopt
echo "$IPOPT_DIR" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPT_DIR" >> $GITHUB_ENV
NEW_PYOMO_PATH="$IPOPT_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
mkdir -p $IPOPT_DIR
IPOPT_TAR=${DOWNLOAD_DIR}/ipopt.tar.gz
if test ! -e $IPOPT_TAR; then
Expand Down Expand Up @@ -511,7 +516,9 @@ jobs:
- name: Install GAMS Python bindings
if: ${{ ! matrix.slim }}
run: |
GAMS_DIR="${env:TPL_DIR}/gams"
GAMS_DIR="$TPL_DIR/gams"
NEW_PYOMO_PATH="$GAMS_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
py_ver=$($PYTHON_EXE -c 'import sys;v="_%s%s" % sys.version_info[:2] \
;print(v if v != "_27" else "")')
if test -e $GAMS_DIR/apifiles/Python/api$py_ver; then
Expand All @@ -528,6 +535,17 @@ jobs:
$BARON_DIR = "${env:TPL_DIR}/baron"
echo "$BARON_DIR" | `
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$CURRENT_PYOMO_PATH="${env:PYOMO_PATH}"
# Prepend BARON_DIR with appropriate path separator
if ( "${{matrix.TARGET}}" -eq "win" ) {
$PATH_SEPARATOR = ";"
} else {
$PATH_SEPARATOR = ":"
}
$NEW_PYOMO_PATH = "$BARON_DIR$PATH_SEPARATOR$CURRENT_PYOMO_PATH"
echo "New PYOMO_PATH: $NEW_PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" | `
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$URL = "https://minlp-downloads.nyc3.cdn.digitaloceanspaces.com/xecs/baron/current/"
if ( "${{matrix.TARGET}}" -eq "win" ) {
$INSTALLER = "${env:DOWNLOAD_DIR}/baron_install.exe"
Expand Down Expand Up @@ -562,6 +580,8 @@ jobs:
run: |
GJH_DIR="$TPL_DIR/gjh"
echo "${GJH_DIR}" >> $GITHUB_PATH
NEW_PYOMO_PATH="$GJH_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
INSTALL_DIR="${DOWNLOAD_DIR}/gjh"
if test ! -e "$INSTALL_DIR/bin"; then
mkdir -p "$INSTALL_DIR"
Expand Down Expand Up @@ -637,6 +657,11 @@ jobs:

- name: Report pyomo plugin information
run: |
# MRM / Jan 9, 2025: We update the PATH manually to make sure we capture
# the all of our changes. This is necessary because of an
# issue with how the PATH rearranges on Windows.
# Issue: https://github.com/actions/runner-images/issues/11328
export PATH=$PYOMO_PATH
echo "$PATH"
pyomo help --solvers || exit 1
pyomo help --transformations || exit 1
Expand All @@ -645,6 +670,7 @@ jobs:
- name: Run Pyomo tests
if: matrix.mpi == 0
run: |
export PATH=$PYOMO_PATH
$PYTHON_EXE -m pytest -v \
-W ignore::Warning ${{matrix.category}} \
pyomo `pwd`/pyomo-model-libraries \
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
PACKAGES: pyutilib

- os: ubuntu-latest
python: pypy-3.9
python: 'pypy-3.10'
skip_doctest: 1
TARGET: linux
PYENV: pip
Expand Down Expand Up @@ -266,7 +266,7 @@ jobs:
# have support for OSX.
- name: Set up UI testing infrastructure
if: ${{ matrix.TARGET != 'osx' }}
uses: pyvista/setup-headless-display-action@v2
uses: pyvista/setup-headless-display-action@v3
with:
qt: true
pyvista: false
Expand Down Expand Up @@ -460,13 +460,18 @@ jobs:
mkdir -p "$DOWNLOAD_DIR"
echo "TPL_DIR=$TPL_DIR" >> $GITHUB_ENV
echo "DOWNLOAD_DIR=$DOWNLOAD_DIR" >> $GITHUB_ENV
# Create a new PYOMO_PATH variable so we can ensure that we are actually
# getting the right PATH at the end
echo "PYOMO_PATH=$PATH" >> $GITHUB_ENV

- name: Install Ipopt
if: ${{ ! matrix.slim }}
run: |
IPOPT_DIR=$TPL_DIR/ipopt
echo "$IPOPT_DIR" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPT_DIR" >> $GITHUB_ENV
NEW_PYOMO_PATH="$IPOPT_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
mkdir -p $IPOPT_DIR
IPOPT_TAR=${DOWNLOAD_DIR}/ipopt.tar.gz
if test ! -e $IPOPT_TAR; then
Expand Down Expand Up @@ -543,7 +548,9 @@ jobs:
- name: Install GAMS Python bindings
if: ${{ ! matrix.slim }}
run: |
GAMS_DIR="${env:TPL_DIR}/gams"
GAMS_DIR="$TPL_DIR/gams"
NEW_PYOMO_PATH="$GAMS_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
py_ver=$($PYTHON_EXE -c 'import sys;v="_%s%s" % sys.version_info[:2] \
;print(v if v != "_27" else "")')
if test -e $GAMS_DIR/apifiles/Python/api$py_ver; then
Expand All @@ -560,6 +567,17 @@ jobs:
$BARON_DIR = "${env:TPL_DIR}/baron"
echo "$BARON_DIR" | `
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$CURRENT_PYOMO_PATH="${env:PYOMO_PATH}"
# Prepend BARON_DIR with appropriate path separator
if ( "${{matrix.TARGET}}" -eq "win" ) {
$PATH_SEPARATOR = ";"
} else {
$PATH_SEPARATOR = ":"
}
$NEW_PYOMO_PATH = "$BARON_DIR$PATH_SEPARATOR$CURRENT_PYOMO_PATH"
echo "New PYOMO_PATH: $NEW_PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" | `
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$URL = "https://minlp-downloads.nyc3.cdn.digitaloceanspaces.com/xecs/baron/current/"
if ( "${{matrix.TARGET}}" -eq "win" ) {
$INSTALLER = "${env:DOWNLOAD_DIR}/baron_install.exe"
Expand Down Expand Up @@ -594,6 +612,8 @@ jobs:
run: |
GJH_DIR="$TPL_DIR/gjh"
echo "${GJH_DIR}" >> $GITHUB_PATH
NEW_PYOMO_PATH="$GJH_DIR:$PYOMO_PATH"
echo "PYOMO_PATH=$NEW_PYOMO_PATH" >> $GITHUB_ENV
INSTALL_DIR="${DOWNLOAD_DIR}/gjh"
if test ! -e "$INSTALL_DIR/bin"; then
mkdir -p "$INSTALL_DIR"
Expand Down Expand Up @@ -670,6 +690,11 @@ jobs:

- name: Report pyomo plugin information
run: |
# MRM / Jan 9, 2025: We update the PATH manually to make sure we capture
# the all of our changes. This is necessary because of an
# issue with how the PATH rearranges on Windows.
# Issue: https://github.com/actions/runner-images/issues/11328
export PATH=$PYOMO_PATH
echo "$PATH"
pyomo help --solvers || exit 1
pyomo help --transformations || exit 1
Expand All @@ -678,6 +703,7 @@ jobs:
- name: Run Pyomo tests
if: matrix.mpi == 0
run: |
export PATH=$PYOMO_PATH
$PYTHON_EXE -m pytest -v \
-W ignore::Warning ${{matrix.category}} \
pyomo `pwd`/pyomo-model-libraries \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Pyomo is available under the BSD License - see the
Pyomo is currently tested with the following Python implementations:

* CPython: 3.9, 3.10, 3.11, 3.12, 3.13
* PyPy: 3.9
* PyPy: 3.10

_Testing and support policy_:

Expand Down
2 changes: 1 addition & 1 deletion doc/OnlineDocs/explanation/analysis/doe/doe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pyomo.DoE

**Pyomo.DoE** (Pyomo Design of Experiments) is a Python library for model-based design of experiments using science-based models.

Pyomo.DoE was developed by **Jialu Wang** and **Alexander W. Dowling** at the University of Notre Dame as part of the `Carbon Capture Simulation for Industry Impact (CCSI2) <https://www.acceleratecarboncapture.org/>`_.
Pyomo.DoE was developed by **Jialu Wang** and **Alexander W. Dowling** at the University of Notre Dame as part of the `Carbon Capture Simulation for Industry Impact (CCSI2) <https://github.com/CCSI-Toolset/>`_.
project, funded through the U.S. Department Of Energy Office of Fossil Energy.

If you use Pyomo.DoE, please cite:
Expand Down
6 changes: 3 additions & 3 deletions pyomo/contrib/doe/doe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def compute_FIM_full_factorial(
}
)

succeses = 0
successes = 0
failures = 0
total_points = np.prod(
np.array([len(v) for k, v in design_ranges_enum.items()])
Expand All @@ -1477,14 +1477,14 @@ def compute_FIM_full_factorial(

# Compute FIM with given options
try:
curr_point = succeses + failures + 1
curr_point = successes + failures + 1

# Logging information for each run
self.logger.info("This is run %s out of %s.", curr_point, total_points)

# Attempt the FIM computation
self.compute_FIM(model=model, method=method)
succeses += 1
successes += 1

# iteration time
iter_t = iter_timer.toc(msg=None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pyomo.common.unittest as unittest
import pyomo.environ as pyo
import os
from pyomo.common.tempfiles import TempfileManager

from pyomo.contrib.pynumero.dependencies import (
numpy as np,
Expand Down Expand Up @@ -219,24 +219,25 @@ def test_model1_with_scaling(self):
m.scaling_factor[m.d] = 3.0 # scale the inequality constraint
m.scaling_factor[m.x[1]] = 4.0 # scale one of the x variables

cynlp = CyIpoptNLP(PyomoNLP(m))
options = {
'nlp_scaling_method': 'user-scaling',
'output_file': '_cyipopt-scaling.log',
'file_print_level': 10,
'max_iter': 0,
}
solver = CyIpoptSolver(cynlp, options=options)
x, info = solver.solve()

with open('_cyipopt-scaling.log', 'r') as fd:
solver_trace = fd.read()
cynlp.close()
os.remove('_cyipopt-scaling.log')

# check for the following strings in the log and then delete the log
with TempfileManager.new_context() as temp:
cynlp = CyIpoptNLP(PyomoNLP(m))
logfile = temp.create_tempfile('_cyipopt-scaling.log')
options = {
'nlp_scaling_method': 'user-scaling',
'output_file': logfile,
'file_print_level': 10,
'max_iter': 0,
}
solver = CyIpoptSolver(cynlp, options=options)
x, info = solver.solve()
cynlp.close()

with open(logfile, 'r') as fd:
solver_trace = fd.read()

# check for the following strings in the log
self.assertIn('nlp_scaling_method = user-scaling', solver_trace)
self.assertIn('output_file = _cyipopt-scaling.log', solver_trace)
self.assertIn(f"output_file = {logfile}", solver_trace)
self.assertIn('objective scaling factor = 1e-06', solver_trace)
self.assertIn('x scaling provided', solver_trace)
self.assertIn('c scaling provided', solver_trace)
Expand Down
Loading
Loading