ReFRACtor
connor_solver_map.h
Go to the documentation of this file.
1 #ifndef CONNOR_SOLVER_MAP_H
2 #define CONNOR_SOLVER_MAP_H
3 #include <nlls_solver.h>
5 #include <nlls_problem_scaled.h>
6 #include <max_a_posteriori.h>
7 #include <convergence_check.h>
8 #include <observer.h>
9 #include <blitz/array.h>
10 #include <boost/shared_ptr.hpp>
11 
12 namespace FullPhysics {
13 
14 /****************************************************************/
52 class ConnorSolverMAP : public NLLSSolver {
53 public:
54  //-----------------------------------------------------------------------
58  //-----------------------------------------------------------------------
60  const boost::shared_ptr<ConvergenceCheck>& Convergence_check,
61  int max_cost_function_calls,
62  bool vrbs = false,
63  double Gamma_initial = 0.0,
64  const std::string& Fname_test_data = "")
65  : NLLSSolver(NLLS_MAP, max_cost_function_calls, vrbs),
66  fname_test_data(Fname_test_data), convergence_check_(Convergence_check), gamma_initial(Gamma_initial),
67  map(NLLS_MAP->max_a_posteriori()) // for convenience
68  {}
69  virtual ~ConnorSolverMAP() {}
70 
71  void solve();
72 
73 
74 //-----------------------------------------------------------------------
76 //-----------------------------------------------------------------------
77 
78  double gamma_last_step() const
79  {return gamma_last_step_;}
80 
81 //-----------------------------------------------------------------------
83 //-----------------------------------------------------------------------
84 
86  { return convergence_check_; }
87 
88 //-----------------------------------------------------------------------
90 //-----------------------------------------------------------------------
91 
92  int number_iteration() const
93  {return fit_statistic().number_iteration; }
94 
95 //-----------------------------------------------------------------------
97 //-----------------------------------------------------------------------
98 
99  int number_divergent() const
100  {return fit_statistic().number_divergent; }
101 
102 //-----------------------------------------------------------------------
104 //-----------------------------------------------------------------------
105 
106  int outcome_flag() const
107  { return (int) fit_statistic().outcome; }
108 
109 //-----------------------------------------------------------------------
111 //-----------------------------------------------------------------------
112 
113 
114  blitz::Array<double, 1> x_update() const { return dx; }
115 
116 //-----------------------------------------------------------------------
118 //-----------------------------------------------------------------------
119 
120  virtual FitStatistic fit_statistic() const {return fstat; }
121 
122 
123  void print(std::ostream& Os) const { Os << "ConnorSolverMAP";}
124 
125  // These members are "protected" just so we get doxygen
126  // documentation on them (private members don't appear in the
127  // documentation in general).
128 protected:
129  void do_inversion();
130 
131  //-----------------------------------------------------------------------
134  //-----------------------------------------------------------------------
135  std::string fname_test_data;
136 
137 
138  //-----------------------------------------------------------------------
142  //-----------------------------------------------------------------------
143  double gamma;
144 
145  //-----------------------------------------------------------------------
147  //-----------------------------------------------------------------------
148 
150 
151  //-----------------------------------------------------------------------
153  //-----------------------------------------------------------------------
154 
156 
157 
158  //-----------------------------------------------------------------------
162  // This gets updated each iteration in "do_inversion".
163  //-----------------------------------------------------------------------
164 
165  blitz::Array<double, 1> dx;
166 
167 
168  //-----------------------------------------------------------------------
170  //-----------------------------------------------------------------------
171 
173 
174  //-----------------------------------------------------------------------
176  //-----------------------------------------------------------------------
178 
179  static double rcond;
180 
181 
184 
185 };
186 
187 
188 }
189 #endif
boost::shared_ptr< ConvergenceCheck > convergence_check_
The convergence check object.
double gamma_last_step() const
Levenberg-Marquardt parameter for last step we processed.
virtual FitStatistic fit_statistic() const
Return fit results for solution to last problem solved.
This class holds various parameters describing how good of a fit we have.
double gamma_last_step_
Stash gamma from last step we processed.
int outcome_flag() const
Outcome flag. This is an integer version of FitStatistic::OUTCOME.
double gamma_initial
Initial value of gamma.
The base class for the solvers of the Nonlinear-Least-Squares Problem.
Definition: nlls_solver.h:24
void do_inversion()
This does an inversion step.
std::string fname_test_data
If this isn&#39;t an empty string, save to this file in the first iteration.
double gamma
Levenberg-Marquardt parameter.
boost::shared_ptr< NLLSProblemScaled > scaled_p
void solve()
This solves the least squares problem starting at the initial guess.
int number_divergent
Number of divergent steps.
blitz::Array< double, 1 > x_update() const
Return the a priori of the last problem solved.
static double rcond
Factor to determine if we treat a singular factor as 0.
int number_divergent() const
Number of divergent steps for the last problem solved.
blitz::Array< double, 1 > dx
This is the update to , .
OUTCOME outcome
Flag indicating success of fit, or why fit wasn&#39;t succesful.
This solves a nonlinear least squares problem using Levenberg-Marquardt.
boost::shared_ptr< ConvergenceCheck > convergence_check() const
The convergence check object.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
void print(std::ostream &Os) const
Prints description of object.
FitStatistic fstat
Results from last fit step.
int number_iteration
Number of iterations.
int number_iteration() const
Number of iterations for the last problem solved.
const boost::shared_ptr< MaxAPosteriori > map
ConnorSolverMAP(const boost::shared_ptr< NLLSMaxAPosteriori > &NLLS_MAP, const boost::shared_ptr< ConvergenceCheck > &Convergence_check, int max_cost_function_calls, bool vrbs=false, double Gamma_initial=0.0, const std::string &Fname_test_data="")
and optionally an initial value for gamma.

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08