Skip to content

Commit

Permalink
Merge branch 'main' into incidence-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt authored Feb 10, 2023
2 parents b067ffa + 8fe21bb commit 6f1995f
Show file tree
Hide file tree
Showing 56 changed files with 2,766 additions and 1,437 deletions.
6 changes: 4 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import pytest


def pytest_runtest_setup(item):
"""
This method overrides pytest's default behavior for marked tests.
Expand Down Expand Up @@ -45,8 +46,9 @@ def pytest_runtest_setup(item):
elif markeroption:
return
elif item_markers:
if (not set(implicit_markers).issubset(item_markers)
and not item_markers.issubset(set(extended_implicit_markers))):
if not set(implicit_markers).issubset(
item_markers
) and not item_markers.issubset(set(extended_implicit_markers)):
pytest.skip('SKIPPED: Only running default, solver, and unmarked tests.')


Expand Down
110 changes: 60 additions & 50 deletions doc/OnlineDocs/contributed_packages/doe/doe.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/pyomo/p-median/solver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Imports from Pyomo
from pyomo.core import *
from pyomo.common.plugin import *
from pyomo.common.plugin_base import *
from pyomo.opt import *


Expand Down
2 changes: 1 addition & 1 deletion examples/pyomo/p-median/solver2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Imports from Pyomo
from pyomo.core import *
from pyomo.common.plugin import *
from pyomo.common.plugin_base import *
from pyomo.opt import *
import random
import copy
Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

from pyomo.common.plugin import Interface
from pyomo.common.plugin_base import Interface


class IModelChecker(Interface):
Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

__all__ = ['IPreCheckHook', 'IPostCheckHook']

from pyomo.common.plugin import Interface
from pyomo.common.plugin_base import Interface

class IPreCheckHook(Interface):

Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/plugins/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re
import textwrap

from pyomo.common.plugin import SingletonPlugin, implements, ExtensionPoint
from pyomo.common.plugin_base import SingletonPlugin, implements, ExtensionPoint
from pyomo.checker import IModelChecker, IPreCheckHook, IPostCheckHook


Expand Down
4 changes: 2 additions & 2 deletions pyomo/checker/plugins/checkers/model/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# ___________________________________________________________________________

import ast
import pyomo.common.plugin
import pyomo.common.plugin_base

from pyomo.checker.plugins.checker import IterativeTreeChecker
from pyomo.checker.plugins.model import ModelTrackerHook


class ArrayValue(IterativeTreeChecker, ModelTrackerHook):

pyomo.common.plugin.alias('model.array_value', 'Check if assigning a value to an array of variables')
pyomo.common.plugin_base.alias('model.array_value', 'Check if assigning a value to an array of variables')

varArrays = {}

Expand Down
4 changes: 2 additions & 2 deletions pyomo/checker/plugins/checkers/model/conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
# ___________________________________________________________________________

import ast
import pyomo.common.plugin
import pyomo.common.plugin_base

from pyomo.checker.plugins.model import ModelTrackerHook
from pyomo.checker.plugins.checkers.model._rulebase import _ModelRuleChecker


class ModelValue(_ModelRuleChecker, ModelTrackerHook):

pyomo.common.plugin.alias('model.value', 'Check if comparisons are done using the "value()" function.')
pyomo.common.plugin_base.alias('model.value', 'Check if comparisons are done using the "value()" function.')

def checkerDoc(self):
return """\
Expand Down
4 changes: 2 additions & 2 deletions pyomo/checker/plugins/checkers/model/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ___________________________________________________________________________

import ast
import pyomo.common.plugin
import pyomo.common.plugin_base

from pyomo.checker.plugins.checker import IterativeTreeChecker

