vnl_powell.h
Go to the documentation of this file.
1 // This is core/vnl/algo/vnl_powell.h
2 #ifndef vnl_powell_h_
3 #define vnl_powell_h_
4 //:
5 // \file
6 // \brief Powell minimizer.
7 // \author awf@robots.ox.ac.uk
8 // \date 05 Dec 00
9 //
10 // \verbatim
11 // Modifications
12 // 31 Oct 2008 - Hans Johnson - fixed errors caused by uninitialized var bx;
13 // (U. Iowa) use vnl_brent_minimizer instead of vnl_brent
14 // \endverbatim
15 
16 #include <vnl/vnl_cost_function.h>
18 #include <vnl/algo/vnl_algo_export.h>
19 
20 //: The ever-popular Powell minimizer.
21 // Derivative-free method which may be faster if your
22 // function is expensive to compute and many-dimensional.
23 // Implemented from scratch from NR.
24 class VNL_ALGO_EXPORT vnl_powell : public vnl_nonlinear_minimizer
25 {
26  public:
27 
28  //: Initialize a powell with the given cost function
30  : functor_(functor), linmin_xtol_(1e-4), initial_step_(1.0) {}
31 
32  //: Run minimization, place result in x.
33  ReturnCodes minimize(vnl_vector<double>& x);
34 
35  //: Set tolerance on line search parameter step
36  // Default value is 0.0001
37  void set_linmin_xtol(double tol) { linmin_xtol_ = tol; }
38 
39  //: Set initial step when bracketing minima along a line
40  // Default value is 1.0
41  void set_initial_step(double step) { initial_step_ = step; }
42 
43  protected:
45 
46  friend class vnl_powell_1dfun;
47  void pub_report_eval(double e) { report_eval(e); }
48 
49  //: Tolerance on line search parameter step
50  double linmin_xtol_;
51 
52  //: Initial step when bracketing minima along a line
53  double initial_step_;
54 };
55 
56 #endif // vnl_powell_h_
An object that represents a function from R^n -> R.
void set_initial_step(double step)
Set initial step when bracketing minima along a line.
Definition: vnl_powell.h:41
Vector->Real function.
vnl_nonlinear_minimizer is a base class for nonlinear optimization.
vnl_cost_function * functor_
Definition: vnl_powell.h:44
void set_linmin_xtol(double tol)
Set tolerance on line search parameter step.
Definition: vnl_powell.h:37
The ever-popular Powell minimizer.
Definition: vnl_powell.h:24
void report_eval(double f)
Called by derived classes after each function evaluation.
double linmin_xtol_
Tolerance on line search parameter step.
Definition: vnl_powell.h:50
Base class for nonlinear optimization.
double initial_step_
Initial step when bracketing minima along a line.
Definition: vnl_powell.h:53
void pub_report_eval(double e)
Definition: vnl_powell.h:47
vnl_powell(vnl_cost_function *functor)
Initialize a powell with the given cost function.
Definition: vnl_powell.h:29