ArmijoLineSearcher.h 1.9 KB

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