Hi
> One thing that would be helpful would be if someone tried Alexander's
> test problem in fmin_slsqp from SciPy, which also uses the SLSQP code,
> to see if a similar problem (albeit probably with different symptoms)
> occurs there.
I used SciPy to solve the problem min -s*x on [-1;1] with fmin_slsqp.
Fmin_slsqp fails to solve the problem for s >= 1.0E6. If s >= 1.0E3 the result
code is 'Positive directional derivative for linesearch'.
Below the results and program is listed.
Kind regards
Alexander Riess
Results:
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 1.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+00
2 2 -1.000000E+00 1.000000E+00
Optimization terminated successfully. (Exit mode 0)
Current function value: -1.0
Iterations: 2
Function evaluations: 2
Gradient evaluations: 2
==============================================================
Results [[1.0], -1.0, 2, 0, 'Optimization terminated successfully.']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 100.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+02
2 2 -1.000000E+02 1.000000E+02
Optimization terminated successfully. (Exit mode 0)
Current function value: -99.9999999774
Iterations: 2
Function evaluations: 2
Gradient evaluations: 2
==============================================================
Results [[0.99999999977386267], -99.999999977386267, 2, 0, 'Optimization
terminated successfully.']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 1000.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+03
6 2 -9.999998E+02 1.000000E+03
Positive directional derivative for linesearch (Exit mode 8)
Current function value: -999.99982147
Iterations: 6
Function evaluations: 2
Gradient evaluations: 2
==============================================================
Results [[0.99999982147039645], -999.99982147039645, 6, 8, 'Positive
directional derivative for linesearch']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 1000.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+03
6 2 -9.999998E+02 1.000000E+03
Positive directional derivative for linesearch (Exit mode 8)
Current function value: -999.99982147
Iterations: 6
Function evaluations: 2
Gradient evaluations: 2
==============================================================
Results [[0.99999982147039645], -999.99982147039645, 6, 8, 'Positive
directional derivative for linesearch']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 10000.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+04
3 2 -9.998061E+03 1.000000E+04
7 3 -9.998734E+03 1.000000E+04
Positive directional derivative for linesearch (Exit mode 8)
Current function value: -9998.73394578
Iterations: 7
Function evaluations: 3
Gradient evaluations: 3
==============================================================
Results [[0.99987339457766211], -9998.7339457766211, 7, 8, 'Positive
directional derivative for linesearch']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 100000.0
==============================================================
NIT FC OBJFUN GNORM
1 1 -0.000000E+00 1.000000E+05
3 2 -5.625775E+04 1.000000E+05
7 3 -1.132632E+05 1.000000E+05
Positive directional derivative for linesearch (Exit mode 8)
Current function value: -113263.206481
Iterations: 7
Function evaluations: 3
Gradient evaluations: 3
==============================================================
Results [[1.1326320648076944], -113263.20648076944, 7, 8, 'Positive
directional derivative for linesearch']
-------------------------------------------------------------------------
Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = 1000000.0
==============================================================
NIT FC OBJFUN GNORM
5 1 -0.000000E+00 1.000000E+06
Positive directional derivative for linesearch (Exit mode 8)
Current function value: -0
Iterations: 5
Function evaluations: 1
Gradient evaluations: 1
==============================================================
Results [[0.0], -0.0, 5, 8, 'Positive directional derivative for linesearch']
Program:
-------------------------------------------------------------------------
from scipy.optimize import fmin_slsqp
from numpy import array, asfarray, finfo,ones, sqrt, zeros
def f(x,*args):
out = -s*x[0]
return out
def df(x,*args):
out = [-s]
return out
s = 1.0E2
print "Optimization of -s*x on [-1.0,1.0] using fmin_slsqp | s = ",s
print "=============================================================="
x = fmin_slsqp(f,
x0=[0.0],
fprime = df,
bounds=[(-1.0,1.0)],
iprint=2,
full_output=1)
print "=============================================================="
print "Results",x
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss