ReFRACtor
FullPhysics::ConnorConvergence Class Reference

This class tests for convergence of a Levenberg-Marquardt solver. More...

#include <connor_convergence.h>

+ Inheritance diagram for FullPhysics::ConnorConvergence:
+ Collaboration diagram for FullPhysics::ConnorConvergence:

Public Member Functions

 ConnorConvergence (const boost::shared_ptr< ForwardModel > &Fm, double Threshold, int Max_iteration, int Max_divergence, double Max_chisq)
 Constructor. More...
 
virtual ~ConnorConvergence ()
 
virtual void convergence_check (const FitStatistic &fit_stat_last, FitStatistic &fit_stat, bool &has_converged, bool &convergence_failed, double &gamma, bool &step_diverged)
 Check for the convergence of a Solver, or if we have taken a divergent step. More...
 
virtual void evaluate_quality (FitStatistic &fit_stat, const blitz::Array< double, 1 > &Residual, const blitz::Array< double, 1 > &Residual_cov_diag)
 Evaluates the quality of a converged fit from the residuals and expected residual error. More...
 
virtual void initialize_check ()
 Called before the first iteration, in case there is any setup. More...
 
int maximum_number_iteration () const
 
void maximum_number_iteration (int Max_iter)
 
virtual void print (std::ostream &Os) const
 Print description of object. More...
 
std::string print_to_string () const
 Print to string. More...
 

Detailed Description

This class tests for convergence of a Levenberg-Marquardt solver.

This is the convergence criteria developed by Brian Connor.

Definition at line 14 of file connor_convergence.h.

Constructor & Destructor Documentation

◆ ConnorConvergence()

ConnorConvergence::ConnorConvergence ( const boost::shared_ptr< ForwardModel > &  Fm,
double  Threshold,
int  Max_iteration,
int  Max_divergence,
double  Max_chisq 
)

Constructor.

Parameters
FmThe forward model used to divide the residuals into separate bands
ThresholdThe threshold used to test d_sigma_sq_scaled.
Max_iterationThe maximum number of iterations before we give up
Max_divergenceThe maximum number of divergent steps before we give up.
Max_chisqThe maximum chisq
Todo:
Replace fortran microwindow class with a C++ one.

Definition at line 28 of file connor_convergence.cc.

◆ ~ConnorConvergence()

virtual FullPhysics::ConnorConvergence::~ConnorConvergence ( )
inlinevirtual

Definition at line 19 of file connor_convergence.h.

Member Function Documentation

◆ convergence_check()

void ConnorConvergence::convergence_check ( const FitStatistic fit_stat_last,
FitStatistic fit_stat,
bool &  has_converged,
bool &  convergence_failed,
double &  gamma,
bool &  step_diverged 
)
virtual

Check for the convergence of a Solver, or if we have taken a divergent step.

We pass in data from both this iteration and the last. If this is the first iteration, then the last values can be any kind of garbage value that is convenient (e.g., an empty Array) - we don't look at the value.

Parameters
fit_stat_lastFitStatistic from the last iteration.
fit_statFitStatistic from this iteration. If we fail convergence, the class may update fit_stat.outcome with the reason for failing.
has_convergedOn exit, true if we have converged to a solution.
convergence_failedOn exit, true if we have failed to converge and solver should just give up (e.g., we've exceeded a maximum number of iterations.
gammaThe Levenberg-Marquardt gamma parameter. On input this is value used in this iteration, on exit this is possibly updated to a new value.
step_divergedOn exit, this is true if the last iteration took a divergent step. In that case, we also update gamma to its new value.

Implements FullPhysics::ConvergenceCheck.

Definition at line 45 of file connor_convergence.cc.

◆ evaluate_quality()

void ConnorConvergence::evaluate_quality ( FitStatistic fit_stat_last,
const blitz::Array< double, 1 > &  Residual,
const blitz::Array< double, 1 > &  Residual_cov_diag 
)
virtual

Evaluates the quality of a converged fit from the residuals and expected residual error.

Parameters
fit_stat_lastFitStatistic from the last iteration. An error should occur if fit_stat.fit_succeeded = False
ResidualThe residual fit from the solver.
Residual_cov_diagThe expected error for the fit data.

Implements FullPhysics::ConvergenceCheck.

Definition at line 103 of file connor_convergence.cc.

◆ initialize_check()

virtual void FullPhysics::ConvergenceCheck::initialize_check ( )
inlinevirtualinherited

Called before the first iteration, in case there is any setup.

The default here does nothing, but derived classes can override this to do whatever initialization is needed.

Definition at line 240 of file convergence_check.h.

◆ maximum_number_iteration() [1/2]

int FullPhysics::ConnorConvergence::maximum_number_iteration ( ) const
inline

Definition at line 31 of file connor_convergence.h.

◆ maximum_number_iteration() [2/2]

void FullPhysics::ConnorConvergence::maximum_number_iteration ( int  Max_iter)
inline

Definition at line 32 of file connor_convergence.h.

◆ print()

void ConnorConvergence::print ( std::ostream &  Os) const
virtual

Print description of object.

Reimplemented from FullPhysics::ConvergenceCheck.

Definition at line 135 of file connor_convergence.cc.

◆ print_to_string()

std::string FullPhysics::Printable< ConvergenceCheck >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.


The documentation for this class was generated from the following files:

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