ArmijoLineSearcher.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // ArmijoLineSearcher.h: interface of the AxA3dNUMArmijoLineSearcher class.
  4. //
  5. // Written by: Matthias Wacker
  6. //
  7. //////////////////////////////////////////////////////////////////////
  8. #ifndef _ARMIJO_LINE_SEARCHER_H_
  9. #define _ARMIJO_LINE_SEARCHER_H_
  10. #include <cmath>
  11. #include "LineSearcher.h"
  12. namespace OPTIMIZATION
  13. {
  14. /*!
  15. class for the brent line search
  16. HowToUse:
  17. * use setX0() to set the offset
  18. * use setH0() to set the search direction
  19. * use setGk() to set the gradient in x0
  20. * call init()
  21. * call optimize() (returns lambda)
  22. */
  23. class ArmijoLineSearcher : public LineSearcher
  24. {
  25. public:
  26. typedef LineSearcher SuperClass;
  27. typedef SuperClass::matrix_type matrix_type;
  28. /*!
  29. default constructor
  30. */
  31. ArmijoLineSearcher();
  32. /*!
  33. constructor
  34. */
  35. ArmijoLineSearcher(CostFunction *costFunc, OptLogBase *loger);
  36. /*!
  37. Copy constructor
  38. \param opt .. optimizer to copy
  39. */
  40. ArmijoLineSearcher( const ArmijoLineSearcher &lin);
  41. /*!
  42. operator =
  43. */
  44. ArmijoLineSearcher & operator=(const ArmijoLineSearcher &lin);
  45. /*!
  46. Destructor.
  47. */
  48. virtual ~ArmijoLineSearcher();
  49. /*!
  50. set Parameters
  51. @param gamma reduction Factor of step width test
  52. @param L divisor for computation of sk ( > 0 )
  53. @param sigma multiplicative parameter for test (0, 0.5)
  54. */
  55. void setGammaLSigma(double gamma, double L, double sigma);
  56. /*!
  57. local search setup
  58. @param xk start point
  59. @param gk gradient at xk
  60. @param dk descent direction from xk
  61. */
  62. void setXkGkDk(const matrix_type xk, const matrix_type gk, const matrix_type dk);
  63. /*!
  64. optimize
  65. returns a double..
  66. */
  67. double optimize();
  68. protected:
  69. //! an internal parameter
  70. double m_dGamma;
  71. //! an internal paramter
  72. double m_dL;
  73. //! an internal parameter
  74. double m_dSigma;
  75. //! gradient in xk
  76. matrix_type m_gk;
  77. //! iteration direction from xk
  78. matrix_type m_dk;
  79. };//class
  80. }//namespace
  81. #endif