[SciPy-dev] one more scipy.optimize.line_search question

dmitrey openopt@ukr....
Mon Aug 6 16:18:03 CDT 2007


Alan G Isaac wrote:
>>> On Mon, 06 Aug 2007, dmitrey apparently wrote: 
>>>       
>>>> I wonder what does the parameter amax=50 mean (in 
>>>> optimize.line_search func)?  Seems like this parameter is 
>>>> never used in the func 
>>>>         
>
>
>   
>> Alan G Isaac wrote:
>>     
>>> Is there something wrong with the minpack2 documentation? 
>>>       
>
>   
>>> c       stpmax is a double precision variable. 
>>> c         On entry stpmax is a nonnegative upper bound for the step. 
>>> c         On exit stpmax is unchanged. 
>>>       
>
>
> On Mon, 06 Aug 2007, dmitrey apparently wrote:
>   
>> the line_search func from scipy.optimize has no any relation to the 
>> fortran routine you have mentioned. 
>> Maybe you mean line_search func from scipy.optimize.linesearch, but as I 
>> mentioned, scipy has 2 funcs line_search, one python-written (from 
>> optimize.py), other from /optimize/linesearch.py. 
>> So, as I have mentioned, amax is unused in scipy.optimize.linesearch 
>>     
>
>
> In optimize.linesearch we define:
> line_search(f, myfprime, xk, pk, gfk, old_fval, old_old_fval, args=(), c1=1e-4, c2=0.9, amax=50):
> In optimize.optimize we define:
> line_search(f, myfprime, xk, pk, gfk, old_fval, old_old_fval, args=(), c1=1e-4, c2=0.9, amax=50):
> Clearly this is just a matter of a consistent interface,
> so all args get the same interpretation.
>   
If you'll just try ctrl-f "amax" in optimize.py, you'll see that it has 
only 2 : one - definition of amax as a func and one - in line_search 
func input args. So the value is unused in line_search.


> As to why the stepsize bound is not used in the latter,
> you will have to ask Travis.
>
> Do you find a difference in the performance of the two?
>   
Yes, I do. At least, they return different numbers for my whole problem.

fortran:
itn 0: Fk= 8596.39550577 maxResidual= 804.031293334
itn 1 : Fk= 8596.39529687 maxResidual= 804.031284626
itn 2 : Fk= 8596.39509622 maxResidual= 804.03127639
itn 3 : Fk= 8596.39489987 maxResidual= 804.031268349
...
itn 10 : Fk= 8596.39355523 maxResidual= 804.031212067
itn 20 : Fk= 8596.39164144 maxResidual= 804.031131664
itn 30 : Fk= 8596.3897277 maxResidual= 804.031051261
itn 40 : Fk= 8596.38781395 maxResidual= 804.030970858
itn 50 : Fk= 8596.38590021 maxResidual= 804.030890455

python:
itn 0: Fk= 8596.39550577 maxResidual= 804.031293334
itn 1 : Fk= 8591.30146061 maxResidual= 803.818915875
itn 2 : Fk= 8586.40946095 maxResidual= 803.61802955
itn 3 : Fk= 8581.62365205 maxResidual= 803.421917306
...
itn 10 : Fk= 8548.91083789 maxResidual= 802.050160864
itn 20 : Fk= 8502.55420774 maxResidual= 800.094501458
itn 30 : Fk= 8456.43702405 maxResidual= 798.143610745
itn 40 : Fk= 8410.55715335 maxResidual= 796.19747748
itn 50 : Fk= 8364.9134737 maxResidual= 794.256090032

So Python implementation seems to be better (at least for the single 
test func; also, I don't check how much time and/or iterations do they 
consume).
But Matthieu's implementation works much more better in single (1st) 
iteration, but after 2nd i constantly get either zero shift (x_new=x0) 
or CPU hanging.
Maybe he has some variables remembered from previous calculations?
D.

> Cheers,
> Alan Isaac
>
>
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
>
>
>   



More information about the Scipy-dev mailing list