Re: MINPACK error with PiecewiseConstantParameter class
Posted by
Dimathematician on
Sep 05, 2009; 10:25am
URL: http://quantlib.414.s1.nabble.com/MINPACK-error-with-PiecewiseConstantParameter-class-tp7946p7950.html
I think I know where the problem might be located: in your cost function
Array values(Array x)
is the dimension of the returned array smaller than the dimension of
x? e.g. you are optimizing with respect to 3 parameters, but returning
a 2 dimensional array.
lmdif checks for
m < n
if this is true, your error code (*info=0) is returned
* m is a positive integer input variable set to the number
* of functions.
*
* n is a positive integer input variable set to the number
* of variables. n must not exceed m.
I think the objective in the MINPACK algo is to avoid an ill posed problem.
Can you check please? Otherwise we'll find something else :)
2009/9/3 javit
<[hidden email]>
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
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
View this message in context: http://www.nabble.com/MINPACK--error-with-PiecewiseConstantParameter-class-tp25225373p25274841.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users