本文整理汇总了Python中openopt.NLP.nlpSolver方法的典型用法代码示例。如果您正苦于以下问题:Python NLP.nlpSolver方法的具体用法?Python NLP.nlpSolver怎么用?Python NLP.nlpSolver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openopt.NLP
的用法示例。
在下文中一共展示了NLP.nlpSolver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: milpTransfer
# 需要导入模块: from openopt import NLP [as 别名]
# 或者: from openopt.NLP import nlpSolver [as 别名]
def milpTransfer(originProb):
newProb = NLP(originProb.f, originProb.x0)
originProb.fill(newProb)
newProb.discreteVars = originProb.discreteVars
def err(s): # to prevent text output
raise OpenOptException(s)
newProb.err = err
for fn in ['df', 'd2f', 'c', 'dc', 'h', 'dh']:
if hasattr(originProb, fn) and getattr(originProb.userProvided, fn) or originProb.isFDmodel:
setattr(newProb, fn, getattr(originProb, fn))
newProb.plot = 0
newProb.iprint = -1
newProb.nlpSolver = originProb.nlpSolver
return newProb