GoldenCutLineSearcher.h 1.8 KB

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