Scipy Minimization

时间:2015-12-18 20:31:38

标签: python scipy minimization

我有一个不等式约束优化问题,并且对输入的语法有点不清楚。文件没有证明所有澄清。我想知道下面的函数是否正在做我希望的事情:用(Pguess,Qguess)初始化优化并使用SLSQP找到最小约束,使得0 <0。 Qguess&lt; QMax(Pguess)&amp;&amp; Pguess&gt; 0

def optimalSurface(self):
        Pguess=  float(1.1) if (self.type[0] == 'A' or self.type[0] =='a') else float(2.0)
        Qguess = .9* self.QMax(Pguess)

        ##(Qguess should always be less than QMax(Pguess))

        cons = ({'type': 'ineq', 'fun': lambda x : self.QMax(x[1]) - x[0]}) 
        bnds = ((0, None),(0 , None))  
        f = self.endObjective
        result = optimize.minimize(f, [Pguess,Qguess] ,method ='SLSQP', constraints = cons, bounds = bnds, options = {'disp':True})

0 个答案:

没有答案