[SciPy-user] scipy.optimize.anneal - problem with lower and upper

Paul Rudin paul@rudin.co...
Thu Jun 11 02:42:22 CDT 2009

I'm experimenting with scipy.optimize.anneal, but I'm confused about the
'lower' and 'upper' arguments. I was expecting that this would limit the
range of values passed to the function being optimized. However this
appears not the be the case, as running the snippet below
illustrates. You'll soon see values being passed in that fall outside
the range given by upper and lower. Have I misunderstood what these
arguments are supposed to mean or is there a bug? 

(Incidentally - I'm also surprised that that first thing printed isn't
the value for x0 that's passed in - but that's another question.)

from scipy.optimize import anneal
import numpy

def test(*args):
    print args
    return numpy.random.random()

anneal(test, numpy.ones(3)*0.5, lower=numpy.zeros(3), upper=numpy.ones(3))

More information about the SciPy-user mailing list