2

I have an inequality constrained optimization problem and am a bit unclear about the syntax of the input. The documentation did not prove all that clarifying. I want to know if the function below is doing what I hope it is: Initialize the optimization with (Pguess, Qguess) and use SLSQP to find the minimum constrained such that 0< Qguess < QMax(Pguess) && Pguess > 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})
Anisotropic
  • 635
  • 9
  • 21

0 Answers0