////////////////////////////////////////////////////////////////////// // // GoldenCutLineSearcher.h: interface of the GoldenCutLineSearcher class. // // Written by: Matthias Wacker // ////////////////////////////////////////////////////////////////////// #ifndef _GOLDEN_CUT_LINE_SEARCHER_H_ #define _GOLDEN_CUT_LINE_SEARCHER_H_ #include "optimization/LineSearcher.h" namespace OPTIMIZATION { /*! class for the golden cut line search HowToUse: * use setX0() to set the offset * use setH0() to set the search direction * use setEps() to set the abort criterion * use setBounds() to set a different search bound for lambda than [0,10] * call init() * call optimize() (returns lambda) */ class GoldenCutLineSearcher : public LineSearcher { public: typedef LineSearcher SuperClass; typedef SuperClass::matrix_type matrix_type; /*! default constructor */ GoldenCutLineSearcher(); /*! constructor */ GoldenCutLineSearcher(CostFunction *costFunc, OptLogBase *loger); /*! Copy constructor \param opt .. optimizer to copy */ GoldenCutLineSearcher( const GoldenCutLineSearcher &lin); /*! operator = */ GoldenCutLineSearcher & operator=(const GoldenCutLineSearcher &lin); /*! Destructor. */ virtual ~GoldenCutLineSearcher(); /*! set the bound parameters */ bool setBounds(double c, double d); /*! set the abort threshold */ bool setEps(double eps); /*! optimize returns a double.. */ double optimize(); protected: /*! approximation of the golden cut ratio */ const double m_fac_a; // = 0.38196601125010515179541316563436; /*! approximation of the golden cut ratio */ const double m_fac_b; // = 0,61803398874989484820458683436564; /*! the bounds */ double m_c, m_d; /*! the abort criteria */ double m_eps; }; //class }//namespace #endif