NewtonMethodOptimizer.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. NewtonMethodOptimizer::NewtonMethodOptimizer(OptLogBase *loger) : SuperClass(loger)
  11. {
  12. }
  13. NewtonMethodOptimizer::NewtonMethodOptimizer( const NewtonMethodOptimizer &opt) : SuperClass(opt)
  14. {
  15. }
  16. NewtonMethodOptimizer::~NewtonMethodOptimizer()
  17. {
  18. }
  19. void NewtonMethodOptimizer::init()
  20. {
  21. SuperClass::init();
  22. }
  23. void NewtonMethodOptimizer::updateIterationMatrix()
  24. {
  25. if(m_costFunction->hasAnalyticHessian() )
  26. {
  27. m_IterationMatrix = getAnalyticalHessian(m_parameters);
  28. }
  29. else
  30. {
  31. std::cerr << " NewtonMethodOptimizer::updateIterationMatrix() you cannot use this optimizer with the given costfunction" << std::endl;
  32. if(m_loger)
  33. m_loger->logError("NewtonMethodOptimizer::updateIterationMatrix you cannot use this optimizer with the given costfunction");
  34. assert(false);
  35. }
  36. }