queso-0.53.0
|
Object to monitor convergence of optimizers. More...
#include <OptimizerMonitor.h>
Public Member Functions | |
OptimizerMonitor (const BaseEnvironment &env, unsigned int n_iters=100) | |
Constructor. More... | |
~OptimizerMonitor () | |
void | set_display_output (bool enable_output, bool print_xmin) |
Enabling output to std::cout everytime append is called. More... | |
void | append (std::vector< double > &x_min, double objective, double norm) |
Add current value of minimizer, objective, and error norm. More... | |
void | reset () |
Clears internal datastructures and resets display variables to false. More... | |
void | print (std::ostream &output, bool print_xmin=false) const |
Prints entire convergence history. More... | |
Private Member Functions | |
void | print_header (std::ostream &output, bool print_xmin) const |
void | print_iteration (unsigned int iter, std::ostream &output, bool print_xmin) const |
Private Attributes | |
const BaseEnvironment & | m_env |
bool | m_display_conv |
bool | m_print_xmin |
std::vector< std::vector < double > > | m_minimizer_hist |
std::vector< double > | m_objective_hist |
std::vector< double > | m_norm_hist |
Object to monitor convergence of optimizers.
Definition at line 36 of file OptimizerMonitor.h.
QUESO::OptimizerMonitor::OptimizerMonitor | ( | const BaseEnvironment & | env, |
unsigned int | n_iters = 100 |
||
) |
Constructor.
Input paramter n_iters will reserve space for monitor data for n_iters. This is for efficiency - if the number of iterations goes beyond n_iters, there will not be an error, just less performance by the monitor. Defaults to reserving space for 100 iterations
Definition at line 34 of file OptimizerMonitor.C.
References m_minimizer_hist, m_norm_hist, and m_objective_hist.
QUESO::OptimizerMonitor::~OptimizerMonitor | ( | ) |
Definition at line 44 of file OptimizerMonitor.C.
void QUESO::OptimizerMonitor::append | ( | std::vector< double > & | x_min, |
double | objective, | ||
double | norm | ||
) |
Add current value of minimizer, objective, and error norm.
Definition at line 53 of file OptimizerMonitor.C.
References m_display_conv, m_minimizer_hist, m_norm_hist, m_objective_hist, m_print_xmin, print_header(), and print_iteration().
Referenced by QUESO::GslOptimizer::minimize_no_gradient(), and QUESO::GslOptimizer::minimize_with_gradient().
void QUESO::OptimizerMonitor::print | ( | std::ostream & | output, |
bool | print_xmin = false |
||
) | const |
Prints entire convergence history.
The print_xmin argument controls whether or not the estimate of the minimizer (all components) is printed.
Definition at line 147 of file OptimizerMonitor.C.
References m_norm_hist, print_header(), print_iteration(), and queso_error.
|
private |
Definition at line 76 of file OptimizerMonitor.C.
References QUESO::BaseEnvironment::fullRank(), m_env, and m_minimizer_hist.
Referenced by append(), and print().
|
private |
Definition at line 106 of file OptimizerMonitor.C.
References QUESO::BaseEnvironment::fullRank(), m_env, m_minimizer_hist, m_norm_hist, and m_objective_hist.
Referenced by append(), and print().
void QUESO::OptimizerMonitor::reset | ( | ) |
Clears internal datastructures and resets display variables to false.
Definition at line 137 of file OptimizerMonitor.C.
References m_display_conv, m_minimizer_hist, m_norm_hist, m_objective_hist, and m_print_xmin.
void QUESO::OptimizerMonitor::set_display_output | ( | bool | enable_output, |
bool | print_xmin | ||
) |
Enabling output to std::cout everytime append is called.
Helpful when wanting to monitor convergence progress in real time. The print_xmin argument controls whether or not the current estimate of the minimizer is printed. Not recommended if you have more than a handful of dimensions over which you are optimizing.
Definition at line 47 of file OptimizerMonitor.C.
References m_display_conv, and m_print_xmin.
|
private |
Definition at line 77 of file OptimizerMonitor.h.
Referenced by append(), reset(), and set_display_output().
|
private |
Definition at line 75 of file OptimizerMonitor.h.
Referenced by print_header(), and print_iteration().
|
private |
Definition at line 80 of file OptimizerMonitor.h.
Referenced by append(), OptimizerMonitor(), print_header(), print_iteration(), and reset().
|
private |
Definition at line 82 of file OptimizerMonitor.h.
Referenced by append(), OptimizerMonitor(), print(), print_iteration(), and reset().
|
private |
Definition at line 81 of file OptimizerMonitor.h.
Referenced by append(), OptimizerMonitor(), print_iteration(), and reset().
|
private |
Definition at line 78 of file OptimizerMonitor.h.
Referenced by append(), reset(), and set_display_output().