[SciPy-dev] Advice on Simulated Annealing (ticket #875)

william ratcliff william.ratcliff@gmail....
Mon Mar 2 13:15:43 CST 2009


Perhaps we could enhance the documentation so this is clear?  Also, having
another module which does impose bounds on the actual values of the
parameters would be useful.  My ansatz was that if the next iteration would
fall outside of the bounds, stay at the current location.


Cheers,
William

On Mon, Mar 2, 2009 at 2:04 PM, <josef.pktd@gmail.com> wrote:

> On Mon, Mar 2, 2009 at 12:04 PM, william ratcliff
> <william.ratcliff@gmail.com> wrote:
> > 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
> >
> >
>
> After looking a bit more carefully:
>
> `upper` and `lower` in` fast_ca` are the bounds on the updating
> increment, xc, not on the parameters that are estimated x0, xnew  and
> in the ticket. I didn't see any constraints on the parameters
> themselves in anneal.
>
> The current bounds restrict the updating to local perturbations, while
> in your case perturbations would always be global.
>
> Rewriting anneal to incorporate bounds might be a good enhancement
> but, I think, you need to distinguish between bounds on the parameters
> and bounds on the update increments. Then the update increments can
> easily bound by  (xbounds - x0)  and you don't need iteration to find
> the updated values.
>
> Josef
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20090302/32e5240a/attachment.html 


More information about the Scipy-dev mailing list