NewtonMethodOptimizer.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // NewtonMethodOptimizer.cpp: Implementation of the NewtonMethodOptimizer
  4. // Optimizer class.
  5. //
  6. // Written by Matthias Wacker
  7. //
  8. //////////////////////////////////////////////////////////////////////
  9. #include "optimization/NewtonMethodOptimizer.h"
  10. using namespace OPTIMIZATION;
  11. NewtonMethodOptimizer::NewtonMethodOptimizer(OptLogBase *loger) : SuperClass(loger)
  12. {
  13. }
  14. NewtonMethodOptimizer::NewtonMethodOptimizer( const NewtonMethodOptimizer &opt) : SuperClass(opt)
  15. {
  16. }
  17. NewtonMethodOptimizer::~NewtonMethodOptimizer()
  18. {
  19. }
  20. void NewtonMethodOptimizer::init()
  21. {
  22. SuperClass::init();
  23. }
  24. void NewtonMethodOptimizer::updateIterationMatrix()
  25. {
  26. if(m_costFunction->hasAnalyticHessian() )
  27. {
  28. m_IterationMatrix = getAnalyticalHessian(m_parameters);
  29. }
  30. else
  31. {
  32. std::cerr << " NewtonMethodOptimizer::updateIterationMatrix() you cannot use this optimizer with the given costfunction" << std::endl;
  33. if(m_loger)
  34. m_loger->logError("NewtonMethodOptimizer::updateIterationMatrix you cannot use this optimizer with the given costfunction");
  35. assert(false);
  36. }
  37. }