bpp-core3  3.0.0
OneDimensionOptimizationTools.h
Go to the documentation of this file.
1 //
2 // File: OneDimensionOptimizationTools.h
3 // Authors:
4 // Julien Dutheil
5 // Created: 2003-11-17 11:15:22
6 //
7 
8 /*
9  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
10 
11  This software is a computer program whose purpose is to provide classes
12  for numerical calculus. This file is part of the Bio++ project.
13 
14  This software is governed by the CeCILL license under French law and
15  abiding by the rules of distribution of free software. You can use,
16  modify and/ or redistribute the software under the terms of the CeCILL
17  license as circulated by CEA, CNRS and INRIA at the following URL
18  "http://www.cecill.info".
19 
20  As a counterpart to the access to the source code and rights to copy,
21  modify and redistribute granted by the license, users are provided only
22  with a limited warranty and the software's author, the holder of the
23  economic rights, and the successive licensors have only limited
24  liability.
25 
26  In this respect, the user's attention is drawn to the risks associated
27  with loading, using, modifying and/or developing or reproducing the
28  software by the user in light of its specific status of free software,
29  that may mean that it is complicated to manipulate, and that also
30  therefore means that it is reserved for developers and experienced
31  professionals having in-depth computer knowledge. Users are therefore
32  encouraged to load and test the software's suitability as regards their
33  requirements in conditions enabling the security of their systems and/or
34  data to be ensured and, more generally, to use and operate it in the
35  same conditions as regards security.
36 
37  The fact that you are presently reading this means that you have had
38  knowledge of the CeCILL license and that you accept its terms.
39 */
40 
41 #ifndef BPP_NUMERIC_FUNCTION_ONEDIMENSIONOPTIMIZATIONTOOLS_H
42 #define BPP_NUMERIC_FUNCTION_ONEDIMENSIONOPTIMIZATIONTOOLS_H
43 
44 
45 #include "../../Io/OutputStream.h"
46 #include "DirectionFunction.h"
47 #include "Functions.h"
48 
49 namespace bpp
50 {
52 {
53 public:
54  double x;
55  double f;
56 
57 public:
58  // Constructor and destructor:
59  BracketPoint() : x(0),
60  f(0) {}
61  BracketPoint(double xval, double fval) : x(xval),
62  f(fval) {}
63  virtual ~BracketPoint() {}
64 
65 public:
66  void set(double x, double f);
67 };
68 
69 class Bracket
70 {
71 public:
72  // Constructor and destructor::
73  Bracket() : a(),
74  b(),
75  c() {}
76  virtual ~Bracket() {}
77 
78 public:
79  // Methods:
80  void setA(double xa, double fa);
81  void setB(double xb, double fb);
82  void setC(double xc, double fc);
83 
84 public:
86 };
87 
94 {
95 public:
98 
99 public:
114  static Bracket bracketMinimum(double a, double b, Function* function, ParameterList parameters);
115 
128  static Bracket inwardBracketMinimum(double a, double b, Function* function, ParameterList parameters, uint intervalsNum = 10);
129 
130 
131  static unsigned int lineMinimization(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, double tolerance, OutputStream* profiler = 0, OutputStream* messenger = 0, unsigned int verbose = 2);
132 
145  static unsigned int lineSearch(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, std::vector<double>& gradient, OutputStream* profiler = 0, OutputStream* messenger = 0, unsigned int verbose = 2);
146 
147 public:
151  static double GLIMIT;
152 };
153 } // end of namespace bpp.
154 #endif // BPP_NUMERIC_FUNCTION_ONEDIMENSIONOPTIMIZATIONTOOLS_H
void set(double x, double f)
BracketPoint(double xval, double fval)
void setA(double xa, double fa)
void setB(double xb, double fb)
void setC(double xc, double fc)
This is the function abstract class.
Definition: Functions.h:89
Tools of one parameter-functions optimizations.
static Bracket inwardBracketMinimum(double a, double b, Function *function, ParameterList parameters, uint intervalsNum=10)
Bracket a minimum by a search within thw parameter's bounds.
static Bracket bracketMinimum(double a, double b, Function *function, ParameterList parameters)
Bracket a minimum.
static unsigned int lineSearch(DirectionFunction &f1dim, ParameterList &parameters, std::vector< double > &xi, std::vector< double > &gradient, OutputStream *profiler=0, OutputStream *messenger=0, unsigned int verbose=2)
Search a 'sufficiently low' value for a function in a given direction.
static unsigned int lineMinimization(DirectionFunction &f1dim, ParameterList &parameters, std::vector< double > &xi, double tolerance, OutputStream *profiler=0, OutputStream *messenger=0, unsigned int verbose=2)
static double GLIMIT
Maximum magnification allowed for a parabolic-fit step.
OutputStream interface.
Definition: OutputStream.h:67
The parameter list object.
Definition: ParameterList.h:65