[SciPy-User] coby-la in optimize package - constraints ignored, is this a bug?
Hugo Shi
humongo.shi at gmail.com
Tue Aug 25 00:23:27 EDT 2009
This code returns 257, which is a violation of the constraint. Is this
a bug? or am I doing something stupid?
thanks!
import numpy as np
import scipy as sp
import scipy.optimize
def myfunc(x):
return -x[0]**2
def constraints(x):
if x[0]>10:
return -1.0
else:
return 1.0
retval=scipy.optimize.fmin_cobyla(myfunc,np.array([0]),constraints)
More information about the SciPy-User
mailing list