Beispiel #1
0
 def call(self, args, unparsed):
     logger = logging.getLogger('pyomo.common')
     logger.setLevel(logging.INFO)
     results = []
     result_fmt = "[%s]  %s"
     returncode = 0
     self.downloader.cacert = args.cacert
     self.downloader.insecure = args.insecure
     for target in DownloadFactory:
         try:
             DownloadFactory(target, downloader=self.downloader)
             result = ' OK '
         except SystemExit:
             result = 'FAIL'
             returncode = 1
             if args.verbose:
                 traceback.print_exc()
         except:
             result = 'FAIL'
             returncode = 1
             if args.verbose:
                 traceback.print_exc()
         results.append(result_fmt % (result, target))
     logger.info("Finished downloading Pyomo extensions.")
     logger.info(
         "The following extensions were downloaded:\n    " +
         "\n    ".join(results))
     return returncode
Beispiel #2
0
 def call(self, args, unparsed):
     logger = logging.getLogger('pyomo.common')
     logger.setLevel(logging.INFO)
     results = []
     result_fmt = "[%s]  %s"
     returncode = 0
     self.downloader.cacert = args.cacert
     self.downloader.insecure = args.insecure
     for target in DownloadFactory:
         try:
             ext = DownloadFactory(target, downloader=self.downloader)
             if hasattr(ext, 'skip') and ext.skip():
                 result = 'SKIP'
             elif hasattr(ext, '__call__'):
                 ext()
                 result = ' OK '
             else:
                 # Extension was a simple function and already ran
                 result = ' OK '
         except SystemExit:
             _info = sys.exc_info()
             _cls = str(_info[0].__name__ if _info[0] is not None
                        else "NoneType") + ": "
             logger.error(_cls + str(_info[1]))
             result = 'FAIL'
             returncode |= 2
         except:
             _info = sys.exc_info()
             _cls = str(_info[0].__name__ if _info[0] is not None
                        else "NoneType") + ": "
             logger.error(_cls + str(_info[1]))
             result = 'FAIL'
             returncode |= 1
         results.append(result_fmt % (result, target))
     logger.info("Finished downloading Pyomo extensions.")
     logger.info(
         "The following extensions were downloaded:\n    " +
         "\n    ".join(results))
     return returncode
Beispiel #3
0
from pyomo.contrib.trustregion.TRF import TRF
from pyomo.contrib.trustregion.readgjh import readgjh
import pyomo.contrib.trustregion.getGJH

logger = logging.getLogger('pyomo.contrib.trustregion')
#fh = logging.FileHandler('debug_vars.log')
#logger.setLevel(logging.DEBUG)
#logger.addHandler(fh)


def load():
    pass


DownloadFactory.register('gjh')(pyomo.contrib.trustregion.getGJH.get_gjh)


@SolverFactory.register(
    'trustregion',
    doc='Trust region filter method for black box/glass box optimization')
class TrustRegionSolver(OptSolver):
    """
    A trust region filter method for black box / glass box optimizaiton
    Solves nonlinear optimization problems containing external function calls
    through automatic construction of reduced models (ROM), also known as
    surrogate models.
    Currently implements linear and quadratic reduced models.
    See Eason, Biegler (2016) AIChE Journal for more details

    Arguments:
Beispiel #4
0
def load():
    DownloadFactory.register('mcpp')(get_mcpp)
    ExtensionBuilderFactory.register('mcpp')(MCPPBuilder)
Beispiel #5
0
def load():
    DownloadFactory.register('gjh')(get_gjh)
    SolverFactory.register('contrib.gjh',
                           doc='Interface to the AMPL GJH "solver"')(GJHSolver)
Beispiel #6
0
    PositiveInt, PositiveFloat, NonNegativeFloat, In)
from pyomo.core import Var, value

from pyomo.contrib.trustregion.TRF import TRF
from pyomo.contrib.trustregion.readgjh import readgjh
import pyomo.contrib.trustregion.getGJH

logger = logging.getLogger('pyomo.contrib.trustregion')
#fh = logging.FileHandler('debug_vars.log')
#logger.setLevel(logging.DEBUG)
#logger.addHandler(fh)

def load():
    pass

DownloadFactory.register('gjh')(pyomo.contrib.trustregion.getGJH.get_gjh)

@SolverFactory.register(
        'trustregion',
        doc='Trust region filter method for black box/glass box optimization'
    )
class TrustRegionSolver(OptSolver):
    """
    A trust region filter method for black box / glass box optimizaiton
    Solves nonlinear optimization problems containing external function calls
    through automatic construction of reduced models (ROM), also known as
    surrogate models.
    Currently implements linear and quadratic reduced models.
    See Eason, Biegler (2016) AIChE Journal for more details

    Arguments:
Beispiel #7
0
def load():
    DownloadFactory.register('mcpp')(get_mcpp)
    ExtensionBuilderFactory.register('mcpp')(build_mcpp)
Beispiel #8
0
 def call(self, args, unparsed):
     logging.getLogger('pyomo.common').setLevel(logging.INFO)
     self.downloader.cacert = args.cacert
     self.downloader.insecure = args.insecure
     for target in DownloadFactory:
         DownloadFactory(target, downloader=self.downloader)