Skip to content

Commit 69328c0

Browse files
committed
Merge branch 'main' into solvers2
2 parents f6380e3 + 166119a commit 69328c0

File tree

340 files changed

+7763
-6832
lines changed

Some content is hidden

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

340 files changed

+7763
-6832
lines changed

.codecov.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
codecov:
22
notify:
33
# GHA: 5, Jenkins: 11
4-
# Accurate as of July 3, 2024
5-
# Potential to change when Python versions change
6-
after_n_builds: 16
7-
wait_for_ci: true
4+
# Accurate as of April 1, 2025
5+
# Potential to change when Python versions change. We will allow
6+
# codecov to start reporting when 80% of the reports are in. This
7+
# will hopefully help avoid an issue where codecov is not tracking
8+
# PR branches (see https://github.com/codecov/feedback/issues/692).
9+
after_n_builds: 13
10+
wait_for_ci: false
811
require_ci_to_pass: false
12+
comment:
13+
after_n_builds: 13
914
coverage:
10-
range:
11-
- 50.0
12-
- 100.0
15+
range: 70..98
1316
status:
1417
patch:
1518
default:

.github/workflows/test_branches.yml

+9-23
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ env:
2626
CACHE_VER: v221013.1
2727
NEOS_EMAIL: [email protected]
2828
SRC_REF: ${{ github.head_ref || github.ref }}
29+
PYOMO_WORKFLOW: branch
2930

3031
jobs:
3132
lint:
3233
name: lint/style-and-typos
34+
if: |
35+
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
36+
github.event.pull_request.draft ) }}
3337
runs-on: ubuntu-latest
3438
steps:
3539
- name: Checkout Pyomo source
@@ -48,6 +52,7 @@ jobs:
4852
with:
4953
config: ./.github/workflows/typos.toml
5054
- name: URL Checker
55+
if: env.PYOMO_WORKFLOW == 'branch'
5156
uses: urlstechie/[email protected]
5257
with:
5358
# A comma-separated list of file types to cover in the URL checks
@@ -805,7 +810,8 @@ jobs:
805810
cover:
806811
name: process-coverage-${{ matrix.TARGET }}
807812
needs: build
808-
if: ${{ false }} # turn off for branches
813+
# run even if a build job fails, but not if canceled (except for branches)
814+
if: ${{ false }}
809815
runs-on: ${{ matrix.os }}
810816
timeout-minutes: 10
811817
strategy:
@@ -876,26 +882,6 @@ jobs:
876882
$PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \
877883
parse_data_commands; parse_data_commands(data='')"
878884
879-
- name: Update codecov uploader
880-
run: |
881-
set +e
882-
CODECOV="${GITHUB_WORKSPACE}/codecov.sh"
883-
echo "CODECOV=$CODECOV" >> $GITHUB_ENV
884-
for i in `seq 3`; do
885-
echo "Downloading current codecov script (attempt ${i})"
886-
curl -L https://codecov.io/bash -o $CODECOV
887-
if test $? == 0; then
888-
break
889-
fi
890-
DELAY=$(( RANDOM % 30 + 30))
891-
echo "Pausing $DELAY seconds before re-attempting download"
892-
sleep $DELAY
893-
done
894-
if test ! -e $CODECOV; then
895-
echo "Failed to download codecov.sh"
896-
exit 1
897-
fi
898-
899885
- name: Combine coverage reports
900886
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
901887
run: |
@@ -934,7 +920,7 @@ jobs:
934920
935921
- name: Upload codecov reports
936922
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
937-
uses: codecov/codecov-action@v4
923+
uses: codecov/codecov-action@v5
938924
with:
939925
files: coverage.xml
940926
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}
@@ -946,7 +932,7 @@ jobs:
946932
if: |
947933
hashFiles('coverage-other.xml') != '' &&
948934
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
949-
uses: codecov/codecov-action@v4
935+
uses: codecov/codecov-action@v5
950936
with:
951937
files: coverage-other.xml
952938
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}

