00001 //-*- c++ -*------------------------------------------------------------------- 00002 #ifndef vnl_powell_h_ 00003 #define vnl_powell_h_ 00004 // Author: awf@robots.ox.ac.uk 00005 // Created: 05 Dec 00 00006 00007 #include <vnl/vnl_cost_function.h> 00008 #include <vnl/vnl_nonlinear_minimizer.h> 00009 00010 //: The ever-popular Powell minimizer. 00011 // Derivative-free method which may be faster if your 00012 // function is expensive to compute and many-dimensional. 00013 // Implemented from scratch from NR. 00014 class vnl_powell : public vnl_nonlinear_minimizer { 00015 public: 00016 00017 //: Initialize a powell with the given cost function 00018 vnl_powell(vnl_cost_function* functor); 00019 00020 //: Run minimization, place result in x. 00021 ReturnCodes minimize(vnl_vector<double>& x); 00022 00023 protected: 00024 vnl_cost_function* functor_; 00025 00026 friend class vnl_powell_1dfun; 00027 void pub_report_eval(double e) { 00028 report_eval(e); 00029 } 00030 }; 00031 00032 #endif // vnl_powell_h_