1 /* siman/gsl_siman.h 2 * 3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Mark Galassi 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or (at 8 * your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GSL_SIMAN_H__ 21 #define __GSL_SIMAN_H__ 22 #include <stdlib.h> 23 #include <gsl/gsl_rng.h> 24 25 #undef __BEGIN_DECLS 26 #undef __END_DECLS 27 #ifdef __cplusplus 28 # define __BEGIN_DECLS extern "C" { 29 # define __END_DECLS } 30 #else 31 # define __BEGIN_DECLS /* empty */ 32 # define __END_DECLS /* empty */ 33 #endif 34 35 __BEGIN_DECLS 36 37 /* types for the function pointers passed to gsl_siman_solve */ 38 39 typedef double (*gsl_siman_Efunc_t) (void *xp); 40 typedef void (*gsl_siman_step_t) (const gsl_rng *r, void *xp, double step_size); 41 typedef double (*gsl_siman_metric_t) (void *xp, void *yp); 42 typedef void (*gsl_siman_print_t) (void *xp); 43 typedef void (*gsl_siman_copy_t) (void *source, void *dest); 44 typedef void * (*gsl_siman_copy_construct_t) (void *xp); 45 typedef void (*gsl_siman_destroy_t) (void *xp); 46 47 /* this structure contains all the information needed to structure the 48 search, beyond the energy function, the step function and the 49 initial guess. */ 50 51 typedef struct { 52 int n_tries; /* how many points to try for each step */ 53 int iters_fixed_T; /* how many iterations at each temperature? */ 54 double step_size; /* max step size in the random walk */ 55 /* the following parameters are for the Boltzmann distribution */ 56 double k, t_initial, mu_t, t_min; 57 } gsl_siman_params_t; 58 59 /* prototype for the workhorse function */ 60 61 void gsl_siman_solve(const gsl_rng * r, 62 void *x0_p, gsl_siman_Efunc_t Ef, 63 gsl_siman_step_t take_step, 64 gsl_siman_metric_t distance, 65 gsl_siman_print_t print_position, 66 gsl_siman_copy_t copyfunc, 67 gsl_siman_copy_construct_t copy_constructor, 68 gsl_siman_destroy_t destructor, 69 size_t element_size, 70 gsl_siman_params_t params); 71 72 void 73 gsl_siman_solve_many (const gsl_rng * r, void *x0_p, gsl_siman_Efunc_t Ef, 74 gsl_siman_step_t take_step, 75 gsl_siman_metric_t distance, 76 gsl_siman_print_t print_position, 77 size_t element_size, 78 gsl_siman_params_t params); 79 80 __END_DECLS 81 82 #endif /* __GSL_SIMAN_H__ */ 83