pyOpt嵌套优化

pyOpt nested optimization

是否可以在pyOpt中进行嵌套优化?

例如:

pyOpt 中的 "outer" objfunc 示例:

def __objfunc(x,**kwargs):
    f=x**2

    g=[0.0]
    g[0]=maxValueViaOptimization(x)-10 #inequality constraint

    fail=0
    return f,g,fail

maxValueViaOptimization() 通过 pyOpt 执行单独优化的函数(找到 h(x) 的最大值),returns float

正是@Erwin Kalvelagen 所说的。

If the inner problem does not alter any of the outer variables (eg x) then >you may be able just calling a function and use some derivative free solver. >– @ErwinKalvelagen Jan 20 at 14:34