Commit bacfbb76c884688ced82c2a2696855e6925d6571

Authored by Jürgen Knödlseder
1 parent 536dbc0e

Remove optimization operators and introduce optimize method.

The optimization operators have been removed and been replaced by the optimize() method. This method does not return any argument. Instead, it directly manipulates the parameters that are passed as arguments.
include/GOptimizer.hpp
1 1 /***************************************************************************
2   - * GOptimizer.hpp - Abstract base class for optimizer *
  2 + * GOptimizer.hpp - Abstract base class for optimizer *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2012 by Juergen Knoedlseder *
  4 + * copyright (C) 2009-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,7 +20,7 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GOptimizer.hpp
23   - * @brief Optimizer abstract base class interface definition.
  23 + * @brief Abstract optimizer abstract base class interface definition
24 24 * @author Juergen Knoedlseder
25 25 */
26 26  
... ... @@ -32,15 +32,24 @@
32 32 #include "GBase.hpp"
33 33 #include "GOptimizerPars.hpp"
34 34 #include "GOptimizerFunction.hpp"
35   -#include "GModels.hpp"
36 35  
37 36  
38 37 /***********************************************************************//**
39 38 * @class GOptimizer
40 39 *
41   - * @brief Optimizer abstract base class interface defintion
  40 + * @brief Abstract optimizer abstract base class
42 41 *
43   - * This class defines the abstract interface for the optimizer class.
  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.
44 53 ***************************************************************************/
45 54 class GOptimizer : public GBase {
46 55  
... ... @@ -51,19 +60,16 @@ public:
51 60 virtual ~GOptimizer(void);
52 61  
53 62 // Operators
54   - virtual GOptimizer& operator= (const GOptimizer& opt);
55   - virtual GOptimizerPars& operator() (GOptimizerFunction& fct, GOptimizerPars& p) = 0;
56   - virtual GModels& operator() (GOptimizerFunction& fct, GModels& m) = 0;
  63 + virtual GOptimizer& operator=(const GOptimizer& opt);
57 64  
58 65 // Pure virtual methods
59 66 virtual void clear(void) = 0;
60 67 virtual GOptimizer* clone(void) const = 0;
  68 + virtual void optimize(GOptimizerFunction& fct, GOptimizerPars& pars) = 0;
61 69 virtual double value(void) const = 0;
62 70 virtual int status(void) const = 0;
63 71 virtual int iter(void) const = 0;
64 72 virtual std::string print(void) const = 0;
65   -
66   - // Implemented methods
67 73  
68 74 protected:
69 75 // Protected methods
... ...
pyext/GOptimizer.i
1 1 /***************************************************************************
2   - * GOptimizer.i - Optimizer class Python interface *
  2 + * GOptimizer.i - Abstract base class for optimizer *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2012 by Juergen Knoedlseder *
  4 + * copyright (C) 2009-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,7 +20,7 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GOptimizer.i
23   - * @brief Optimizer abstract base class Python interface
  23 + * @brief Abstract optimizer abstract base class interface definition
24 24 * @author Juergen Knoedlseder
25 25 */
26 26 %{
... ... @@ -33,9 +33,7 @@
33 33 /***********************************************************************//**
34 34 * @class GOptimizer
35 35 *
36   - * @brief Optimizer base class Python interface defintion
37   - *
38   - * This class defines the abstract interface for the optimizer class.
  36 + * @brief Abstract optimizer abstract base class
39 37 ***************************************************************************/
40 38 class GOptimizer : public GBase {
41 39  
... ... @@ -48,6 +46,7 @@ public:
48 46 // Pure virtual methods
49 47 virtual void clear(void) = 0;
50 48 virtual GOptimizer* clone(void) const = 0;
  49 + virtual void optimize(GOptimizerFunction& fct, GOptimizerPars& pars) = 0;
51 50 virtual double value(void) const = 0;
52 51 virtual int status(void) const = 0;
53 52 virtual int iter(void) const = 0;
... ...
src/opt/GOptimizer.cpp
1 1 /***************************************************************************
2   - * GOptimizer.cpp - Abstract base class for optimizer *
  2 + * GOptimizer.cpp - Abstract base class for optimizer *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2012 by Juergen Knoedlseder *
  4 + * copyright (C) 2009-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,7 +20,7 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GOptimizer.cpp
23   - * @brief GOptimizer abstract base class implementation.
  23 + * @brief Abstract optimizer abstract base class interface implementation
24 24 * @author Juergen Knoedlseder
25 25 */
26 26  
... ... @@ -96,6 +96,7 @@ GOptimizer::~GOptimizer()
96 96 * @brief Assignment operator
97 97 *
98 98 * @param[in] opt Optimizer.
  99 + * @return Optimizer.
99 100 ***************************************************************************/
100 101 GOptimizer& GOptimizer::operator= (const GOptimizer& opt)
101 102 {
... ...