[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Making a multidimensional minimizer throw a GSL_ERROR?

From: ddneilson
Subject: Re: [Help-gsl] Making a multidimensional minimizer throw a GSL_ERROR?
Date: Wed, 20 Feb 2008 11:27:08 -0600
User-agent: Thunderbird (X11/20071115)

Thanks for the tip, I ended up doing something similar actually. On error, I'm having my f(), df(), and fdf() functions return GSL_NAN for the function eval and its gradient; that seems to be causing the minimizer to abort with a GSL_ENOPROG.

For now, it'll do, but I can't help but think that the prototypes for the f(), df(), and fdf() functions should have them returning GSL error codes that the minimizer should act on. Of course, that'd involve a new GSL version as it'd throw backward compatibility right out the window.


Andrew W. Steiner wrote:
A naive solution is to just return an arbitrary large value whenever the
inversion fails (one could imagine more complicated schemes involving
e.g. the determinant). I do this all the time because it happens to work
for my problems. However, the right way to do this is probably to rewrite the
minimizer in such a way as to "choose a different direction" if the
"step in the current direction" fails. In the case of the simplex algorithm
for example, one could just appropriately choose a new simplex and restart.
I'd lean towards rewriting the iterate() function for the minimizer this
way rather than setjmp() hax.

Take care,

On Wed, Feb 20, 2008 at 11:27 AM, ddneilson <address@hidden> wrote:
 Hello there,
  I'm currently working on a smallish little project wherein I'm using
 GSL's multidimensional minimization routines to find a local minima of a
 function. The problem is that the evaluations of this function involve
 finding the inverse of a positive semi-definite matrix via Cholesky
 decomposition. That in itself isn't a big problem but, some parameter
 values to the function cause the matrix to become ill-conditioned;
 resulting in the Cholesky decomp throwing an error.

  What I would like to do in these cases is bail out of the minimizer
 since the only time this should happen is when the function doesn't have
 a lower bound (I won't know there isn't a lower bound until I encounter
 this problem). However, I can't seem to find a way to tell the multimin
 functions to stop from within a call to the supplied f(), df() or fdf()
 functions. Is this possible, or am I stuck with some sort of
 thread-unsafe setjmp/longjmp hack to get out of this?

 Thanks for your time,

 Help-gsl mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]