GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GOptimizer.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GOptimizer.hpp - Abstract base class for optimizer *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2009-2014 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GOptimizer.hpp
23  * @brief Abstract optimizer abstract base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GOPTIMIZER_HPP
28 #define GOPTIMIZER_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GOptimizerPars.hpp"
34 #include "GOptimizerFunction.hpp"
35 
36 
37 /***********************************************************************//**
38  * @class GOptimizer
39  *
40  * @brief Abstract optimizer abstract base class
41  *
42  * This class defines the abstract interface for the optimizer class. The
43  * optimizer class is used to optimize the parameters of a function. The
44  * function is implemented using the abstract GOptimizerFunction class
45  * while the parameters are implemented using the abstract GOptimizerPars
46  * class.
47  *
48  * The main driver of this class is the optimize() method which optimizes
49  * the parameters using a function. The function value can be accessed
50  * using the value() method, the status() method provides an integer with
51  * status information, the iter() method gives the number of iterations for
52  * iterative optimization algorithms.
53  ***************************************************************************/
54 class GOptimizer : public GBase {
55 
56 public:
57  // Constructors and destructors
58  GOptimizer(void);
59  GOptimizer(const GOptimizer& opt);
60  virtual ~GOptimizer(void);
61 
62  // Operators
63  virtual GOptimizer& operator=(const GOptimizer& opt);
64 
65  // Pure virtual methods
66  virtual void clear(void) = 0;
67  virtual GOptimizer* clone(void) const = 0;
68  virtual std::string classname(void) const = 0;
69  virtual void optimize(GOptimizerFunction& fct, GOptimizerPars& pars) = 0;
70  virtual void errors(GOptimizerFunction& fct, GOptimizerPars& pars) = 0;
71  virtual double value(void) const = 0;
72  virtual int status(void) const = 0;
73  virtual int iter(void) const = 0;
74  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
75 
76 protected:
77  // Protected methods
78  void init_members(void);
79  void copy_members(const GOptimizer& opt);
80  void free_members(void);
81 };
82 
83 #endif /* GOPTIMIZER_HPP */
Optimizer function abstract base class.
virtual int status(void) const =0
Optimizer parameter container class.
Definition of interface for all GammaLib classes.
void copy_members(const GOptimizer &opt)
Copy class members.
Definition: GOptimizer.cpp:149
virtual GOptimizer & operator=(const GOptimizer &opt)
Assignment operator.
Definition: GOptimizer.cpp:101
virtual void clear(void)=0
Clear object.
virtual std::string classname(void) const =0
Return class name.
Optimizer function abstract base class.
virtual void optimize(GOptimizerFunction &fct, GOptimizerPars &pars)=0
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
Abstract optimizer abstract base class.
Definition: GOptimizer.hpp:54
virtual int iter(void) const =0
GChatter
Definition: GTypemaps.hpp:33
Optimizer parameters base class definition.
void init_members(void)
Initialise class members.
Definition: GOptimizer.cpp:137
virtual void errors(GOptimizerFunction &fct, GOptimizerPars &pars)=0
virtual double value(void) const =0
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual GOptimizer * clone(void) const =0
Clones object.
void free_members(void)
Delete class members.
Definition: GOptimizer.cpp:159
GOptimizer(void)
Constructor.
Definition: GOptimizer.cpp:48
virtual ~GOptimizer(void)
Destructor.
Definition: GOptimizer.cpp:79