当前位置: 首页>>代码示例>>Python>>正文


Python NLP.name方法代码示例

本文整理汇总了Python中openopt.NLP.name方法的典型用法代码示例。如果您正苦于以下问题:Python NLP.name方法的具体用法?Python NLP.name怎么用?Python NLP.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openopt.NLP的用法示例。


在下文中一共展示了NLP.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: zeros

# 需要导入模块: from openopt import NLP [as 别名]
# 或者: from openopt.NLP import name [as 别名]
p.ub[3*N/4:] = inf

#p.ub[4] = 4
#p.lb[5], p.ub[5] = 8, 15

#A = zeros((K, N))
#b = zeros(K)
#for i in xrange(K):
#    A[i] = 1+cos(i+arange(N))
#    b[i] = sin(i)
#p.A = A
#p.b = b

#p.Aeq = zeros(p.n)
#p.Aeq[100:102] = 1
#p.beq = 11

p.contol = 1e-6
p.plot = 1
p.maxFunEvals = 1e7
p.name = 'nlp_4'
p.debug=1
solver = 'ralg'
solver = 'gsubg'
#solver = 'scipy_cobyla'
solver = 'algencan'
#solver = 'ipopt'

r = p.solve(solver, xlabel = 'time', fTol = 10, debug=0, maxIter = 5500, plot=0, maxTime=1000, ftol = 1e-8, xtol = 1e-6, iprint=1, showLS=0, showFeas=0, show_hs=0)

开发者ID:AlbertHolmes,项目名称:openopt,代码行数:31,代码来源:nlp_4.py

示例2: NLP

# 需要导入模块: from openopt import NLP [as 别名]
# 或者: from openopt.NLP import name [as 别名]
M = 5
p = NLP(lambda x: ((x-M)**2).sum(), cos(arange(N)))
p.lb, p.ub = -6*ones(N), 6*ones(N)
p.lb[3] = 5.5
p.ub[4] = 4.5
p.c = lambda x: [2* x[0] **4-32, x[1]**2+x[2]**2 - 8]
p.h = (lambda x: 1e1*(x[-1]-1)**4, lambda x: (x[-2]-1.5)**4)

"""
minTime is used here
for to provide enough time for user
to play with GUI
"""

minTime = 1.5 # sec
p.name = 'GUI_example'
p.minTime = minTime

"""
hence maxIter, maxFunEvals etc
will not trigger till minTime

only same iter point x_k-1=x_k
or some coords = nan
can stop calculations

other antistop criteria: minFunEvals, minIter, minCPUTime
however, some solvers cannot handle them
 """

# start=True means don't wait for user to press "Run"
开发者ID:AlbertHolmes,项目名称:openopt,代码行数:33,代码来源:GUI_1.py


注:本文中的openopt.NLP.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。