GoldenCutLineSearcher.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // GoldenCutLineSearcher.h: interface of the GoldenCutLineSearcher class.
  4. //
  5. // Written by: Matthias Wacker
  6. //
  7. //////////////////////////////////////////////////////////////////////
  8. #ifndef _GOLDEN_CUT_LINE_SEARCHER_H_
  9. #define _GOLDEN_CUT_LINE_SEARCHER_H_
  10. #include "optimization/LineSearcher.h"
  11. namespace OPTIMIZATION
  12. {
  13. /*!
  14. class for the golden cut line search
  15. HowToUse:
  16. * use setX0() to set the offset
  17. * use setH0() to set the search direction
  18. * use setEps() to set the abort criterion
  19. * use setBounds() to set a different search bound for lambda than [0,10]
  20. * call init()
  21. * call optimize() (returns lambda)
  22. */
  23. class GoldenCutLineSearcher : public LineSearcher
  24. {
  25. public:
  26. typedef LineSearcher SuperClass;
  27. typedef SuperClass::matrix_type matrix_type;
  28. /*!
  29. default constructor
  30. */
  31. GoldenCutLineSearcher();
  32. /*!
  33. constructor
  34. */
  35. GoldenCutLineSearcher(CostFunction *costFunc, OptLogBase *loger);
  36. /*!
  37. Copy constructor
  38. \param opt .. optimizer to copy
  39. */
  40. GoldenCutLineSearcher( const GoldenCutLineSearcher &lin);
  41. /*!
  42. operator =
  43. */
  44. GoldenCutLineSearcher & operator=(const GoldenCutLineSearcher &lin);
  45. /*!
  46. Destructor.
  47. */
  48. virtual ~GoldenCutLineSearcher();
  49. /*!
  50. set the bound parameters
  51. */
  52. bool setBounds(double c, double d);
  53. /*!
  54. set the abort threshold
  55. */
  56. bool setEps(double eps);
  57. /*!
  58. optimize
  59. returns a double..
  60. */
  61. double optimize();
  62. protected:
  63. /*!
  64. approximation of the golden cut ratio
  65. */
  66. const double m_fac_a; // = 0.38196601125010515179541316563436;
  67. /*!
  68. approximation of the golden cut ratio
  69. */
  70. const double m_fac_b; // = 0,61803398874989484820458683436564;
  71. /*!
  72. the bounds
  73. */
  74. double m_c, m_d;
  75. /*!
  76. the abort criteria
  77. */
  78. double m_eps;
  79. }; //class
  80. }//namespace
  81. #endif