Skip to content

Commit 3e22ed0

Browse files
committed
Updated to current upstream master
2 parents 4aacc26 + 08f4188 commit 3e22ed0

Some content is hidden

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

68 files changed

+170
-145
lines changed

.github/workflows/pr_master_test.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ jobs:
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
os: [ubuntu-latest, macos-latest, windows-latest]
40+
os: [ubuntu-18.04, macos-latest, windows-latest]
4141
python: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3]
4242
other: [""]
43+
# Ubuntu-18.04 should be replaced with ubuntu-latest once PyNumero
44+
# build error is resolved:
45+
# https://github.com/Pyomo/pyomo/issues/1710
4346

4447
include:
45-
- os: ubuntu-latest
48+
- os: ubuntu-18.04
4649
TARGET: linux
4750
PYENV: pip
4851

@@ -55,7 +58,7 @@ jobs:
5558
PYENV: conda
5659
PACKAGES: glpk
5760

58-
- os: ubuntu-latest
61+
- os: ubuntu-18.04
5962
python: 3.7
6063
other: /mpi
6164
mpi: 3
@@ -64,15 +67,15 @@ jobs:
6467
PYENV: conda
6568
PACKAGES: mpi4py openmpi
6669

67-
- os: ubuntu-latest
70+
- os: ubuntu-18.04
6871
python: 3.9
6972
other: /slim
7073
slim: 1
7174
skip_doctest: 1
7275
TARGET: linux
7376
PYENV: pip
7477

75-
- os: ubuntu-latest
78+
- os: ubuntu-18.04
7679
python: 3.6
7780
other: /cython
7881
setup_options: --with-cython
@@ -491,10 +494,10 @@ jobs:
491494
strategy:
492495
fail-fast: false
493496
matrix:
494-
os: [ubuntu-latest, macos-latest, windows-latest]
497+
os: [ubuntu-18.04, macos-latest, windows-latest]
495498

496499
include:
497-
- os: ubuntu-latest
500+
- os: ubuntu-18.04
498501
TARGET: linux
499502
- os: macos-latest
500503
TARGET: osx

.github/workflows/push_branch_test.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ jobs:
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
os: [ubuntu-latest]
37+
os: [ubuntu-18.04]
3838
python: [3.8]
3939
other: [""]
40+
# Ubuntu-18.04 should be replaced with ubuntu-latest once PyNumero
41+
# build error is resolved:
42+
# https://github.com/Pyomo/pyomo/issues/1710
4043

4144
include:
42-
- os: ubuntu-latest
45+
- os: ubuntu-18.04
4346
TARGET: linux
4447
PYENV: pip
4548

@@ -54,7 +57,7 @@ jobs:
5457
PYENV: conda
5558
PACKAGES: glpk
5659

57-
- os: ubuntu-latest
60+
- os: ubuntu-18.04
5861
python: 3.7
5962
other: /mpi
6063
mpi: 3
@@ -63,15 +66,15 @@ jobs:
6366
PYENV: conda
6467
PACKAGES: mpi4py openmpi
6568

66-
- os: ubuntu-latest
69+
- os: ubuntu-18.04
6770
python: 3.9
6871
other: /slim
6972
slim: 1
7073
skip_doctest: 1
7174
TARGET: linux
7275
PYENV: pip
7376

74-
- os: ubuntu-latest
77+
- os: ubuntu-18.04
7578
python: 3.6
7679
other: /cython
7780
setup_options: --with-cython
@@ -490,10 +493,10 @@ jobs:
490493
strategy:
491494
fail-fast: false
492495
matrix:
493-
os: [ubuntu-latest, macos-latest, windows-latest]
496+
os: [ubuntu-18.04, macos-latest, windows-latest]
494497

495498
include:
496-
- os: ubuntu-latest
499+
- os: ubuntu-18.04
497500
TARGET: linux
498501
- os: macos-latest
499502
TARGET: osx

pyomo/bilevel/plugins/solver1.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
# ___________________________________________________________________________
1010

