[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] multidimensional minimization
From: |
Chris |
Subject: |
[Help-gsl] multidimensional minimization |
Date: |
Fri, 30 Jan 2004 12:21:07 +0100 |
Hello,
i have a problem using the set of functions for multidimensional
minimization !
I need to find the minimum of a set of vectors, so i use a code like
that found in the documentation:
.
.
.
T = gsl_multimin_fdfminimizer_conjugate_fr;
s = gsl_multimin_fdfminimizer_alloc (T, 2);
for (i = 0; i < num_of_vect; ++i) {
gsl_multimin_fdfminimizer_set (s, &my_func, x+i, 0.01, 1e-4);
do
{
iter++;
status = gsl_multimin_fdfminimizer_iterate (s);
if (status)
break;
status = gsl_multimin_test_gradient (s->gradient, 1e-3);
if (status == GSL_SUCCESS)
printf ("Minimum found at:\n");
printf ("%5d %.5f %.5f %10.5f\n", iter,
gsl_vector_get (s->x, 0),
gsl_vector_get (s->x, 1),
s->f);
}
while (status == GSL_CONTINUE && iter < 100);
//something goes here
}
.
.
.
The only way i've found to restart the minimization of the next
vector is to set s->f to the energies of the new vector. Any
other solution don't works ! Every time, the
gsl_multimin_fdfminimizer_iterate (s) return status = 27
with the other solutions.!
I don't think this is the right way, but it is the only
i've found. Can anyone help me ???