.github/workflows/test_pr_and_main.yml

+26-25
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@ env:
3434
CACHE_VER: v221013.1
3535
NEOS_EMAIL: [email protected]
3636
SRC_REF: ${{ github.head_ref || github.ref }}
37+
PYOMO_WORKFLOW: |
38+
${{ ( contains(github.event.pull_request.title, '[WIP]') ||
39+
github.event.pull_request.draft ) && 'draft_pr'
40+
|| github.event.pull_request.number && 'pr' || 'main' }}
3741
3842
jobs:
3943
lint:
4044
name: lint/style-and-typos
41-
runs-on: ubuntu-latest
4245
if: |
43-
contains(github.event.pull_request.title, '[WIP]') != true && !github.event.pull_request.draft
46+
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
47+
github.event.pull_request.draft ) }}
48+
runs-on: ubuntu-latest
4449
steps:
4550
- name: Checkout Pyomo source
4651
uses: actions/checkout@v4
@@ -57,6 +62,21 @@ jobs:
5762
uses: crate-ci/typos@master
5863
with:
5964
config: ./.github/workflows/typos.toml
65+
- name: URL Checker
66+
if: env.PYOMO_WORKFLOW == 'branch'
67+
uses: urlstechie/[email protected]
68+
with:
69+
# A comma-separated list of file types to cover in the URL checks
70+
file_types: .md,.rst,.py
71+
# Choose whether to include file with no URLs in the prints.
72+
print_all: false
73+
# More verbose summary at the end of a run
74+
verbose: true
75+
# How many times to retry a failed request (defaults to 1)
76+
retry_count: 3
77+
# Exclude Jenkins because it's behind a firewall; ignore RTD because
78+
# a magically-generated string is triggering a failure
79+
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
6080

6181

6282
build:
@@ -843,7 +863,8 @@ jobs:
843863
cover:
844864
name: process-coverage-${{ matrix.TARGET }}
845865
needs: build
846-
if: success() || failure() # run even if a build job fails, but not if cancelled
866+
# run even if a build job fails, but not if canceled (except for branches)
867+
if: success() || failure()
847868
runs-on: ${{ matrix.os }}
848869
timeout-minutes: 10
849870
strategy:
@@ -914,26 +935,6 @@ jobs:
914935
$PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \
915936
parse_data_commands; parse_data_commands(data='')"
916937
917-
- name: Update codecov uploader
918-
run: |
919-
set +e
920-
CODECOV="${GITHUB_WORKSPACE}/codecov.sh"
921-
echo "CODECOV=$CODECOV" >> $GITHUB_ENV
922-
for i in `seq 3`; do
923-
echo "Downloading current codecov script (attempt ${i})"
924-
curl -L https://codecov.io/bash -o $CODECOV
925-
if test $? == 0; then
926-
break
927-
fi
928-
DELAY=$(( RANDOM % 30 + 30))
929-
echo "Pausing $DELAY seconds before re-attempting download"
930-
sleep $DELAY
931-
done
932-
if test ! -e $CODECOV; then
933-
echo "Failed to download codecov.sh"
934-
exit 1
935-
fi
936-
937938
- name: Combine coverage reports
938939
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
939940
run: |
@@ -972,7 +973,7 @@ jobs:
972973
973974
- name: Upload codecov reports
974975
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
975-
uses: codecov/codecov-action@v4
976+
uses: codecov/codecov-action@v5
976977
with:
977978
files: coverage.xml
978979
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}
@@ -984,7 +985,7 @@ jobs:
984985
if: |
985986
hashFiles('coverage-other.xml') != '' &&
986987
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
987-
uses: codecov/codecov-action@v4
988+
uses: codecov/codecov-action@v5
988989
with:
989990
files: coverage-other.xml
990991
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}

