GammaLib 2.0.0
Loading...
Searching...
No Matches
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"
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 ***************************************************************************/
54class GOptimizer : public GBase {
55
56public:
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
76protected:
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 */
Definition of interface for all GammaLib classes.
Optimizer function abstract base class.
Optimizer parameters base class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Optimizer function abstract base class.
Optimizer parameter container class.
Abstract optimizer abstract base class.
virtual void optimize(GOptimizerFunction &fct, GOptimizerPars &pars)=0
virtual GOptimizer * clone(void) const =0
Clones object.
virtual void errors(GOptimizerFunction &fct, GOptimizerPars &pars)=0
virtual std::string classname(void) const =0
Return class name.
void free_members(void)
Delete class members.
GOptimizer(void)
Constructor.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual int iter(void) const =0
virtual double value(void) const =0
virtual void clear(void)=0
Clear object.
virtual int status(void) const =0
void copy_members(const GOptimizer &opt)
Copy class members.
virtual GOptimizer & operator=(const GOptimizer &opt)
Assignment operator.
void init_members(void)
Initialise class members.
virtual ~GOptimizer(void)
Destructor.