////////////////////////////////////////////////////////////////////// // // LineSearcher.h: interface of the LineSearcher class. // // Written by: Matthias Wacker // ////////////////////////////////////////////////////////////////////// #ifndef _LINE_SEARCHER_H_ #define _LINE_SEARCHER_H_ #include "optimization/CostFunction.h" #include "optimization/OptLogBase.h" #include "optimization/Opt_Namespace.h" #include "optimization/InequalityConstraints.h" #include "optimization/EqualityConstraints.h" /*! Abstract base class of all line search optimizer. */ class LineSearcher { public: typedef optimization::matrix_type matrix_type; /*! default constructor */ LineSearcher(); /*! constructor */ LineSearcher(CostFunction *costFunc, OptLogBase *loger); /*! Copy constructor \param opt .. optimizer to copy */ LineSearcher( const LineSearcher &lin); /*! operator = */ LineSearcher & operator=(const LineSearcher &lin); /*! Destructor. */ virtual ~LineSearcher(); /*! search maximum? */ inline void setMaximize(bool maximize){m_maximize = maximize;}; /*! set x0 */ bool setX0(const matrix_type & x0); /*! set a direction */ bool setH0(const matrix_type & H0); /*! optimize returns a double.. */ virtual double optimize() = 0; /*! set Constraints for penalty terms \returns true in case of success */ bool setConstraints(InequalityConstraints *ineq,EqualityConstraints *eq); /*! evaluate penalized 1d function */ double evaluateSub(double lambda); /*! penalty parameter */ bool setPP(double pp); /*! set vebose to true to get more information */ inline void setVerbose(bool verb){m_verbose = verb;}; protected: /*! maximization? */ bool m_maximize; /*! the costfunction */ CostFunction *m_pFunc; /*! number of Inequality Constraints */ unsigned int m_numIneq; /*! Inequality Constraints */ InequalityConstraints *m_pIneq; /*! number of Equality Constraints */ unsigned int m_numEq; /*! Equality Constraints */ EqualityConstraints *m_pEq; /* penalty parameter */ double m_PP; /*! Point to a loger */ OptLogBase *m_pLoger; /*! verbose? */ bool m_verbose; }; #endif