This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

simulated annealing


Hi folks!

I'm trying to solve a not well understood optimization problem with simulated annealing. I have some basic understanding by some talks and read the manual and gsl-1.3/siman/siman.c and header.

But at least some questions are open:

- The variable gsl_siman_params_t.iters_fixed_T is unused, but explained,
- and the intended difference between n_tries and iters_fixed_T is not clear,
- also the difference between gsl_siman_solve_many and gsl_siman_solve is unclear (gsl_siman_solve_many is only found in the header)
- gsl_siman_solve algorithm: (the patch is attached)
* the run control output format is not as the manual states (x-(*x0_p) is missing), hence metric difference is not necessary.
* for loop condition should be for (i=0; i<params.iters_fixed_T; ++i), so this parameter makes sense
* E=Ef(x) should be evaluated before the while loop, because during the search new_E is already determined and copied to E, if new_x is accepted.
- gsl_siman_solve_many algorithm:
* are there extensions to the variable data length interface of gsl_siman_solve() ?


I like the aproach of all these object oriented helper functions - it can be wraped to c++ easily. But perhaps a struct is better than so many parameters.

Yours, Achim
Index: siman.c
===================================================================
RCS file: /cvs/gsl/gsl/siman/siman.c,v
retrieving revision 1.23
diff -C2 -r1.23 siman.c
*** siman.c	3 Aug 2002 19:36:14 -0000	1.23
--- siman.c	24 Mar 2003 13:54:13 -0000
***************
*** 45,49 ****
    int i, done;
    double T;
!   int n_evals = 0, n_iter = 0, n_accepts, n_rejects, n_eless;
  
    /* this function requires that either the dynamic functions (copy,
--- 45,49 ----
    int i, done;
    double T;
!   int n_evals = 1, n_iter = 0, n_accepts, n_rejects, n_eless;
  
    /* this function requires that either the dynamic functions (copy,
***************
*** 54,57 ****
--- 54,58 ----
  
    distance = 0 ; /* This parameter is not currently used */
+   E = Ef(x0_p);
  
    if (copyfunc) {
***************
*** 67,71 ****
    }
  
!   best_E = Ef(best_x);
  
    T = params.t_initial;
--- 68,72 ----
    }
  
!   best_E = E;
  
    T = params.t_initial;
***************
*** 77,86 ****
  
    while (!done) {
-     E = Ef (x);
  
      n_accepts = 0;
      n_rejects = 0;
      n_eless = 0;
!     for (i = 0; i < params.n_tries - 1; ++i) {
        if (copyfunc) {
  	copyfunc(x, new_x);
--- 78,86 ----
  
    while (!done) {
  
      n_accepts = 0;
      n_rejects = 0;
      n_eless = 0;
!     for (i = 0; i < params.iters_fixed_T; ++i) {
        if (copyfunc) {
  	copyfunc(x, new_x);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]