PowellBrentOptimizer.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // AxA3dNUMPowellBrentOptimizer.h: interface of the AxA3dNUMPowellBrentOptimizer
  4. //
  5. // Powells Method - modified in a way, that it doesn't focus on having 100% conjugate
  6. // directions, but having one direction in "valley" direction.
  7. //
  8. // Written by: Matthias Wacker
  9. //
  10. //////////////////////////////////////////////////////////////////////
  11. #ifndef _POWELL_BRENT_OPTIMIZER_H_
  12. #define _POWELL_BRENT_OPTIMIZER_H_
  13. #include <cmath>
  14. #include "core/optimization/blackbox/SimpleOptimizer.h"
  15. #include "optimization/BrentLineSearcher.h"
  16. namespace OPTIMIZATION
  17. {
  18. /*!
  19. class for the PowellBrentOptimizer
  20. HowToUse:
  21. * use setParameters() to set the start point
  22. * you may use m_scales to regulate the inner search interval
  23. (set it to a vector with 1/x as elements to divide it by x);
  24. * call init()
  25. * call optimize()
  26. Implemented Abort criteria:
  27. * maximum number of iterations
  28. * time limit
  29. * parameter bounds
  30. * function value tolerance
  31. Additional return reason:
  32. */
  33. class PowellBrentOptimizer : public SimpleOptimizer
  34. {
  35. public:
  36. typedef SimpleOptimizer SuperClass;
  37. typedef SuperClass::matrix_type matrix_type;
  38. /*!
  39. Constructor.
  40. \param loger : OptLogBase * to existing log class
  41. */
  42. PowellBrentOptimizer(OptLogBase *loger=NULL);
  43. /*!
  44. Copy constructor
  45. \param opt .. optimizer to copy
  46. */
  47. PowellBrentOptimizer( const PowellBrentOptimizer &opt);
  48. /*!
  49. operator =
  50. */
  51. PowellBrentOptimizer & operator=(const PowellBrentOptimizer &opt);
  52. /*!
  53. Destructor.
  54. */
  55. ~PowellBrentOptimizer();
  56. ///
  57. /// enumeration for the return reasons of an optimizer,
  58. /// has all elements of the SuperClass optimizer
  59. ///
  60. enum { SUCCESS_NO_BETTER_POINT = _to_continue_,
  61. _to_continue_
  62. };
  63. /*!
  64. \brief Do internal initializations
  65. */
  66. void init();
  67. /*!
  68. \brief start the optmization
  69. */
  70. int optimize();
  71. /*!
  72. \brief set options for the internal line searcher
  73. */
  74. void setLineSearchOptions(double lower, double upper, double eps);
  75. private:
  76. /*!
  77. the direction set
  78. */
  79. matrix_type xi;
  80. /*!
  81. the brent line searcher
  82. */
  83. BrentLineSearcher m_lin;
  84. /*!
  85. parameter brent linesseracher
  86. */
  87. double m_lin_Lower;
  88. double m_lin_Upper;
  89. double m_lin_Eps;
  90. }; //class
  91. }//namespace
  92. #endif