[SciPy-dev] Advice on Simulated Annealing (ticket #875)
william ratcliff
william.ratcliff at gmail.com
Mon Mar 2 12:04:13 EST 2009
Here is code that will demonstrate the failure. Suppose you want to
minimize the simple function f(x,y)=x^2+y^2, but you want to do it in a
specified domain. This will not respect the upper and lower bounds:
cheers,
William
import numpy as N
import scipy.optimize.anneal as anneal
def fcn(p):
x,y=p
result=x**2+y**2
return result
if __name__=="__main__":
p0=N.array([3,3],'d')
lowerm=[1,1]
upperm=[4,4]
myschedule='fast'
p0,jmin=anneal(fcn,p0,\
schedule=myschedule,lower=lowerm,upper=upperm,\
maxeval=None,
maxaccept=None,dwell=10,maxiter=600,T0=10000)
print 'p0',p0,'jmin',jmin
On Mon, Mar 2, 2009 at 9:43 AM, william ratcliff <william.ratcliff at gmail.com
> wrote:
> I posted a suggested patch because it would seem that the simulated
> annealing routine in scipy as it was would not respect bounds for the search
> space. I'll try to reconstruct the test case to show where it fails. There
> seemed to be a lack of interest in a version that did respect bounds
> (upper/lower limits on the parameters), so I've just been using my own copy.
>
>
> Cheers,
> William
>
>
> On Mon, Mar 2, 2009 at 8:54 AM, Sturla Molden <sturla at molden.no> wrote:
>
>> On 3/2/2009 6:55 AM, Stéfan van der Walt wrote:
>>
>> > http://scipy.org/scipy/scipy/ticket/875#comment:1
>> >
>> > looks fragile, but I don't know how to fix it best.
>>
>> This ticket i bogus. There is no simple_sa in anneal.py in SVN, and line
>> 151 is a docstring. Google says that the simple_sa class was posted to
>> this mailing list two years ago by William Ratcliff. But as far as I can
>> tell it is not in SciPy.
>>
>> Sturla Molden
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev at scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20090302/aa2bac58/attachment.html>
More information about the SciPy-Dev
mailing list