aboutsummaryrefslogtreecommitdiff
path: root/Carpet/LoopControl/src/lc_siman.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-08-26 02:55:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-08-26 02:55:00 +0000
commite15f981b761acb114010667880ef59fd508ee41a (patch)
treebe57f518626e309b6a9b4219adfd1fcb4e89a7fe /Carpet/LoopControl/src/lc_siman.h
parentf6ff5079044289e1f748e800ce85e171fe766f5f (diff)
LoopControl: Add automatic configuration based on simulated annealing
(Nice idea, but doesn't seem to work right. Maybe only the parameters need to be chosen differently? But I rather think that a more intelligent method is necessary.) darcs-hash:20070826025505-dae7b-ed81bc28a4204d84776d28443be65a995c52699b.gz
Diffstat (limited to 'Carpet/LoopControl/src/lc_siman.h')
-rw-r--r--Carpet/LoopControl/src/lc_siman.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/Carpet/LoopControl/src/lc_siman.h b/Carpet/LoopControl/src/lc_siman.h
new file mode 100644
index 000000000..c848ba378
--- /dev/null
+++ b/Carpet/LoopControl/src/lc_siman.h
@@ -0,0 +1,59 @@
+/* Simulated annealing */
+
+/* Adapted from GSL, the GNU Scientific Library, version 1.9 */
+
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Mark Galassi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SIMAN_H
+#define SIMAN_H
+
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* types for the function pointers passed to lc_siman_solve */
+
+typedef void (*lc_siman_step_t) (const gsl_rng *r, void *xp, double step_size);
+typedef double (*lc_siman_metric_t) (void *xp, void *yp);
+typedef void (*lc_siman_print_t) (void *xp);
+
+/* this structure contains all the information needed to structure the
+ search, beyond the energy function, the step function and the
+ initial guess. */
+
+typedef struct {
+ int iters_fixed_T; /* how many iterations at each temperature? */
+ double step_size; /* max step size in the random walk */
+ /* the following parameters are for the Boltzmann distribution */
+ double k, t_initial, mu_t, t_min;
+} lc_siman_params_t;
+
+/* prototype for the workhorse function */
+
+typedef struct lc_siman_state_t lc_siman_state_t;
+
+lc_siman_state_t *
+lc_siman_solve (lc_siman_state_t *restrict state,
+ const gsl_rng *restrict r,
+ void *restrict x0_p, double E,
+ lc_siman_step_t take_step,
+ lc_siman_metric_t distance,
+ lc_siman_print_t print_position,
+ size_t element_size,
+ lc_siman_params_t params);
+
+#endif /* #ifndef SIMAN_H */