Expand All @@ -21,7 +21,7 @@ class Imports(IterativeTreeChecker):
exists somewhere within the initial imports block
"""

pyomo.common.plugin.alias('model.imports', 'Check if pyomo.core or pyomo.environ has been imported.')
pyomo.common.plugin_base.alias('model.imports', 'Check if pyomo.core or pyomo.environ has been imported.')

def beginChecking(self, runner, script):
self.pyomoImported = False
Expand Down
8 changes: 4 additions & 4 deletions pyomo/checker/plugins/checkers/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# ___________________________________________________________________________

import ast
import pyomo.common.plugin
import pyomo.common.plugin_base

from pyomo.checker.plugins.checker import IterativeTreeChecker


class ModelName(IterativeTreeChecker):

pyomo.common.plugin.alias('model.model_name', 'Check that the "model" variable is assigned with a Pyomo model.')
pyomo.common.plugin_base.alias('model.model_name', 'Check that the "model" variable is assigned with a Pyomo model.')

def beginChecking(self, runner, script):
self.modelAssigned = False
Expand Down Expand Up @@ -50,7 +50,7 @@ def check(self, runner, script, info):

class ModelCreate(IterativeTreeChecker):

pyomo.common.plugin.alias('model.create', 'Check if a Pyomo model class is being assigned to a variable.')
pyomo.common.plugin_base.alias('model.create', 'Check if a Pyomo model class is being assigned to a variable.')

def getTargetStrings(self, assign):
ls = []
Expand Down Expand Up @@ -79,7 +79,7 @@ def check(self, runner, script, info):

class DeprecatedModel(IterativeTreeChecker):

pyomo.common.plugin.alias('model.Model_class', 'Check if the deprecated Model class is being used.')
pyomo.common.plugin_base.alias('model.Model_class', 'Check if the deprecated Model class is being used.')

def checkerDoc(self):
return """\
Expand Down
10 changes: 5 additions & 5 deletions pyomo/checker/plugins/checkers/model/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import sys
import ast
import pyomo.common.plugin
import pyomo.common.plugin_base

from pyomo.checker.plugins.model import ModelTrackerHook
from pyomo.checker.plugins.checker import IterativeTreeChecker
Expand All @@ -31,7 +31,7 @@ def arg_name(arg):

class ModelShadowing(IterativeTreeChecker, ModelTrackerHook):

pyomo.common.plugin.alias('model.rule.shadowing', 'Ignoring for now')
pyomo.common.plugin_base.alias('model.rule.shadowing', 'Ignoring for now')

def checkerDoc(self):
return """\
Expand All @@ -50,7 +50,7 @@ def check(self, runner, script, info):

class ModelAccess(IterativeTreeChecker, ModelTrackerHook):

pyomo.common.plugin.alias('model.rule.model_access', 'Check that a rule does not reference a global model instance.')
pyomo.common.plugin_base.alias('model.rule.model_access', 'Check that a rule does not reference a global model instance.')

def checkerDoc(self):
return """\
Expand All @@ -74,7 +74,7 @@ def check(self, runner, script, info):

class ModelArgument(_ModelRuleChecker):

pyomo.common.plugin.alias('model.rule.model_argument', 'Check that the model instance is the first argument for a rule.')
pyomo.common.plugin_base.alias('model.rule.model_argument', 'Check that the model instance is the first argument for a rule.')

def checkerDoc(self):
return """\
Expand All @@ -96,7 +96,7 @@ def checkBody(self, funcdef):

class NoneReturn(_ModelRuleChecker):

pyomo.common.plugin.alias('model.rule.none_return', 'Check that a rule does not return the value None.')
pyomo.common.plugin_base.alias('model.rule.none_return', 'Check that a rule does not return the value None.')

def checkerDoc(self):
return """\
Expand Down
4 changes: 2 additions & 2 deletions pyomo/checker/plugins/checkers/py3k/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# ___________________________________________________________________________

import re
import pyomo.common.plugin
import pyomo.common.plugin_base
from pyomo.checker.plugins.checker import IterativeDataChecker


class PrintParens(IterativeDataChecker):

pyomo.common.plugin.alias('py3k.print_parens', 'Check if print statements have parentheses.')
pyomo.common.plugin_base.alias('py3k.print_parens', 'Check if print statements have parentheses.')

