Few month ago, I had to try the gsl conjugate gradient algorithms.
On small fonctions, I had no problem. But a friend of mine give me that fonction
:
double
fonction(const Vecteur& x) const {
Double valeur =
100.0 * (x[1] - x[0]*x[0]) * (x[1] - x[0]*x[0]) + (1.0 - x[0])
* (1.0 - x[0])
+
90.0 * (x[3] - x[2]*x[2]) * (x[3] - x[2]*x[2]) + (1.0 - x[2])
* (1.0 - x[2])
+
10.1 * (x[1] - 1.0) * (x[1] - 1.0) + 10.1 * (x[3] - 1.0) *
(x[3] - 1.0) +
19.8 * (x[1] - 1.0) * (x[3] - 1.0);
return valeur;
}
void
gradient(const Vecteur &x, Vecteur& g) const {
g[0] = -2.0 * 100.0 * (x[1] - x[0]*x[0])* 2.0 * x[0]
- 2.0 * (1.0 - x[0]);
g[1] = 100.0 * (x[1] - x[0]*x[0]) + 10.1 * 2.0 * (x[1] - 1.0) +
19.8 * (x[3] - 1.0);
g[2] = -2.0 * 90.0 * (x[3] - x[2]*x[2]) * 2.0 * x[2] - 2.0 * (1.0
-x[2]);
g[3] = 2.0 * 90.0 * (x[3] - x[2]*x[2]) + 10.1 * 2.0 * (x[3] - 1.0) +
19.8 * (x[1] - 1.0);
It has only 4 dimensions, but the GSL algorithm alway fails to find the minimum
at (1, 1, 1, 1).
It's seems to be same erreur message as your : "iterations not progressing
toward a solution".
My friend program the classic conjugate gradient algorithm on Mathlab (to choose
the direction), but then using the Mathlab algorithm for line minimisation. Then
it work perfectly with my special fonction.
I concluded that the gsl algorithm could probably be improved. But I'm not a
mathematician.
--
locnet
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl