LineSearcher.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // LineSearcher.h: interface of the LineSearcher class.
  4. //
  5. // Written by: Matthias Wacker
  6. //
  7. //////////////////////////////////////////////////////////////////////
  8. #ifndef _LINE_SEARCHER_H_
  9. #define _LINE_SEARCHER_H_
  10. #include "core/optimization/blackbox/CostFunction.h"
  11. #include "core/optimization/blackbox/OptLogBase.h"
  12. #include "core/optimization/blackbox/Definitions_core_opt.h"
  13. #include "optimization/InequalityConstraints.h"
  14. #include "optimization/EqualityConstraints.h"
  15. namespace OPTIMIZATION
  16. {
  17. /*!
  18. Abstract base class of all line search optimizer.
  19. */
  20. class LineSearcher
  21. {
  22. public:
  23. typedef OPTIMIZATION::matrix_type matrix_type;
  24. /*!
  25. default constructor
  26. */
  27. LineSearcher();
  28. /*!
  29. constructor
  30. */
  31. LineSearcher(CostFunction *costFunc, OptLogBase *loger);
  32. /*!
  33. Copy constructor
  34. \param opt .. optimizer to copy
  35. */
  36. LineSearcher( const LineSearcher &lin);
  37. /*!
  38. operator =
  39. */
  40. LineSearcher & operator=(const LineSearcher &lin);
  41. /*!
  42. Destructor.
  43. */
  44. virtual ~LineSearcher();
  45. /*!
  46. search maximum?
  47. */
  48. inline void setMaximize(bool maximize){m_maximize = maximize;};
  49. /*!
  50. set x0
  51. */
  52. bool setX0(const matrix_type & x0);
  53. /*!
  54. set a direction
  55. */
  56. bool setH0(const matrix_type & H0);
  57. /*!
  58. optimize
  59. returns a double..
  60. */
  61. virtual double optimize() = 0;
  62. /*!
  63. set Constraints for penalty terms
  64. \returns true in case of success
  65. */
  66. bool setConstraints(InequalityConstraints *ineq,EqualityConstraints *eq);
  67. /*!
  68. evaluate penalized 1d function
  69. */
  70. double evaluateSub(double lambda);
  71. /*!
  72. penalty parameter
  73. */
  74. bool setPP(double pp);
  75. /*!
  76. set vebose to true to get more information
  77. */
  78. inline void setVerbose(bool verb){m_verbose = verb;};
  79. protected:
  80. /*!
  81. maximization?
  82. */
  83. bool m_maximize;
  84. /*!
  85. the costfunction
  86. */
  87. CostFunction *m_pFunc;
  88. /*!
  89. number of Inequality Constraints
  90. */
  91. unsigned int m_numIneq;
  92. /*!
  93. Inequality Constraints
  94. */
  95. InequalityConstraints *m_pIneq;
  96. /*!
  97. number of Equality Constraints
  98. */
  99. unsigned int m_numEq;
  100. /*!
  101. Equality Constraints
  102. */
  103. EqualityConstraints *m_pEq;
  104. /*
  105. penalty parameter
  106. */
  107. double m_PP;
  108. /*!
  109. Point to a loger
  110. */
  111. OptLogBase *m_pLoger;
  112. /*!
  113. verbose?
  114. */
  115. bool m_verbose;
  116. };//class
  117. }//namespace
  118. #endif