PowellBrentOptimizer.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 "optimization/SimpleOptimizer.h"
  15. #include "optimization/BrentLineSearcher.h"
  16. /*!
  17. class for the PowellBrentOptimizer
  18. HowToUse:
  19. * use setParameters() to set the start point
  20. * you may use m_scales to regulate the inner search interval
  21. (set it to a vector with 1/x as elements to divide it by x);
  22. * call init()
  23. * call optimize()
  24. Implemented Abort criteria:
  25. * maximum number of iterations
  26. * time limit
  27. * parameter bounds
  28. * function value tolerance
  29. Additional return reason:
  30. */
  31. class PowellBrentOptimizer : public SimpleOptimizer
  32. {
  33. public:
  34. typedef SimpleOptimizer SuperClass;
  35. typedef SuperClass::matrix_type matrix_type;
  36. /*!
  37. Constructor.
  38. \param loger : OptLogBase * to existing log class
  39. */
  40. PowellBrentOptimizer(OptLogBase *loger=NULL);
  41. /*!
  42. Copy constructor
  43. \param opt .. optimizer to copy
  44. */
  45. PowellBrentOptimizer( const PowellBrentOptimizer &opt);
  46. /*!
  47. operator =
  48. */
  49. PowellBrentOptimizer & operator=(const PowellBrentOptimizer &opt);
  50. /*!
  51. Destructor.
  52. */
  53. ~PowellBrentOptimizer();
  54. ///
  55. /// enumeration for the return reasons of an optimizer,
  56. /// has all elements of the SuperClass optimizer
  57. ///
  58. enum { SUCCESS_NO_BETTER_POINT = _to_continue_,
  59. _to_continue_
  60. };
  61. /*!
  62. \brief Do internal initializations
  63. */
  64. void init();
  65. /*!
  66. \brief start the optmization
  67. */
  68. int optimize();
  69. /*!
  70. \brief set options for the internal line searcher
  71. */
  72. void setLineSearchOptions(double lower, double upper, double eps);
  73. private:
  74. /*!
  75. the direction set
  76. */
  77. matrix_type xi;
  78. /*!
  79. the brent line searcher
  80. */
  81. BrentLineSearcher m_lin;
  82. /*!
  83. parameter brent linesseracher
  84. */
  85. double m_lin_Lower;
  86. double m_lin_Upper;
  87. double m_lin_Eps;
  88. };
  89. #endif