Debian Codegraph @

external/gsl/gsl_multimin.h

raw symbols SCIP
1 /* multimin/gsl_multimin.h
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi
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 /* Modified by Tuomo Keskitalo to include fminimizer and
21 Nelder Mead related lines */
22
23 #ifndef __GSL_MULTIMIN_H__
24 #define __GSL_MULTIMIN_H__
25
26 #include <stdlib.h>
27 #include "gsl_types.h"
28 #include "gsl_math.h"
29 #include "gsl_vector.h"
30 #include "gsl_matrix.h"
31 #include "gsl_min.h"
32
33 #undef __BEGIN_DECLS
34 #undef __END_DECLS
35 #ifdef __cplusplus
36 # define __BEGIN_DECLS extern "C" {
37 # define __END_DECLS }
38 #else
39 # define __BEGIN_DECLS /* empty */
40 # define __END_DECLS /* empty */
41 #endif
42
43 __BEGIN_DECLS
44
45 /* Definition of an arbitrary real-valued function with gsl_vector input and */
46 /* parameters */
47 struct gsl_multimin_function_struct
48 {
49 double (* f) (const gsl_vector * x, void * params);
50 size_t n;
51 void * params;
52 };
53
54 typedef struct gsl_multimin_function_struct gsl_multimin_function;
55
56 #define GSL_MULTIMIN_FN_EVAL(F,x) (*((F)->f))(x,(F)->params)
57
58 /* Definition of an arbitrary differentiable real-valued function */
59 /* with gsl_vector input and parameters */
60 struct gsl_multimin_function_fdf_struct
61 {
62 double (* f) (const gsl_vector * x, void * params);
63 void (* df) (const gsl_vector * x, void * params,gsl_vector * df);
64 void (* fdf) (const gsl_vector * x, void * params,double *f,gsl_vector * df);
65 size_t n;
66 void * params;
67 };
68
69 typedef struct gsl_multimin_function_fdf_struct gsl_multimin_function_fdf;
70
71 #define GSL_MULTIMIN_FN_EVAL_F(F,x) (*((F)->f))(x,(F)->params)
72 #define GSL_MULTIMIN_FN_EVAL_DF(F,x,g) (*((F)->df))(x,(F)->params,(g))
73 #define GSL_MULTIMIN_FN_EVAL_F_DF(F,x,y,g) (*((F)->fdf))(x,(F)->params,(y),(g))
74
75 int gsl_multimin_diff (const gsl_multimin_function * f,
76 const gsl_vector * x, gsl_vector * g);
77
78 /* minimization of non-differentiable functions */
79
80 typedef struct
81 {
82 const char *name;
83 size_t size;
84 int (*alloc) (void *state, size_t n);
85 int (*set) (void *state, gsl_multimin_function * f,
86 const gsl_vector * x,
87 double * size,
88 const gsl_vector * step_size);
89 int (*iterate) (void *state, gsl_multimin_function * f,
90 gsl_vector * x,
91 double * size,
92 double * fval);
93 void (*free) (void *state);
94 }
95 gsl_multimin_fminimizer_type;
96
97 typedef struct
98 {
99 /* multi dimensional part */
100 const gsl_multimin_fminimizer_type *type;
101 gsl_multimin_function *f;
102
103 double fval;
104 gsl_vector * x;
105
106 double size;
107
108 void *state;
109 }
110 gsl_multimin_fminimizer;
111
112 gsl_multimin_fminimizer *
113 gsl_multimin_fminimizer_alloc(const gsl_multimin_fminimizer_type *T,
114 size_t n);
115
116 int
117 gsl_multimin_fminimizer_set (gsl_multimin_fminimizer * s,
118 gsl_multimin_function * f,
119 const gsl_vector * x,
120 const gsl_vector * step_size);
121
122 void
123 gsl_multimin_fminimizer_free(gsl_multimin_fminimizer *s);
124
125 const char *
126 gsl_multimin_fminimizer_name (const gsl_multimin_fminimizer * s);
127
128 int
129 gsl_multimin_fminimizer_iterate(gsl_multimin_fminimizer *s);
130
131 gsl_vector *
132 gsl_multimin_fminimizer_x (const gsl_multimin_fminimizer * s);
133
134 double
135 gsl_multimin_fminimizer_minimum (const gsl_multimin_fminimizer * s);
136
137 double
138 gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s);
139
140 /* Convergence test functions */
141
142 int
143 gsl_multimin_test_gradient(const gsl_vector * g,double epsabs);
144
145 int
146 gsl_multimin_test_size(const double size ,double epsabs);
147
148 /* minimisation of differentiable functions */
149
150 typedef struct
151 {
152 const char *name;
153 size_t size;
154 int (*alloc) (void *state, size_t n);
155 int (*set) (void *state, gsl_multimin_function_fdf * fdf,
156 const gsl_vector * x, double * f,
157 gsl_vector * gradient, double step_size, double tol);
158 int (*iterate) (void *state,gsl_multimin_function_fdf * fdf,
159 gsl_vector * x, double * f,
160 gsl_vector * gradient, gsl_vector * dx);
161 int (*restart) (void *state);
162 void (*free) (void *state);
163 }
164 gsl_multimin_fdfminimizer_type;
165
166 typedef struct
167 {
168 /* multi dimensional part */
169 const gsl_multimin_fdfminimizer_type *type;
170 gsl_multimin_function_fdf *fdf;
171
172 double f;
173 gsl_vector * x;
174 gsl_vector * gradient;
175 gsl_vector * dx;
176
177 void *state;
178 }
179 gsl_multimin_fdfminimizer;
180
181 gsl_multimin_fdfminimizer *
182 gsl_multimin_fdfminimizer_alloc(const gsl_multimin_fdfminimizer_type *T,
183 size_t n);
184
185 int
186 gsl_multimin_fdfminimizer_set (gsl_multimin_fdfminimizer * s,
187 gsl_multimin_function_fdf *fdf,
188 const gsl_vector * x,
189 double step_size, double tol);
190
191 void
192 gsl_multimin_fdfminimizer_free(gsl_multimin_fdfminimizer *s);
193
194 const char *
195 gsl_multimin_fdfminimizer_name (const gsl_multimin_fdfminimizer * s);
196
197 int
198 gsl_multimin_fdfminimizer_iterate(gsl_multimin_fdfminimizer *s);
199
200 int
201 gsl_multimin_fdfminimizer_restart(gsl_multimin_fdfminimizer *s);
202
203 gsl_vector *
204 gsl_multimin_fdfminimizer_x (gsl_multimin_fdfminimizer * s);
205
206 gsl_vector *
207 gsl_multimin_fdfminimizer_dx (gsl_multimin_fdfminimizer * s);
208
209 gsl_vector *
210 gsl_multimin_fdfminimizer_gradient (gsl_multimin_fdfminimizer * s);
211
212 double
213 gsl_multimin_fdfminimizer_minimum (gsl_multimin_fdfminimizer * s);
214
215 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_steepest_descent;
216 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_pr;
217 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_fr;
218 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs;
219 GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs2;
220 GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex;
221
222
223 __END_DECLS
224
225 #endif /* __GSL_MULTIMIN_H__ */