# _________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2014 Sandia Corporation. # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, # the U.S. Government retains certain rights in this software. # This software is distributed under the BSD License. # _________________________________________________________________________ # Package files from pyomo.util.plugin import PluginGlobals PluginGlobals.add_env("pyomo") from pyomo.bilevel.components import * PluginGlobals.pop_env()
# ___________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright 2017 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. # ___________________________________________________________________________ from pyomo.util.plugin import PluginGlobals PluginGlobals.add_env("pyomo") import pyomo.pysp.annotations import pyomo.pysp.solutionioextensions import pyomo.pysp.util #import pyomo.pysp.ef_vss import pyomo.pysp.phsolverserverutils import pyomo.pysp.solutionwriter import pyomo.pysp.phextension import pyomo.pysp.phutils import pyomo.pysp.dualphmodel import pyomo.pysp.generators import pyomo.pysp.convergence import pyomo.pysp.scenariotree import pyomo.pysp.phobjective import pyomo.pysp.embeddedsp import pyomo.pysp.ef import pyomo.pysp.ph
exctype = err = tb = None # TODO: Should this just log an error and re-raise the # original exception? raise ImportError(msg) pkg = _sys.modules[pname] pkg.load() # # Import optional packages # for name in _optional_packages: pname = name + '.plugins' try: _do_import(pname) except ImportError: continue pkg = _sys.modules[pname] pkg.load() from pyomo.util.plugin import PluginGlobals as _PG _PG.add_env("pyomo") _import_packages() _PG.pop_env() # # Expose the symbols from pyomo.core # from pyomo.core import * from pyomo.opt import SolverFactory, SolverManagerFactory, UnknownSolver
for name in _packages: pname = name+'.plugins' try: _do_import(pname) except ImportError: if name in _optional_packages: # Note: Continue to avoid the package load(). # # TODO: Should this generate a warning if the package exists # on the file system? continue else: exctype, err, tb = _sys.exc_info() # BUG? import traceback msg = "pyomo.environ failed to import %s:\nOriginal %s: %s\n"\ "Traceback:\n%s" \ % (pname, exctype.__name__, err, ''.join(traceback.format_tb(tb)),) # clear local variables to remove circular references exctype = err = tb = None # TODO: Should this just log an error and re-raise the # original exception? raise ImportError(msg) pkg = _sys.modules[pname] pkg.load() _PG.add_env("pyomo") _import_packages() _PG.pop_env()