core/vnl/algo/vnl_powell.h

Go to the documentation of this file.
00001 // This is core/vnl/algo/vnl_powell.h
00002 #ifndef vnl_powell_h_
00003 #define vnl_powell_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Powell minimizer.
00010 // \author awf@robots.ox.ac.uk
00011 // \date   05 Dec 00
00012 
00013 #include <vnl/vnl_cost_function.h>
00014 #include <vnl/vnl_nonlinear_minimizer.h>
00015 
00016 //: The ever-popular Powell minimizer.
00017 // Derivative-free method which may be faster if your
00018 // function is expensive to compute and many-dimensional.
00019 // Implemented from scratch from NR.
00020 class vnl_powell : public vnl_nonlinear_minimizer
00021 {
00022  public:
00023 
00024   //: Initialize a powell with the given cost function
00025   vnl_powell(vnl_cost_function* functor)
00026     : functor_(functor), linmin_xtol_(1e-4), initial_step_(1.0) {}
00027 
00028   //: Run minimization, place result in x.
00029   ReturnCodes minimize(vnl_vector<double>& x);
00030 
00031   //: Set tolerance on line search parameter step
00032   //  Default value is 0.0001
00033   void set_linmin_xtol(double tol) { linmin_xtol_ = tol; }
00034 
00035   //: Set initial step when bracketting minima along a line
00036   //  Default value is 1.0
00037   void set_initial_step(double step) { initial_step_ = step; }
00038 
00039  protected:
00040   vnl_cost_function* functor_;
00041 
00042   friend class vnl_powell_1dfun;
00043   void pub_report_eval(double e) { report_eval(e); }
00044 
00045   //: Tolerance on line search parameter step
00046   double linmin_xtol_;
00047 
00048   //: Initial step when bracketting minima along a line
00049   double initial_step_;
00050 };
00051 
00052 #endif // vnl_powell_h_

Generated on Sat Nov 22 05:06:19 2008 for core/vnl by  doxygen 1.5.1