Skip to content

Commit 956c201

Browse files
committed
Merge remote-tracking branch 'refs/remotes/me/nlv2-presolve-defined-vars' into nlv2-presolve-defined-vars
2 parents 1bed2c6 + 15088de commit 956c201

File tree

9 files changed

+62
-38
lines changed

9 files changed

+62
-38
lines changed

Diff for: .github/workflows/test_branches.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ jobs:
5151
uses: urlstechie/[email protected]
5252
with:
5353
# A comma-separated list of file types to cover in the URL checks
54-
file_types: .md,.rst
54+
file_types: .md,.rst,.py
5555
# Choose whether to include file with no URLs in the prints.
5656
print_all: false
5757
# More verbose summary at the end of a run
5858
verbose: true
5959
# How many times to retry a failed request (defaults to 1)
6060
retry_count: 3
61-
# Exclude Jenkins because it's behind a firewall
62-
exclude_urls: https://pyomo-jenkins.sandia.gov/
61+
# Exclude Jenkins because it's behind a firewall; ignore RTD because
62+
# a magically-generated string is triggering a failure
63+
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
6364

6465

6566
build:

Diff for: .github/workflows/test_pr_and_main.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ jobs:
6161
uses: urlstechie/[email protected]
6262
with:
6363
# A comma-separated list of file types to cover in the URL checks
64-
file_types: .md,.rst
64+
file_types: .md,.rst,.py
6565
# Choose whether to include file with no URLs in the prints.
6666
print_all: false
6767
# More verbose summary at the end of a run
6868
verbose: true
6969
# How many times to retry a failed request (defaults to 1)
7070
retry_count: 3
71-
# Exclude Jenkins because it's behind a firewall
72-
exclude_urls: https://pyomo-jenkins.sandia.gov/
71+
# Exclude Jenkins because it's behind a firewall; ignore RTD because
72+
# a magically-generated string is triggering a failure
73+
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
7374

7475

7576
build:
@@ -85,6 +86,11 @@ jobs:
8586
other: [""]
8687
category: [""]
8788

89+
# win/3.8 conda builds no longer work due to environment not being able
90+
# to resolve. We are skipping it now.
91+
exclude:
92+
- os: windows-latest
93+
python: 3.8
8894
include:
8995
- os: ubuntu-latest
9096
TARGET: linux

Diff for: examples/dae/ReactionKinetics.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,10 @@ def regression_model():
304304

305305
# Model & data from:
306306
#
307-
# http://www.doiserbia.nb.rs/img/doi/0367-598X/2014/0367-598X1300037A.pdf
307+
# https://doiserbia.nb.rs/img/doi/0367-598X/2014/0367-598X1300037A.pdf
308+
# Almagrbi, A. M., Hatami, T., Glišić, S., & Orlović, A. (2014).
309+
# Determination of kinetic parameters for complex transesterification
310+
# reaction by standard optimisation methods.
308311
#
309312
model = ConcreteModel()
310313

Diff for: pyomo/common/gsl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
)
2424
def get_gsl(downloader):
2525
logger.info(
26-
"As of February 9, 2023, AMPL GSL can no longer be downloaded\
27-
through download-extensions. Visit https://portal.ampl.com/\
26+
"As of February 9, 2023, AMPL GSL can no longer be downloaded \
27+
through download-extensions. Visit https://portal.ampl.com/ \
2828
to download the AMPL GSL binaries."
2929
)
3030

Diff for: pyomo/core/plugins/transform/model.py

+7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@
1616
# because we may support an explicit matrix representation for models.
1717
#
1818

19+
from pyomo.common.deprecation import deprecated
1920
from pyomo.core.base import Objective, Constraint
2021
import array
2122

2223

24+
@deprecated(
25+
"to_standard_form() is deprecated. "
26+
"Please use WriterFactory('compile_standard_form')",
27+
version='6.7.3.dev0',
28+
remove_in='6.8.0',
29+
)
2330
def to_standard_form(self):
2431
"""
2532
Produces a standard-form representation of the model. Returns

Diff for: pyomo/dataportal/plugins/db_table.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,9 @@ def __init__(self, filename=None, data=None):
385385
will override that in the file.
386386
"""
387387

