At Mon, 27 Jul 2009 09:22:46 -0400, Andrew W. Steiner wrote: > I've been finding that the new simplex algorithm seems to fail > to converge much more frequently than the old one. It took me > awhile to generate a sufficiently portable case which demonstrates > this, but attached is a program which shows that the simplex > minimizer succeeds, but the simplex2 minimizer stalls and gets > stuck (the true minimum is at (1,0,0)). >
By comparing with the original simplex output, I found that the center and size were not updated in contract_by_best, causing the values to drift. With the patch below the results should be identical with the standard simplex algorithm. I also added the spring function as a test case. Thanks to everyone who contributed to the bug report. -- Brian Gough (GSL Maintainer) Support freedom by joining the FSF http://www.fsf.org/associate/support_freedom/join_fsf?referrer=37 commit 8fd1a5b178bc0956b50870d272551b9f3fd2d192 Author: Brian Gough <[email protected]> Date: Wed Aug 5 17:13:33 2009 +0100 fix for bug #27180: nmsimplex2 failed to converge (A.Steiner) diff --git a/multimin/simplex2.c b/multimin/simplex2.c index c9d01a7..bcf99df 100644 --- a/multimin/simplex2.c +++ b/multimin/simplex2.c @@ -57,6 +57,11 @@ typedef struct } nmsimplex_state_t; +static int +compute_center (const nmsimplex_state_t * state, gsl_vector * center); +static double +compute_size (nmsimplex_state_t * state, const gsl_vector * center); + static double try_corner_move (const double coeff, const nmsimplex_state_t * state, @@ -173,6 +178,10 @@ contract_by_best (nmsimplex_state_t * state, size_t best, } } + /* We need to update the centre and size as well */ + compute_center (state, state->center); + compute_size (state, state->center); + return status; } _______________________________________________ Bug-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-gsl
