Re: MINPACK error with PiecewiseConstantParameter class
Posted by
javit on
Sep 03, 2009; 12:19pm
URL: http://quantlib.414.s1.nabble.com/MINPACK-error-with-PiecewiseConstantParameter-class-tp7946p7948.html
Klaus,
At my first read, I believed that LM algorithm should work too. I got the code running with ConjugateGradient method.
It took me sometime to figure out what is wrong. It turns out that after the optimized parameters are called, I call the model class once more to get the node values. And at that call, since the values are optimal, the root finders return an error complaining that the root is not bracketed. Both optimal f values have the same sign.
Therefore, in Solver1d.hpp, I believe that one should check the accuracy of the starting points (is f(x_1) - f(x_2) close to zero and is f(x_1) close to zero?) before checking the signs of the f(x_1) and f(x_2).
The current checks are:
Is f(x_1) = 0 ?
Is f(x_2) = 0 ?
Rather than this, it should be:
Is Abs( f(x_1) ) < accuracy?
Is Abs( f(x_2) ) < accuracy?
If yes, then return the x as the root before starting to check the signs of f values.
For the LM algorithm, I still don't know why it is not working. I would bet that it is the number of optimization variables causing the error. My code is currently messy. I cannot send it as it is. I will let you know when all is done.
Thank you for your help,
Javit
Klaus Spanderen-2 wrote
Hi Javit
could you please send (or post) the code that causes the problem. The
Levenberg-Marquardt algorithm should (in theory;-) work for
PiecewiseConstantParameter.
cheers
Klaus
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users