本文整理汇总了Python中pyOpt.Optimizer类的典型用法代码示例。如果您正苦于以下问题:Python Optimizer类的具体用法?Python Optimizer怎么用?Python Optimizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Optimizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, pll_type=None, *args, **kwargs):
"""
ALHSO Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
"""
#
if pll_type == None:
self.poa = False
elif pll_type.upper() == "POA":
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
# end
#
name = "ALHSO"
category = "Global Optimizer"
def_opts = {
"hms": [int, 5], # Memory Size [1,50]
"hmcr": [float, 0.95], # Probability rate of choosing from memory [0.7,0.99]
"par": [float, 0.65], # Pitch adjustment rate [0.1,0.99]
"dbw": [int, 2000], # Variable Bandwidth Quantization
"maxoutiter": [int, 2e3], # Maximum Number of Outer Loop Iterations (Major Iterations)
"maxinniter": [int, 2e2], # Maximum Number of Inner Loop Iterations (Minor Iterations)
"stopcriteria": [int, 1], # Stopping Criteria Flag
"stopiters": [
int,
10,
], # Consecutively Number of Outer Iterations for which the Stopping Criteria must be Satisfied
"etol": [float, 1e-6], # Absolute Tolerance for Equality constraints
"itol": [float, 1e-6], # Absolute Tolerance for Inequality constraints
"atol": [float, 1e-6], # Absolute Tolerance for Objective Function
"rtol": [float, 1e-6], # Relative Tolerance for Objective Function
"prtoutiter": [int, 0], # Number of Iterations Before Print Outer Loop Information
"prtinniter": [int, 0], # Number of Iterations Before Print Inner Loop Information
"xinit": [int, 0], # Initial Position Flag (0 - no position, 1 - position given)
"rinit": [float, 1.0], # Initial Penalty Factor
"fileout": [int, 1], # Flag to Turn On Output to filename
"filename": [
str,
"ALHSO.out",
], # We could probably remove fileout flag if filename or fileinstance is given
"seed": [float, 0], # Random Number Seed (0 - Auto-Seed based on time clock)
"scaling": [int, 1], # Design Variables Scaling Flag (0 - no scaling, 1 - scaling between [-1,1])
}
informs = {}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例2: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
FILTERSD Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'FILTERSD'
category = 'Local Optimizer'
def_opts = {
'rho':[float,100.0], # initial trust region radius
'htol':[float,1e-6], # tolerance allowed in sum h of constraint feasibilities
'rgtol':[float,1e-5], # tolerance allowed in reduced gradient l2 norm
'maxit':[int,1000], # maximum number of major iterations allowed
'maxgr':[int,1e5], # upper limit on the number of gradient calls
'ubd':[float,1e5], # upper bound on the allowed constraint violation
'dchk':[int,0], # derivative check flag (0 - no check, 1 - check)
'dtol':[float,1e-8], # derivative check tolerance
'iprint':[int,1], # verbosity of printing (0 - none, 1 - Iter, 2 - Debug)
'iout':[int,6], # Output Unit Number
'ifile':[str,'FILTERSD.out'], # Output File Name
}
informs = {
-1 : 'ws not large enough',
-2 : 'lws not large enough',
-3 : 'inconsistency during derivative check',
0 : 'successful run',
1 : 'unbounded NLP (f <= fmin at an htol-feasible point)',
2 : 'bounds on x are inconsistent',
3 : 'local minimum of feasibility problem and h > htol, (nonlinear constraints are locally inconsistent)',
4 : 'initial point x has h > ubd (reset ubd or x and re-enter)',
5 : 'maxit major iterations have been carried out',
6 : 'termination with rho <= htol',
7 : 'not enough workspace in ws or lws (see message)',
8 : 'insufficient space for filter (increase mxf and re-enter)',
9 : 'unexpected fail in LCP solver',
10 : 'unexpected fail in LCP solver',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例3: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
PSQP Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'PSQP'
category = 'Local Optimizer'
def_opts = {
'XMAX':[float,1e16], # Maximum Stepsize
'TOLX':[float,1e-16], # Variable Change Tolerance
'TOLC':[float,1e-6], # Constraint Violation Tolerance
'TOLG':[float,1e-6], # Lagrangian Gradient Tolerance
'RPF':[float,1e-4], # Penalty Coefficient
'MIT':[int,1000], # Maximum Number of Iterations
'MFV':[int,2000], # Maximum Number of Function Evaluations
'MET':[int,2], # Variable Metric Update (1 - BFGS, 2 - Hoshino)
'MEC':[int,2], # Negative Curvature Correction (1 - None, 2 - Powell's Correction)
'IPRINT':[int,2], # Output Level (0 - None, 1 - Final, 2 - Iter)
'IOUT':[int,6], # Output Unit Number
'IFILE':[str,'PSQP.out'], # Output File Name
}
informs = {
1 : 'Change in design variable was less than or equal to tolerance',
2 : 'Change in objective function was less than or equal to tolerance',
3 : 'Objective function less than or equal to tolerance',
4 : 'Maximum constraint value is less than or equal to tolerance',
11 : 'Maximum number of iterations exceeded',
12 : 'Maximum number of function evaluations exceeded',
13 : 'Maximum number of gradient evaluations exceeded',
-6 : 'Termination criterion not satisfied, but obtained point is acceptable',
#<0 : 'Method failed',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例4: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
SOLVOPT Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'SOLVOPT'
category = 'Local Optimizer'
def_opts = {
'xtol':[float,1e-4], # Variables Tolerance
'ftol':[float,1e-6], # Objective Tolerance
'maxit':[int,15000], # Maximum Number of Iterations
'iprint':[int,1], # Output Level (-1 -> None, 0 -> Final, N - each Nth iter)
'gtol':[float,1e-8], # Constraints Tolerance
'spcdil':[float,2.5], # Space Dilation
'iout':[int,6], # Output Unit Number
'ifile':[str,'SOLVOPT.out'], # Output File Name
}
informs = {
1 : 'Normal termination.',
-2 : 'Improper space dimension.',
-3 : 'Objective equals infinity.',
-4 : 'Gradient equals zero or infinity.',
-5 : 'Objective equals infinity.',
-6 : 'Gradient equals zero or infinity.',
-7 : 'Objective function is unbounded.',
-8 : 'Gradient zero at the point, but stopping criteria are not fulfilled.',
-9 : 'Iterations limit exceeded.',
-11 : 'Premature stop is possible. Try to re-run the routine from the obtained point.',
-12 : 'Result may not provide the optimum. The function apparently has many extremum points.',
-13 : 'Result may be inaccurate in the coordinates. The function is flat at the optimum.',
-14 : 'Result may be inaccurate in a function value. The function is extremely steep at the optimum.',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例5: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
FSQP Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'FSQP'
category = 'Local Optimizer'
def_opts = {
'mode':[int,100], # FSQP Mode (See Manual)
'iprint':[int,2], # Output Level (0 - None, 1 - Final, 2 - Major, 3 - Major Details)
'miter':[int,500], # Maximum Number of Iterations
'bigbnd':[float,1e10], # Plus Infinity Value
'epstol':[float,1e-8], # Convergence Tolerance
'epseqn':[float,0], # Equality Constraints Tolerance
'iout':[int,6], # Output Unit Number
'ifile':[str,'FSQP.out'], # Output File Name
}
informs = {
0 : 'Normal termination of execution',
1 : 'User-provided initial guess is infeasible for linear constraints, unable to generate a point satisfying all these constraints',
2 : 'User-provided initial guess is infeasible for nonlinear inequality constraints and linear constraints, unable to generate a point satisfying all these constraints',
3 : 'The maximum number of iterations has been reached before a solution is obtained',
4 : 'The line search fails to find a new iterate',
5 : 'Failure of the QP solver in attempting to construct d0, a more robust QP solver may succeed',
6 : 'Failure of the QP solver in attempting to construct d1, a more robust QP solver may succeed',
7 : 'Input data are not consistent, check print out error messages',
8 : 'Two consecutive iterates are numerically equivalent before a stopping criterion is satisfied',
9 : 'One of the penalty parameters exceeded bigbnd, the algorithm is having trouble satisfying a nonlinear equality constraint',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例6: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
SLSQP Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'SLSQP'
category = 'Local Optimizer'
def_opts = {
# SLSQP Options
'ACC':[float,1e-6], # Convergence Accurancy
'MAXIT':[int,50], # Maximum Iterations
'IPRINT':[int,1], # Output Level (<0 - None, 0 - Screen, 1 - File)
'IOUT':[int,6], # Output Unit Number
'IFILE':[str,'SLSQP.out'], # Output File Name
}
informs = {
-1 : "Gradient evaluation required (g & a)",
0 : "Optimization terminated successfully.",
1 : "Function evaluation required (f & c)",
2 : "More equality constraints than independent variables",
3 : "More than 3*n iterations in LSQ subproblem",
4 : "Inequality constraints incompatible",
5 : "Singular matrix E in LSQ subproblem",
6 : "Singular matrix C in LSQ subproblem",
7 : "Rank-deficient equality constraint subproblem HFTI",
8 : "Positive directional derivative for linesearch",
9 : "Iteration limit exceeded",
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例7: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
ALGENCAN Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'ALGENCAN'
category = 'Local Optimizer'
def_opts = {
# ALGENCAN Options
'epsfeas':[float,1.0e-8], # Feasibility Convergence Accurancy
'epsopt':[float,1.0e-8], # Optimality Convergence Accurancy
'efacc':[float,1.0e-4], # Feasibility Level for Newton-KKT Acceleration
'eoacc':[float,1.0e-4], # Optimality Level for Newton-KKT Acceleration
'checkder':[bool,False], # Check Derivatives Flag
'iprint':[int,10], # Print Flag (0 - None, )
'ifile':[str,'ALGENCAN.out'], # Output File Name
'ncomp':[int,6], # Print Precision
}
informs = {
0 : "Solution was found.",
1 : "Stationary or infeasible point was found.",
2 : "penalty parameter is too large infeasibile or badly scaled problem",
3 : "Maximum of iterations reached.",
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例8: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
MMFD Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'MMFD'
category = 'Local Optimizer'
def_opts = {
'IOPT':[int,0], # Feasible Directions Approach (0 - MMFD, 1 - MFD)
'IONED':[int,0], # One-Dimensional Search Method (0,1,2,3)
'CT':[float,-3e-2], # Constraint Tolerance
'CTMIN':[float,4e-3], # Active Constraint Tolerance
'DABOBJ':[float,1e-3], # Objective Absolute Tolerance (DABOBJ*abs(f(x)))
'DELOBJ':[float,1e-3], # Objective Relative Tolerance
'THETAZ':[float,1e-1], # Push-Off Factor
'PMLT':[float,1e1], # Penalty multiplier for equality constraints
'ITMAX':[int,4e2], # Maximum Number of Iterations
'ITRMOP':[int,3], # consecutive Iterations Iterations for Convergence
'IPRINT':[int,2], # Print Control (0 - None, 1 - Final, 2 - Iters)
'IFILE':[str,'MMFD.out'], # Output File Name
}
informs = {
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例9: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
MMA Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'MMA'
category = 'Local Optimizer'
def_opts = {
# MMA Options
'MAXIT':[int,1000], # Maximum Iterations
'GEPS':[float,1e-6], # Dual Objective Gradient Tolerance
'DABOBJ':[float,1e-6], #
'DELOBJ':[float,1e-6], #
'ITRM':[int,2], #
'IPRINT':[int,1], # Output Level (<0 - None, 0 - Screen, 1 - File)
'IOUT':[int,6], # Output Unit Number
'IFILE':[str,'MMA.out'], # Output File Name
}
informs = {
0 : 'The optimality conditions are satisfied.',
1 : 'The algorithm has been stopped after MAXIT iterations.',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例10: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
NSGA2 Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'NSGA-II'
category = 'Global Optimizer'
def_opts = {
'PopSize':[int,100], #
'maxGen':[int,150], #
'pCross_real':[float,0.6], #
'pMut_real':[float,0.2], #
'eta_c':[float,10], #
'eta_m':[float,20], #
'pCross_bin':[float,0], #
'pMut_bin':[float,0], #
'PrintOut':[int,1], # Flag to Turn On Output to filename (0 - , 1 - , 2 - )
'seed':[float,0], # Random Number Seed (0 - Auto-Seed based on time clock)
'xinit':[int,0], # Use Initial Solution Flag (0 - random population, 1 - use given solution)
}
informs = {}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例11: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
COBYLA Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'COBYLA'
category = 'Local Optimizer'
def_opts = {
'RHOBEG':[float,0.5], # Initial Variables Change
'RHOEND':[float,1.0e-6], # Convergence Accurancy
'IPRINT':[int,2], # Print Flag (0 - None, 1 - Final, 2,3 - Iteration)
'MAXFUN':[int,3500], # Maximum Iterations
'IOUT':[int,6], # Output Unit Number
'IFILE':[str,'COBYLA.out'], # Output File Name
}
informs = {
0: 'Normal return',
1: 'Max. number of function evaluations reach',
2: 'Rounding errors are becoming damaging',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例12: __init__
def __init__(self, *args, **kwargs):
'''
HSO Optimizer Class Initialization
Documentation last updated: October. 22, 2008 - Ruben E. Perez
'''
#
name = 'HSO'
category = 'Global Optimizer'
def_opts = {
'hms':[int,10], # Memory Size [4,10]
'dbw':[float,0.01], #
'hmcr':[float,0.96], #
'par':[float,0.6], #
'maxiter':[int,1e4], # Maximum Number Iterations
'printout':[int,0], # Flag to Turn On Information Output
'xinit':[int,0], # Initial Position Flag (0 - no position, 1 - position given)
'seed':[float,0], # Random Number Seed (0 - Auto-Seed based on time clock)
}
informs = {}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例13: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
CONMIN Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'CONMIN'
category = 'Local Optimizer'
def_opts = {
'ITMAX':[int,1e4], # Maximum Number of Iterations
'DELFUN':[float,1e-6], # Objective Relative Tolerance
'DABFUN':[float,1e-6], # Objective Absolute Tolerance
'ITRM':[int,2], #
'NFEASCT':[int,20], #
'IPRINT':[int,2], # Print Control (0 - None, 1 - Final, 2,3,4,5 - Debug)
'IOUT':[int,6], # Output Unit Number
'IFILE':[str,'CONMIN.out'], # Output File Name
}
informs = {
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例14: __init__
def __init__(self, pll_type=None, *args, **kwargs):
'''
SDPEN Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: August. 09, 2012 - Ruben E. Perez
'''
#
if (pll_type == None):
self.poa = False
elif (pll_type.upper() == 'POA'):
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
#end
#
name = 'SDPEN'
category = 'Local Optimizer'
def_opts = {
# SDPEN Options
'alfa_stop':[float,1e-6], # Convergence Tolerance
'nf_max':[int,5000], # Maximum Number of Function Evaluations
'iprint':[int,0], # Output Level (<0 - None, 0 - Final, 1 - Iters, 2 - Full)
'iout':[int,6], # Output Unit Number
'ifile':[str,'SDPEN.out'], # Output File Name
}
informs = {
1 : 'finished successfully',
2 : 'maximum number of evaluations reached',
}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)
示例15: __init__
def __init__(self, pll_type=None, *args, **kwargs):
"""
CONMIN Optimizer Class Initialization
**Keyword arguments:**
- pll_type -> STR: Parallel Implementation (None, 'POA'-Parallel Objective Analysis), *Default* = None
Documentation last updated: Feb. 16, 2010 - Peter W. Jansen
"""
#
if pll_type == None:
self.poa = False
elif pll_type.upper() == "POA":
self.poa = True
else:
raise ValueError("pll_type must be either None or 'POA'")
# end
#
name = "CONMIN"
category = "Local Optimizer"
def_opts = {
"ITMAX": [int, 1e4], # Maximum Number of Iterations
"DELFUN": [float, 1e-6], # Objective Relative Tolerance
"DABFUN": [float, 1e-6], # Objective Absolute Tolerance
"ITRM": [int, 2], #
"NFEASCT": [int, 20], #
"IPRINT": [int, 2], # Print Control (0 - None, 1 - Final, 2,3,4,5 - Debug)
"IOUT": [int, 6], # Output Unit Number
"IFILE": [str, "CONMIN.out"], # Output File Name
}
informs = {}
Optimizer.__init__(self, name, category, def_opts, informs, *args, **kwargs)