def run(**kwargs): simulation = simCSTR() nlpsolver = pyIPOPT.daeIPOPT() return daeActivity.optimize(simulation, reportingInterval=600, timeHorizon=5 * 60 * 60, nlpsolver=nlpsolver, nlpsolver_setoptions_fn=setOptions, reportSensitivities=True, **kwargs)
def run(**kwargs): simulation = simTutorial() # Achtung! Achtung! NLP solver options can only be set after optimization.Initialize() # Otherwise seg. fault occurs for some reasons. nlpsolver = pyIPOPT.daeIPOPT() return daeActivity.optimize(simulation, reportingInterval=1, timeHorizon=1, nlpsolver=nlpsolver, nlpsolver_setoptions_fn=setOptions, reportSensitivities=True, **kwargs)
def run(**kwargs): simulation = simCatalystMixing(200, 1.0 / 200) nlpsolver = pyIPOPT.daeIPOPT() lasolver = pyTrilinos.daeCreateTrilinosSolver("Amesos_Klu", "") relativeTolerance = 1e-6 return daeActivity.optimize(simulation, reportingInterval=1, timeHorizon=1, lasolver=lasolver, nlpsolver=nlpsolver, nlpsolver_setoptions_fn=setOptions, relativeTolerance=relativeTolerance, **kwargs)
def createNLPSolver(minlpsolverIndex): nlpsolver = None if minlpsolverIndex == nlpIPOPT: from daetools.solvers.ipopt import pyIPOPT nlpsolver = pyIPOPT.daeIPOPT() elif minlpsolverIndex == nlpNLOPT: from daetools.solvers.nlopt import pyNLOPT # Default algorithm algorithm = 'NLOPT_LD_SLSQP' try: from PyQt5 import QtCore, QtGui algorithms = [ 'NLOPT_GN_DIRECT', 'NLOPT_GN_DIRECT_L', 'NLOPT_GN_DIRECT_L_RAND', 'NLOPT_GN_DIRECT_NOSCAL', 'NLOPT_GN_DIRECT_L_NOSCAL', 'NLOPT_GN_DIRECT_L_RAND_NOSCAL', 'NLOPT_GN_ORIG_DIRECT', 'NLOPT_GN_ORIG_DIRECT_L', 'NLOPT_GD_STOGO', 'NLOPT_GD_STOGO_RAND', 'NLOPT_LD_LBFGS_NOCEDAL', 'NLOPT_LD_LBFGS', 'NLOPT_LN_PRAXIS', 'NLOPT_LD_VAR1', 'NLOPT_LD_VAR2', 'NLOPT_LD_TNEWTON', 'NLOPT_LD_TNEWTON_RESTART', 'NLOPT_LD_TNEWTON_PRECOND', 'NLOPT_LD_TNEWTON_PRECOND_RESTART', 'NLOPT_GN_CRS2_LM', 'NLOPT_GN_MLSL', 'NLOPT_GD_MLSL', 'NLOPT_GN_MLSL_LDS', 'NLOPT_GD_MLSL_LDS', 'NLOPT_LD_MMA', 'NLOPT_LN_COBYLA', 'NLOPT_LN_NEWUOA', 'NLOPT_LN_NEWUOA_BOUND', 'NLOPT_LN_NELDERMEAD', 'NLOPT_LN_SBPLX', 'NLOPT_LN_AUGLAG', 'NLOPT_LD_AUGLAG', 'NLOPT_LN_AUGLAG_EQ', 'NLOPT_LD_AUGLAG_EQ', 'NLOPT_LN_BOBYQA', 'NLOPT_GN_ISRES', 'NLOPT_AUGLAG', 'NLOPT_AUGLAG_EQ', 'NLOPT_G_MLSL', 'NLOPT_G_MLSL_LDS', 'NLOPT_LD_SLSQP' ] # Show the input box to choose the algorithm (the default is len(algorithms)-1 that is: NLOPT_LD_SLSQP) algorithm, ok = QtGui.QInputDialog.getItem( None, "NLOPT Algorithm", "Choose the NLOPT algorithm:", algorithms, len(algorithms) - 1, False) except Exception as e: pass nlpsolver = pyNLOPT.daeNLOPT(str(algorithm)) elif minlpsolverIndex == nlpBONMIN: from daetools.solvers.bonmin import pyBONMIN nlpsolver = pyBONMIN.daeBONMIN() else: raise RuntimeError("Unsupported (MI)NLP Solver selected") return nlpsolver
def run(**kwargs): simulation = simOilCracking_opt() nlpsolver = pyIPOPT.daeIPOPT() lasolver = pyTrilinos.daeCreateTrilinosSolver("Amesos_Klu", "") relativeTolerance = 1e-6 reportingTimes = times.tolist() return daeActivity.optimize(simulation, reportingInterval=1, timeHorizon=1, reportingTimes=reportingTimes, lasolver=lasolver, nlpsolver=nlpsolver, nlpsolver_setoptions_fn=setOptions, relativeTolerance=relativeTolerance, **kwargs)
def run(**kwargs): simulation = simMarinePopulation_opt() #nlpsolver = pyNLOPT.daeNLOPT('NLOPT_LD_SLSQP') nlpsolver = pyIPOPT.daeIPOPT() lasolver = pyTrilinos.daeCreateTrilinosSolver("Amesos_Klu", "") relativeTolerance = 1e-6 reportingTimes = times.tolist() return daeActivity.optimize(simulation, reportingInterval=1, timeHorizon=1, reportingTimes=reportingTimes, lasolver=lasolver, nlpsolver=nlpsolver, nlpsolver_setoptions_fn=setOptions, relativeTolerance=relativeTolerance, reportSensitivities=True, **kwargs)