00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPGSL_GSL_OPTIMIZER_H
00009 #define IMPGSL_GSL_OPTIMIZER_H
00010
00011 #include "gsl_config.h"
00012
00013 #include <IMP/Optimizer.h>
00014 #include <gsl/gsl_multimin.h>
00015
00016 IMPGSL_BEGIN_NAMESPACE
00017
00018
00019
00020
00021
00022 class IMPGSLEXPORT GSLOptimizer: public Optimizer
00023 {
00024 double stop_score_;
00025 mutable double best_score_;
00026 public:
00027 GSLOptimizer(Model *m);
00028
00029 virtual ~GSLOptimizer();
00030
00031 using Optimizer::optimize;
00032
00033
00034 void set_stop_score(double d) {
00035 stop_score_=d;
00036 }
00037 #ifndef IMP_DOXYGEN
00038 gsl_vector* get_state() const;
00039 void update_state(gsl_vector *x) const;
00040 void write_state(const gsl_vector *x) const;
00041
00042 double evaluate(const gsl_vector *v) const;
00043 double evaluate_derivative(const gsl_vector *v, gsl_vector *df) const;
00044 unsigned int get_dimension() const {
00045 return std::distance(float_indexes_begin(), float_indexes_end());
00046 }
00047 double optimize(unsigned int n, const gsl_multimin_fdfminimizer_type*t,
00048 double step, double param, double min_gradient) const;
00049
00050 double optimize(unsigned int n, const gsl_multimin_fminimizer_type*t,
00051 double size, double max_size) const;
00052 #endif
00053 };
00054
00055
00056 IMPGSL_END_NAMESPACE
00057
00058 #endif