Skip to content Skip to sidebar Skip to footer

Minimize System Of Equations With Constraints (scipy.optimize.minimize)

Consider the following code: import numpy as np from scipy.optimize import minimize def eq( p ): s1,s2,s3 = p f1 = 1.1**3 / s1*1.1**1+s2*1.1**2+s3*1.1**3 f2 = 0.9**1

Solution 1:

minimize( eq, (0.3,0.3,0.3),  bounds=bnds, constraints=cons )

The second argument should be an ndarray not a tuple. The args tuple comes after the initial guess (x0).

http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.minimize.html

Solution 2:

The second parameter should be of type ndarray, try using

 minimize( eq, np.ndarray([0.3,0.3,0.3]),  bounds=bnds, constraints=cons )

Post a Comment for "Minimize System Of Equations With Constraints (scipy.optimize.minimize)"