queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
OptimizerMonitor.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2017 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_OPTIMIZER_MONITOR_H
26 #define UQ_OPTIMIZER_MONITOR_H
27 
28 #include <vector>
29 #include <iostream>
30 
31 namespace QUESO
32 {
33  class BaseEnvironment;
34 
37  {
38  public:
39 
41 
47  OptimizerMonitor( const BaseEnvironment& env, unsigned int n_iters = 100 );
48 
50 
52 
58  void set_display_output( bool enable_output, bool print_xmin );
59 
61  void append( std::vector<double>& x_min, double objective, double norm );
62 
64  void reset();
65 
67 
71  void print( std::ostream& output, bool print_xmin = false ) const;
72 
73  private:
74 
76 
79 
80  std::vector<std::vector<double> > m_minimizer_hist;
81  std::vector<double> m_objective_hist;
82  std::vector<double> m_norm_hist;
83 
84  void print_header( std::ostream& output, bool print_xmin ) const;
85  void print_iteration( unsigned int iter, std::ostream& output,
86  bool print_xmin ) const;
87 
88  };
89 
90 } // end namespace QUESO
91 
92 #endif // UQ_OPTIMIZER_MONITOR_H
void set_display_output(bool enable_output, bool print_xmin)
Enabling output to std::cout everytime append is called.
void print_header(std::ostream &output, bool print_xmin) const
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
std::vector< double > m_objective_hist
const BaseEnvironment & m_env
void print_iteration(unsigned int iter, std::ostream &output, bool print_xmin) const
void print(std::ostream &output, bool print_xmin=false) const
Prints entire convergence history.
OptimizerMonitor(const BaseEnvironment &env, unsigned int n_iters=100)
Constructor.
void reset()
Clears internal datastructures and resets display variables to false.
std::vector< std::vector< double > > m_minimizer_hist
void append(std::vector< double > &x_min, double objective, double norm)
Add current value of minimizer, objective, and error norm.
std::vector< double > m_norm_hist
Object to monitor convergence of optimizers.

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5