def __init__(self):
self.current_lineno = 0
Expand Down
4 changes: 2 additions & 2 deletions pyomo/checker/plugins/checkers/py3k/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# ___________________________________________________________________________

import ast
import pyomo.common.plugin
import pyomo.common.plugin_base
from pyomo.checker.plugins.checker import IterativeTreeChecker


class XRange(IterativeTreeChecker):

pyomo.common.plugin.alias('py3k.xrange', 'Check if the xrange() function is used.')
pyomo.common.plugin_base.alias('py3k.xrange', 'Check if the xrange() function is used.')

def check(self, runner, script, info):
if isinstance(info, ast.Name):
Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/plugins/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import ast

from pyomo.common.plugin import SingletonPlugin, implements
from pyomo.common.plugin_base import SingletonPlugin, implements
from pyomo.checker.hooks import IPreCheckHook, IPostCheckHook


Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/plugins/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import ast

from pyomo.common.plugin import SingletonPlugin, implements
from pyomo.common.plugin_base import SingletonPlugin, implements
from pyomo.checker.hooks import IPreCheckHook


Expand Down
2 changes: 1 addition & 1 deletion pyomo/checker/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import ast

from pyomo.common.plugin import ExtensionPoint
from pyomo.common.plugin_base import ExtensionPoint
from pyomo.checker.checker import IModelChecker
from pyomo.checker.script import ModelScript

Expand Down
51 changes: 2 additions & 49 deletions pyomo/common/getGSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,6 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

import logging
import os
import platform
import sys
from pyomo.common import Library
from pyomo.common.download import FileDownloader
from pyomo.common.deprecation import (relocated_module)

logger = logging.getLogger('pyomo.common')

# These URLs were retrieved from
# https://ampl.com/resources/extended-function-library/
urlmap = {
'linux': 'https://ampl.com/dl/open/amplgsl/amplgsl-linux%s.zip',
'windows': 'https://ampl.com/dl/open/amplgsl/amplgsl-win%s.zip',
'cygwin': 'https://ampl.com/dl/open/amplgsl/amplgsl-win%s.zip',
'darwin': 'https://ampl.com/dl/open/amplgsl/amplgsl-osx.zip'
}

def find_GSL():
# FIXME: the GSL interface is currently broken in PyPy:
if platform.python_implementation().lower().startswith('pypy'):
return None
return Library('amplgsl.dll').path()

def get_gsl(downloader):
system, bits = downloader.get_sysinfo()
url = downloader.get_platform_url(urlmap)
if '%s' in url:
url = url % (bits,)

downloader.set_destination_filename(os.path.join('lib', 'amplgsl.dll'))

logger.info("Fetching GSL from %s and installing it to %s"
% (url, downloader.destination()))

downloader.get_binary_file_from_zip_archive(url, 'amplgsl.dll')

def main(argv):
downloader = FileDownloader()
downloader.parse_args(argv)
get_gsl(downloader)

if __name__ == '__main__':
logger.setLevel(logging.INFO)
try:
main(sys.argv[1:])
except Exception as e:
print(e.message or str(e))
print("Usage: %s [--insecure] [target]" % os.path.basename(sys.argv[0]))
sys.exit(1)
relocated_module('pyomo.common.gsl', version='TBD')
32 changes: 32 additions & 0 deletions pyomo/common/gsl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2022
# National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

import logging
import platform
from pyomo.common import Library
from pyomo.common.deprecation import deprecated

logger = logging.getLogger('pyomo.common')

@deprecated(
"Use of get_gsl is deprecated and NO LONGER FUNCTIONS as of February 9, "
"2023. ",
version='TBD')
def get_gsl(downloader):
logger.info("As of February 9, 2023, AMPL GSL can no longer be downloaded\
through download-extensions. Visit https://portal.ampl.com/\
to download the AMPL GSL binaries.")

def find_GSL():
# FIXME: the GSL interface is currently broken in PyPy:
if platform.python_implementation().lower().startswith('pypy'):
return None
return Library('amplgsl.dll').path()
Loading

0 comments on commit 6f1995f

Please sign in to comment.