1111
import time
12-
import pyutilib.misc
1312
from pyomo.core import TransformationFactory, Var, ComponentUID, Block, Objective, Set
1413
import pyomo.opt
1514
import pyomo.common
15+
from pyomo.common.collections import Bunch
1616

1717

1818
@pyomo.opt.SolverFactory.register('bilevel_ld',
@@ -156,7 +156,7 @@ def _apply_solver(self):
156156
#
157157
# Return the sub-solver return condition value and log
158158
#
159-
return pyutilib.misc.Bunch(rc=getattr(opt,'_rc', None),
159+
return Bunch(rc=getattr(opt,'_rc', None),
160160
log=getattr(opt,'_log',None))
161161

162162
def _postsolve(self):

pyomo/bilevel/plugins/solver2.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
# ___________________________________________________________________________
1010

1111
import time
12-
import pyutilib.misc
1312
import pyomo.opt
1413
from pyomo.core import TransformationFactory, Var, Set
15-
14+
from pyomo.common.collections import Bunch
1615

1716

1817
@pyomo.opt.SolverFactory.register('bilevel_blp_global',
@@ -78,7 +77,7 @@ def _apply_solver(self):
7877
#
7978
# Return the sub-solver return condition value and log
8079
#
81-
return pyutilib.misc.Bunch(rc=getattr(opt,'_rc', None),
80+
return Bunch(rc=getattr(opt,'_rc', None),
8281
log=getattr(opt,'_log',None))
8382

8483
def _postsolve(self):

pyomo/bilevel/plugins/solver3.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
# ___________________________________________________________________________
1010

1111
import time
12-
import pyutilib.misc
1312
import pyomo.opt
14-
#from pyomo.bilevel.components import SubModel
1513
from pyomo.core import TransformationFactory, Var, Set
14+
from pyomo.common.collections import Bunch
1615

1716

1817
@pyomo.opt.SolverFactory.register('bilevel_blp_local',
@@ -81,7 +80,7 @@ def _apply_solver(self):
8180
#
8281
# Return the sub-solver return condition value and log
8382
#
84-
return pyutilib.misc.Bunch(rc=getattr(opt,'_rc', None), log=getattr(opt,'_log',None))
83+
return Bunch(rc=getattr(opt,'_rc', None), log=getattr(opt,'_log',None))
8584

8685
def _postsolve(self):
8786
#

pyomo/bilevel/plugins/solver4.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# ___________________________________________________________________________
1010

1111
import time
12-
import pyutilib.misc
1312
import pyomo.opt
1413
from pyomo.core import TransformationFactory, Var, Set
14+
from pyomo.common.collections import Bunch
1515

1616

1717
@pyomo.opt.SolverFactory.register('bilevel_bqp',
@@ -99,7 +99,7 @@ def _apply_solver(self):
9999
#
100100
# Return the sub-solver return condition value and log
101101
#
102-
return pyutilib.misc.Bunch(rc=getattr(opt,'_rc', None),
102+
return Bunch(rc=getattr(opt,'_rc', None),
103103
log=getattr(opt,'_log',None))
104104

105105
def _postsolve(self):

pyomo/common/collections/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
from .orderedset import OrderedDict, OrderedSet
2222
from .component_map import ComponentMap
2323
from .component_set import ComponentSet
24+
25+
from pyutilib.misc import Bunch, Container, Options

pyomo/common/tests/test_timing.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def test_report_timing(self):
3434
m = ConcreteModel()
3535
m.x = Var([1,2])
3636

37-
ref = """
38-
0 seconds to construct Block ConcreteModel; 1 index total
39-
0 seconds to construct RangeSet FiniteSimpleRangeSet; 1 index total
40-
0 seconds to construct Var x; 2 indicies total
41-
0 seconds to construct Suffix Suffix; 1 index total
42-
0 seconds to apply Transformation RelaxIntegerVars (in-place)
43-
""".strip()
37+
ref = r"""
38+
(0(\.\d+)?) seconds to construct Block ConcreteModel; 1 index total
39+
(0(\.\d+)?) seconds to construct RangeSet FiniteSimpleRangeSet; 1 index total
40+
(0(\.\d+)?) seconds to construct Var x; 2 indices total
41+
(0(\.\d+)?) seconds to construct Suffix Suffix; 1 index total
42+
(0(\.\d+)?) seconds to apply Transformation RelaxIntegerVars \(in-place\)
43+
""".strip()
4444

4545
xfrm = TransformationFactory('core.relax_integer_vars')
4646

@@ -51,7 +51,10 @@ def test_report_timing(self):
5151
m.r = RangeSet(2)
5252
m.x = Var(m.r)
5353
xfrm.apply_to(m)
54-
self.assertEqual(out.getvalue().strip(), ref)
54+
result = out.getvalue().strip()
55+
self.maxDiff = None
56+
for l, r in zip(result.splitlines(), ref.splitlines()):
57+
self.assertRegex(str(l.strip()), str(r.strip()))
5558
finally:
5659
report_timing(False)
5760

@@ -62,7 +65,10 @@ def test_report_timing(self):
6265
m.r = RangeSet(2)
6366
m.x = Var(m.r)
6467
xfrm.apply_to(m)
65-
self.assertEqual(os.getvalue().strip(), ref)
68+
result = os.getvalue().strip()
69+
self.maxDiff = None
70+
for l, r in zip(result.splitlines(), ref.splitlines()):
71+
self.assertRegex(str(l.strip()), str(r.strip()))
6672
finally:
6773
report_timing(False)
6874
buf = StringIO()
@@ -71,7 +77,10 @@ def test_report_timing(self):
7177
m.r = RangeSet(2)
7278
m.x = Var(m.r)
7379
xfrm.apply_to(m)
74-
self.assertEqual(os.getvalue().strip(), ref)
80+
result = os.getvalue().strip()
81+
self.maxDiff = None
82+
for l, r in zip(result.splitlines(), ref.splitlines()):
83+
self.assertRegex(str(l.strip()), str(r.strip()))
7584
self.assertEqual(buf.getvalue().strip(), "")
7685

7786
def test_TicTocTimer_tictoc(self):
@@ -131,7 +140,7 @@ def test_TicTocTimer_tictoc(self):
131140

132141
# Note: pypy on GHA frequently has timing differences of >0.02s
133142
# for the following tests
134-
RES = 4e-2
143+
RES = 5e-2
135144

136145
with capture_output() as out:
137146
delta = timer.toc()

pyomo/common/timing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __str__(self):
8080
_type,
8181
name,
8282
idx,
83-
'indicies' if idx > 1 else 'index',
83+
'indices' if idx > 1 else 'index',
8484
) % total_time
8585
except TypeError:
8686
return "ConstructionTimer object for %s %s; %s elapsed seconds" % (

pyomo/contrib/gdpbb/GDPbb.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
import logging
1111
import traceback
1212

13-
from pyutilib.misc import Container
14-
1513
from pyomo.common import deprecated
16-
from pyomo.common.collections import ComponentSet
14+
from pyomo.common.collections import ComponentSet, Container
1715
from pyomo.common.config import (ConfigBlock, ConfigValue, PositiveInt)
1816
from pyomo.contrib.gdpopt.util import create_utility_block, time_code, a_logger, restore_logger_level, \
1917
setup_results_object, get_main_elapsed_time, process_objective

pyomo/contrib/gdpopt/tests/test_gdpopt.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717

1818
import pyutilib.th as unittest
1919
from pyomo.common.log import LoggingIntercept
20+
from pyomo.common.collections import Container
2021
from pyomo.contrib.gdpopt.GDPopt import GDPoptSolver
2122
from pyomo.contrib.gdpopt.data_class import GDPoptSolveData
2223
from pyomo.contrib.gdpopt.mip_solve import solve_linear_GDP
2324
from pyomo.contrib.gdpopt.util import is_feasible, time_code
2425
from pyomo.environ import ConcreteModel, Objective, SolverFactory, Var, value, Integers, Block, Constraint, maximize
2526
from pyomo.gdp import Disjunct, Disjunction
26-
from pyutilib.misc import import_file, Container
27+
from pyutilib.misc import import_file
2728
from pyomo.contrib.mcpp.pyomo_mcpp import mcpp_available
2829
from pyomo.opt import TerminationCondition
2930

pyomo/contrib/gdpopt/util.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
from math import fabs
88

99
import six
10-
from pyutilib.misc import Container
1110

1211
from pyomo.common import deprecated
13-
from pyomo.common.collections import ComponentSet
12+
from pyomo.common.collections import ComponentSet, Container
1413
from pyomo.contrib.fbbt.fbbt import compute_bounds_on_expr
1514
from pyomo.contrib.gdpopt.data_class import GDPoptSolveData
1615
from pyomo.contrib.mcpp.pyomo_mcpp import mcpp_available, McCormick

pyomo/contrib/mindtpy/MindtPy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
Block, ConstraintList, NonNegativeReals, Set, Suffix, Var,
4848
VarList, TransformationFactory, Objective)
4949
from pyomo.opt import SolverFactory, SolverResults
50-
from pyutilib.misc import Container
50+
from pyomo.common.collections import Container
5151
from pyomo.contrib.fbbt.fbbt import fbbt
5252
from pyomo.contrib.mindtpy.config_options import _get_GDPopt_config
5353

pyomo/contrib/preprocessing/tests/test_induced_linearity.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1+
# ___________________________________________________________________________
2+
#
3+
# Pyomo: Python Optimization Modeling Objects
4+
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
5+
# Under the terms of Contract DE-NA0003525 with National Technology and
6+
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
7+
# rights in this software.
8+
# This software is distributed under the 3-clause BSD License.
9+
# ___________________________________________________________________________
10+
111
"""Tests the induced linearity module."""
212
import pyutilib.th as unittest
313
from pyomo.contrib.preprocessing.plugins.induced_linearity import (
414
_bilinear_expressions,
515
detect_effectively_discrete_vars,
616
determine_valid_values)
7-
from pyomo.common.collections import ComponentSet
17+
from pyomo.common.collections import ComponentSet, Bunch
818
from pyomo.environ import (Binary, ConcreteModel, Constraint, ConstraintList,
919
Integers, RangeSet, SolverFactory,
1020
TransformationFactory, Var, exp)
1121
from pyomo.gdp import Disjunct, Disjunction
1222
from pyomo.repn import generate_standard_repn
13-
from pyutilib.misc import Bunch
1423

1524
glpk_available = SolverFactory('glpk').available()
1625

pyomo/core/base/PyomoModel.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
except ImportError: #pragma:nocover
2323
from ordereddict import OrderedDict
2424

25-
from pyutilib.misc import Container, PauseGC
25+
from pyutilib.misc import PauseGC
2626

2727
from pyomo.common import timing, PyomoAPIFactory
28+
from pyomo.common.collections import Container
2829
from pyomo.common.dependencies import pympler, pympler_available
2930
from pyomo.common.deprecation import deprecation_warning
3031
from pyomo.common.plugin import ExtensionPoint
@@ -832,7 +833,7 @@ def _load_model_data(self, modeldata, namespaces, **kwds):
832833
else:
833834
assert isinstance(component, Component)
834835
clen = 1
835-
print(" %%6.%df seconds required to construct component=%s; %d indicies total" \
836+
print(" %%6.%df seconds required to construct component=%s; %d indices total" \
836837
% (total_time>=0.005 and 2 or 0, component_name, clen) \
837838
% total_time)
838839
tmp_clone_counter = expr_common.clone_counter

pyomo/dataportal/TableData.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from six.moves import xrange
1414

15-
from pyutilib.misc import Options
15+
from pyomo.common.collections import Options
1616
from pyomo.dataportal.process_data import _process_data
1717

1818

pyomo/dataportal/plugins/datacommands.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
import os.path
1212

13-
from pyutilib.misc import Options
14-
13+
from pyomo.common.collections import Options
1514
from pyomo.dataportal.factory import DataManagerFactory
1615
from pyomo.dataportal.process_data import _process_include
1716

0 commit comments

Comments
 (0)