doc/OnlineDocs/contribution_guide.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ provides an example of how this can be done, including a directory
413413
for plugins and package tests. For example, this package can be
414414
imported as a subpackage of ``pyomo.contrib``::
415415

416-
from pyomo.environ import *
416+
import pyomo.environ as pyo
417417
from pyomo.contrib.example import a
418418

419419
# Print the value of 'a' defined by this package

doc/OnlineDocs/explanation/analysis/sensitivity_toolbox.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ Here :math:`x_1`, :math:`x_2`, and :math:`x_3` are the decision variables while
3131
.. doctest:: python
3232

3333
# Import Pyomo and the sensitivity toolbox
34-
>>> from pyomo.environ import *
34+
>>> import pyomo.environ as pyo
3535
>>> from pyomo.contrib.sensitivity_toolbox.sens import sensitivity_calculation
3636

3737
# Create a concrete model
38-
>>> m = ConcreteModel()
38+
>>> m = pyo.ConcreteModel()
3939

4040
# Define the variables with bounds and initial values
41-
>>> m.x1 = Var(initialize = 0.15, within=NonNegativeReals)
42-
>>> m.x2 = Var(initialize = 0.15, within=NonNegativeReals)
43-
>>> m.x3 = Var(initialize = 0.0, within=NonNegativeReals)
41+
>>> m.x1 = pyo.Var(initialize = 0.15, within=pyo.NonNegativeReals)
42+
>>> m.x2 = pyo.Var(initialize = 0.15, within=pyo.NonNegativeReals)
43+
>>> m.x3 = pyo.Var(initialize = 0.0, within=pyo.NonNegativeReals)
4444

4545
# Define the parameters
46-
>>> m.eta1 = Param(initialize=4.5,mutable=True)
47-
>>> m.eta2 = Param(initialize=1.0,mutable=True)
46+
>>> m.eta1 = pyo.Param(initialize=4.5,mutable=True)
47+
>>> m.eta2 = pyo.Param(initialize=1.0,mutable=True)
4848

4949
# Define the constraints and objective
50-
>>> m.const1 = Constraint(expr=6*m.x1+3*m.x2+2*m.x3-m.eta1 ==0)
51-
>>> m.const2 = Constraint(expr=m.eta2*m.x1+m.x2-m.x3-1 ==0)
52-
>>> m.cost = Objective(expr=m.x1**2+m.x2**2+m.x3**2)
50+
>>> m.const1 = pyo.Constraint(expr=6*m.x1+3*m.x2+2*m.x3-m.eta1 ==0)
51+
>>> m.const2 = pyo.Constraint(expr=m.eta2*m.x1+m.x2-m.x3-1 ==0)
52+
>>> m.cost = pyo.Objective(expr=m.x1**2+m.x2**2+m.x3**2)
5353

5454

5555
The solution of this optimization problem is :math:`x_1^* = 0.5`, :math:`x_2^* = 0.5`, and :math:`x_3^* = 0.0`. But what if we change the parameter values to :math:`\hat{p}_1 = 4.0` and :math:`\hat{p}_2 = 1.0`? Is there a quick way to approximate the new solution :math:`\hat{x}_1^*`, :math:`\hat{x}_2^*`, and :math:`\hat{x}_3^*`? Yes! This is the main functionality of sIPOPT and k_aug.
@@ -58,8 +58,8 @@ Next we define the perturbed parameter values :math:`\hat{p}_1` and :math:`\hat{
5858

5959
.. doctest:: python
6060

61-
>>> m.perturbed_eta1 = Param(initialize = 4.0)
62-
>>> m.perturbed_eta2 = Param(initialize = 1.0)
61+
>>> m.perturbed_eta1 = pyo.Param(initialize = 4.0)
62+
>>> m.perturbed_eta2 = pyo.Param(initialize = 1.0)
6363

6464
And finally we call sIPOPT or k_aug:
6565

0 commit comments

Comments
 (0)