[Scipy-tickets] [SciPy] #1126: scipy.optimize.anneal does not respect lower/upper bounds

SciPy Trac scipy-tickets@scipy....
Thu Mar 4 06:15:01 CST 2010


#1126: scipy.optimize.anneal does not respect lower/upper bounds
--------------------------------+-------------------------------------------
 Reporter:  lboussouf           |       Owner:  somebody   
     Type:  defect              |      Status:  new        
 Priority:  highest             |   Milestone:  Unscheduled
Component:  scipy.optimize      |     Version:             
 Keywords:  bounds upper lower  |  
--------------------------------+-------------------------------------------
 Running the code below raises an exception as anneal try to evaluate f at
 1.97065187015 which is forbidden as specified in bounds.

 If we look at line 106 in the code :
 [http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/anneal.py]

 It's obvious why it does not respect bounds : xc is designed to respect
 them, but as we do xnew = x0 + xc the following line, there is no chance
 to respect bounds.

 And the same problem appears in all update_guess subroutines.

 Is anybody supporting that code or would it be better to handle it myself
 ? I can't stand thinking people are using this code with such mistakes. My
 optimizer soul is hurt ...


 {{{
 import scipy.optimize

 # Define function
 def f(x):
     print x
     if x < -1 or x > 1:
         raise Exception
     else:
         return x**2


 # Solve minimization problem using SA
 x = scipy.optimize.anneal(func=f,x0=0,lower=-1,upper=1)
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1126>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list