Commit b61a685073919dd0c2aaacd5d278094ac83a0c89

Authored by knodlseder
1 parent 35a8b274

add max_boundary_hits() method and more bookkeeping arrays

Showing 1 changed file with 39 additions and 29 deletions
include/GOptimizerLM.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GOPTIMIZERLM_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <vector>
23 24 #include "GOptimizer.hpp"
24 25 #include "GOptimizerFunction.hpp"
25 26 #include "GModels.hpp"
... ... @@ -57,22 +58,25 @@ public:
57 58 GModels& operator() (GOptimizerFunction& fct, GModels& m);
58 59  
59 60 // Methods
60   - void max_iter(const int& n) { m_max_iter=n; return; }
61   - void max_stalls(const int& n) { m_max_stall=n; return; }
62   - void lambda_start(const double& val) { m_lambda_start=val; return; }
63   - void lambda_inc(const double& val) { m_lambda_inc=val; return; }
64   - void lambda_dec(const double& val) { m_lambda_dec=val; return; }
65   - void eps(const double& eps) { m_eps=eps; return; }
66   - int max_iter(void) const { return m_max_iter; }
67   - int max_stalls(void) const { return m_max_stall; }
68   - int status(void) const { return m_status; }
69   - int iter(void) const { return m_iter; }
70   - double lambda_start(void) const { return m_lambda_start; }
71   - double lambda_inc(void) const { return m_lambda_inc; }
72   - double lambda_dec(void) const { return m_lambda_dec; }
73   - double lambda(void) const { return m_lambda; }
74   - double eps(void) const { return m_eps; }
75   - double value(void) const { return m_value; }
  61 + void max_iter(const int& n) { m_max_iter=n; }
  62 + void max_stalls(const int& n) { m_max_stall=n; }
  63 + void max_boundary_hits(const int& n) { m_max_stall=n; }
  64 + void lambda_start(const double& val) { m_lambda_start=val; }
  65 + void lambda_inc(const double& val) { m_lambda_inc=val; }
  66 + void lambda_dec(const double& val) { m_lambda_dec=val; }
  67 + void eps(const double& eps) { m_eps=eps; }
  68 + int max_iter(void) const { return m_max_iter; }
  69 + int max_stalls(void) const { return m_max_stall; }
  70 + int max_boundary_hits(void) const { return m_max_hit; }
  71 + int status(void) const { return m_status; }
  72 + int iter(void) const { return m_iter; }
  73 + double lambda_start(void) const { return m_lambda_start; }
  74 + double lambda_inc(void) const { return m_lambda_inc; }
  75 + double lambda_dec(void) const { return m_lambda_dec; }
  76 + double lambda(void) const { return m_lambda; }
  77 + double eps(void) const { return m_eps; }
  78 + double value(void) const { return m_value; }
  79 + std::string print(void) const;
76 80  
77 81 protected:
78 82 // Protected methods
... ... @@ -85,19 +89,25 @@ protected:
85 89 double step_size(GVector* grad, GOptimizerPars* pars);
86 90  
87 91 // Protected data area
88   - double m_lambda_start; //!< Initial start value
89   - double m_lambda_inc; //!< Lambda increase
90   - double m_lambda_dec; //!< Lambda decrease
91   - double m_eps; //!< Absolute precision
92   - int m_max_iter; //!< Maximum number of iterations
93   - int m_max_stall; //!< Maximum number of stalls
94   - bool m_step_adjust; //!< Adjust step size to boundaries
95   - bool* m_hit_boundary; //!< Bookkeeping array for boundary hits
96   - double m_lambda; //!< Actual lambda
97   - double m_value; //!< Actual function value
98   - int m_status; //!< Fit status
99   - int m_iter; //!< Iteration
100   - GLog* m_logger; //!< Pointer to optional logger
  92 + int m_npars; //!< Number of parameters
  93 + int m_nfree; //!< Number of free parameters
  94 + double m_lambda_start; //!< Initial start value
  95 + double m_lambda_inc; //!< Lambda increase
  96 + double m_lambda_dec; //!< Lambda decrease
  97 + double m_eps; //!< Absolute precision
  98 + int m_max_iter; //!< Maximum number of iterations
  99 + int m_max_stall; //!< Maximum number of stalls
  100 + int m_max_hit; //!< Maximum number of successive hits
  101 + bool m_step_adjust; //!< Adjust step size to boundaries
  102 + std::vector<bool> m_hit_boundary; //!< Bookkeeping array for boundary hits
  103 + std::vector<int> m_hit_minimum; //!< Bookkeeping of successive minimum hits
  104 + std::vector<int> m_hit_maximum; //!< Bookkeeping of successive maximum hits
  105 + std::vector<bool> m_par_freeze; //!< Bookkeeping of parameter freeze
  106 + double m_lambda; //!< Actual lambda
  107 + double m_value; //!< Actual function value
  108 + int m_status; //!< Fit status
  109 + int m_iter; //!< Iteration
  110 + GLog* m_logger; //!< Pointer to optional logger
101 111  
102 112 };
103 113  
... ...