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

Silence deprecation warnings emitted by Pyomo tests #3076

Merged
merged 6 commits into from
Jan 8, 2024
Merged
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
3 changes: 3 additions & 0 deletions doc/OnlineDocs/contributed_packages/gdpopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ To use the GDPopt-LBB solver, define your Pyomo GDP model as usual:
>>> m.djn = Disjunction(expr=[m.y1, m.y2])

Invoke the GDPopt-LBB solver

>>> results = SolverFactory('gdpopt.lbb').solve(m)
WARNING: 09/06/22: The GDPopt LBB algorithm currently has known issues. Please
use the results with caution and report any bugs!

>>> print(results) # doctest: +SKIP
>>> print(results.solver.status)
Expand Down
14 changes: 0 additions & 14 deletions doc/OnlineDocs/developer_reference/expressions/managing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,6 @@ a consistent ordering of terms that should make it easier to interpret
expressions.


Cloning Expressions
-------------------

Expressions are automatically cloned only during certain expression
transformations. Since this can be an expensive operation, the
:data:`clone_counter <pyomo.core.expr.clone_counter>` context
manager object is provided to track the number of times the
:func:`clone_expression <pyomo.core.expr.clone_expression>`
function is executed.

For example:

.. literalinclude:: ../../tests/expr/managing_ex4.spy

Evaluating Expressions
----------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Context Managers
.. autoclass:: pyomo.core.expr.linear_expression
:members:

.. autoclass:: pyomo.core.expr.clone_counter
.. autoclass:: pyomo.core.expr.current.clone_counter
:members:

2 changes: 1 addition & 1 deletion pyomo/contrib/parmest/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _add_scipy_dist_CI(
data_slice.append(np.array([[theta_star[var]] * ncells] * ncells))
data_slice = np.dstack(tuple(data_slice))

elif isinstance(dist, stats.kde.gaussian_kde):
elif isinstance(dist, stats.gaussian_kde):
for var in theta_star.index:
if var == xvar:
data_slice.append(X.ravel())
Expand Down
6 changes: 3 additions & 3 deletions pyomo/core/tests/examples/test_kernel_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
def setUpModule():
global testing_solvers
import pyomo.environ
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

for _solver, _io in test_solver_cases():
if (_solver, _io) in testing_solvers and test_solver_cases(
for _solver, _io in _test_solver_cases():
if (_solver, _io) in testing_solvers and _test_solver_cases(
_solver, _io
).available:
testing_solvers[_solver, _io] = True
Expand Down
4 changes: 2 additions & 2 deletions pyomo/solvers/tests/checks/test_BARON.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from pyomo.opt import SolverFactory, TerminationCondition

# check if BARON is available
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

baron_available = test_solver_cases('baron', 'bar').available
baron_available = _test_solver_cases('baron', 'bar').available


@unittest.skipIf(not baron_available, "The 'BARON' solver is not available")
Expand Down
4 changes: 2 additions & 2 deletions pyomo/solvers/tests/mip/test_asl.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class mock_all(unittest.TestCase):
def setUpClass(cls):
global cplexamp_available
import pyomo.environ
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

cplexamp_available = test_solver_cases('cplex', 'nl').available
cplexamp_available = _test_solver_cases('cplex', 'nl').available

def setUp(self):
self.do_setup(False)
Expand Down
4 changes: 2 additions & 2 deletions pyomo/solvers/tests/mip/test_ipopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class Test(unittest.TestCase):
def setUpClass(cls):
global ipopt_available
import pyomo.environ
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

ipopt_available = test_solver_cases('ipopt', 'nl').available
ipopt_available = _test_solver_cases('ipopt', 'nl').available

def setUp(self):
if not ipopt_available:
Expand Down
4 changes: 2 additions & 2 deletions pyomo/solvers/tests/mip/test_scip.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Test(unittest.TestCase):
def setUpClass(cls):
global scip_available
import pyomo.environ
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

scip_available = test_solver_cases('scip', 'nl').available
scip_available = _test_solver_cases('scip', 'nl').available

def setUp(self):
if not scip_available:
Expand Down
6 changes: 3 additions & 3 deletions pyomo/solvers/tests/piecewise_linear/test_piecewise_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pyomo.core.base import Var
from pyomo.core.base.objective import minimize, maximize
from pyomo.core.base.piecewise import Bound, PWRepn
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

smoke_problems = ['convex_var', 'step_var', 'step_vararray']

Expand Down Expand Up @@ -50,8 +50,8 @@
# testing_solvers['ipopt','nl'] = False
# testing_solvers['cplex','python'] = False
# testing_solvers['_cplex_persistent','python'] = False
for _solver, _io in test_solver_cases():
if (_solver, _io) in testing_solvers and test_solver_cases(_solver, _io).available:
for _solver, _io in _test_solver_cases():
if (_solver, _io) in testing_solvers and _test_solver_cases(_solver, _io).available:
testing_solvers[_solver, _io] = True


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from pyomo.common.fileutils import import_file
from pyomo.kernel import SolverFactory, variable, maximize, minimize
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases

problems = ['convex_var', 'concave_var', 'piecewise_var', 'step_var']

Expand All @@ -30,8 +30,8 @@
# testing_solvers['ipopt','nl'] = False
# testing_solvers['cplex','python'] = False
# testing_solvers['_cplex_persistent','python'] = False
for _solver, _io in test_solver_cases():
if (_solver, _io) in testing_solvers and test_solver_cases(_solver, _io).available:
for _solver, _io in _test_solver_cases():
if (_solver, _io) in testing_solvers and _test_solver_cases(_solver, _io).available:
testing_solvers[_solver, _io] = True


Expand Down
6 changes: 3 additions & 3 deletions pyomo/solvers/tests/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pyomo.common.collections import Bunch
from pyomo.opt import TerminationCondition
from pyomo.solvers.tests.models.base import all_models
from pyomo.solvers.tests.solvers import test_solver_cases
from pyomo.solvers.tests.solvers import test_solver_cases as _test_solver_cases
from pyomo.core.kernel.block import IBlock

# For expected failures that appear in all known version
Expand Down Expand Up @@ -297,8 +297,8 @@ def generate_scenarios(arg=None):
_model = all_models(model)
if not arg is None and not arg(_model):
continue
for solver, io in sorted(test_solver_cases()):
_solver_case = test_solver_cases(solver, io)
for solver, io in sorted(_test_solver_cases()):
_solver_case = _test_solver_cases(solver, io)
_ver = _solver_case.version

# Skip this test case if the solver doesn't support the
Expand Down