388-
# ugh hardcoded strings. See following URL for info:
389-
# http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.odbc.doc/odbc58.htm
388+
# Hardcoded string required here.
389+
# See documentation:
390+
# https://www.ibm.com/docs/en/informix-servers/12.10?topic=SSGU8G_12.1.0/com.ibm.odbc.doc/ids_odbc_062.html
390391
self.ODBC_DS_KEY = 'ODBC Data Sources'
391392
self.ODBC_INFO_KEY = 'ODBC'
392393

Diff for: pyomo/repn/tests/ampl/test_nlv2.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -2657,11 +2657,15 @@ def test_presolve_defined_var_to_const(self):
26572657
nl_writer.NLWriter().write(
26582658
m, OUT, symbolic_solver_labels=True, linear_presolve=True
26592659
)
2660+
# Note that the presolve will end up recognizing con3 as a
2661+
# linear constraint; however, it does not do so until processing
2662+
# the constraints after presolve (so the constraint is not
2663+
# actually removed and the eq variable still appears in the model)
26602664
self.assertEqual(
26612665
*nl_diff(
26622666
"""g3 1 1 0 #problem unknown
26632667
1 1 0 0 1 #vars, constraints, objectives, ranges, eqns
2664-
1 0 0 0 0 0 #nonlinear constrs, objs; ccons: lin, nonlin, nd, nzlb
2668+
0 0 0 0 0 0 #nonlinear constrs, objs; ccons: lin, nonlin, nd, nzlb
26652669
0 0 #network constraints: nonlinear, linear
26662670
0 0 0 #nonlinear vars in constraints, objectives, both
26672671
0 0 0 1 #linear network variables; functions; arith, flags
@@ -2670,13 +2674,11 @@ def test_presolve_defined_var_to_const(self):
26702674
4 2 #max name lengths: constraints, variables
26712675
0 0 0 0 0 #common exprs: b,c,o,c1,o1
26722676
C0 #con3
2673-
o3 #/
2674-
n8
2675-
n-4
2677+
n0
26762678
x1 #initial guess
26772679
0 100 #eq
26782680
r #1 ranges (rhs's)
2679-
4 0 #con3
2681+
4 2.0 #con3
26802682
b #1 bounds (on variables)
26812683
3 #eq
26822684
k0 #intermediate Jacobian column lengths

Diff for: pyomo/scripting/plugins/download.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def _call_impl(self, args, unparsed, logger):
3838
self.downloader.cacert = args.cacert
3939
self.downloader.insecure = args.insecure
4040
logger.info(
41-
"As of February 9, 2023, AMPL GSL can no longer be downloaded\
42-
through download-extensions. Visit https://portal.ampl.com/\
43-
to download the AMPL GSL binaries."
41+
"As of February 9, 2023, AMPL GSL can no longer be downloaded \
42+
through download-extensions. Visit https://portal.ampl.com/ \
43+
to download the AMPL GSL binaries."
4444
)
4545
for target in DownloadFactory:
4646
try:

Diff for: pyomo/solvers/plugins/solvers/CBCplugin.py

+23-19
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def process_logfile(self):
455455
tokens = tuple(re.split('[ \t]+', line.strip()))
456456
n_tokens = len(tokens)
457457
if n_tokens > 1:
458-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L3769
458+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L3769
459459
if n_tokens > 4 and tokens[:4] == (
460460
'Continuous',
461461
'objective',
@@ -539,7 +539,7 @@ def process_logfile(self):
539539
results.problem.name = results.problem.name.split('/')[-1]
540540
if '\\' in results.problem.name:
541541
results.problem.name = results.problem.name.split('\\')[-1]
542-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L10840
542+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L10840
543543
elif tokens[0] == 'Presolve':
544544
if n_tokens > 9 and tokens[3] == 'rows,' and tokens[6] == 'columns':
545545
results.problem.number_of_variables = int(tokens[4]) - int(
@@ -551,7 +551,7 @@ def process_logfile(self):
551551
results.problem.number_of_objectives = 1
552552
elif n_tokens > 6 and tokens[6] == 'infeasible':
553553
soln.status = SolutionStatus.infeasible
554-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L11105
554+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L11105
555555
elif (
556556
n_tokens > 11
557557
and tokens[:2] == ('Problem', 'has')
@@ -563,7 +563,7 @@ def process_logfile(self):
563563
results.problem.number_of_constraints = int(tokens[2])
564564
results.problem.number_of_nonzeros = int(tokens[6][1:])
565565
results.problem.number_of_objectives = 1
566-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L10814
566+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L10814
567567
elif (
568568
n_tokens > 8
569569
and tokens[:3] == ('Original', 'problem', 'has')
@@ -579,7 +579,7 @@ def process_logfile(self):
579579
in ' '.join(tokens)
580580
):
581581
results.problem.sense = maximize
582-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L3047
582+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L3047
583583
elif n_tokens > 3 and tokens[:2] == ('Result', '-'):
584584
if tokens[2:4] in [('Run', 'abandoned'), ('User', 'ctrl-c')]:
585585
results.solver.termination_condition = (
@@ -609,15 +609,15 @@ def process_logfile(self):
609609
'solution': TerminationCondition.other,
610610
'iterations': TerminationCondition.maxIterations,
611611
}.get(tokens[4], TerminationCondition.other)
612-
# perhaps from https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L12318
612+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L12318
613613
elif n_tokens > 3 and tokens[2] == "Finished":
614614
soln.status = SolutionStatus.optimal
615615
optim_value = _float(tokens[4])
616-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7904
616+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7904
617617
elif n_tokens >= 3 and tokens[:2] == ('Objective', 'value:'):
618618
# parser for log file generetated with discrete variable
619619
optim_value = _float(tokens[2])
620-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7904
620+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7904
621621
elif n_tokens >= 4 and tokens[:4] == (
622622
'No',
623623
'feasible',
@@ -630,25 +630,25 @@ def process_logfile(self):
630630
lower_bound is None
631631
): # Only use if not already found since this is to less decimal places
632632
results.problem.lower_bound = _float(tokens[2])
633-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7918
633+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7918
634634
elif tokens[0] == 'Gap:':
635635
# This is relative and only to 2 decimal places - could calculate explicitly using lower bound
636636
gap = _float(tokens[1])
637-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7923
637+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7923
638638
elif n_tokens > 2 and tokens[:2] == ('Enumerated', 'nodes:'):
639639
nodes = int(tokens[2])
640-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7926
640+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7926
641641
elif n_tokens > 2 and tokens[:2] == ('Total', 'iterations:'):
642642
results.solver.statistics.black_box.number_of_iterations = int(
643643
tokens[2]
644644
)
645-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7930
645+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7930
646646
elif n_tokens > 3 and tokens[:3] == ('Time', '(CPU', 'seconds):'):
647647
results.solver.system_time = _float(tokens[3])
648-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L7933
648+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L7933
649649
elif n_tokens > 3 and tokens[:3] == ('Time', '(Wallclock', 'Seconds):'):
650650
results.solver.wallclock_time = _float(tokens[3])
651-
# https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp?rev=2497#L10477
651+
# https://github.com/coin-or/Cbc/blob/cb6bf98/Cbc/src/CbcSolver.cpp#L10477
652652
elif n_tokens > 4 and tokens[:4] == (
653653
'Total',
654654
'time',
@@ -832,11 +832,15 @@ def process_soln_file(self, results):
832832
tokens = tuple(re.split('[ \t]+', line.strip()))
833833
n_tokens = len(tokens)
834834
#
835-
# These are the only header entries CBC will generate (identified via browsing CbcSolver.cpp)
836-
# See https://projects.coin-or.org/Cbc/browser/trunk/Cbc/src/CbcSolver.cpp
837-
# Search for (no integer solution - continuous used) Currently line 9912 as of rev2497
838-
# Note that since this possibly also covers old CBC versions, we shall not be removing any functionality,
839-
# even if it is not seen in the current revision
835+
# These are the only header entries CBC will generate
836+
# (identified via browsing CbcSolver.cpp). See
837+
# https://github.com/coin-or/Cbc/tree/master/src/CbcSolver.cpp
838+
# Search for "(no integer solution - continuous used)"
839+
# (L10796 as of cb855c7)
840+
#
841+
# Note that since this possibly also supports old CBC
842+
# versions, we shall not be removing any functionality, even
843+
# if it is not seen in the current revision
840844
#
841845
if not header_processed:
842846
if tokens[0] == 'Optimal':

0 commit comments

Comments
 (0)