Unfit  3.1.1
Data fitting and optimization software
DifferentialEvolution.hpp
1 // Unfit: Data fitting and optimization software
2 //
3 // Copyright (C) 2012- Dr Martin Buist & Dr Alberto Corrias
4 // Contacts: martin.buist _at_ nus.edu.sg; alberto _at_ nus.edu.sg
5 //
6 // See the 'Contributors' file for a list of those who have contributed
7 // to this work.
8 //
9 // This program is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 //
22 #ifndef UNFIT_INCLUDE_DIFFERENTIALEVOLUTION_HPP_
23 #define UNFIT_INCLUDE_DIFFERENTIALEVOLUTION_HPP_
24 
25 #include <vector>
26 #include "GenericCostFunction.hpp"
27 #include "GenericOptimizer.hpp"
28 
29 namespace Unfit
30 {
45 {
48  public:
53 
59  virtual ~DifferentialEvolution();
60 
93  int FindMin(GenericCostFunction &CostFunction,
94  std::vector<double> &coordinates);
95 
100  void Reset();
101 
102  private:
113  std::vector<double> NewPopulationMember(GenericCostFunction &CostFunction,
114  unsigned member);
115 
145  std::vector<double> GenerateTrialMember(unsigned i);
146 
157  int ProcessFindMin(GenericCostFunction &CostFunction);
158 
160  std::vector<std::vector<double>> new_population_;
162  std::vector<double> best_member_;
164  unsigned dimensions_;
166  unsigned cost_;
167 };
168 
169 } // namespace Unfit
170 
171 #endif
void Reset()
Definition: DifferentialEvolution.cpp:42
std::vector< double > best_member_
Definition: DifferentialEvolution.hpp:162
std::vector< double > GenerateTrialMember(unsigned i)
Definition: DifferentialEvolution.cpp:178
Definition: GenericOptimizer.hpp:41
Definition: Bounds.hpp:27
std::vector< double > NewPopulationMember(GenericCostFunction &CostFunction, unsigned member)
Definition: DifferentialEvolution.cpp:162
unsigned cost_
Definition: DifferentialEvolution.hpp:166
unsigned dimensions_
Definition: DifferentialEvolution.hpp:164
Definition: GenericCostFunction.hpp:36
int FindMin(GenericCostFunction &CostFunction, std::vector< double > &coordinates)
A method to find the minimum of a model/function using a Differential Evolution approach.
Definition: DifferentialEvolution.cpp:51
friend class TestDifferentialEvolution
Definition: DifferentialEvolution.hpp:47
DifferentialEvolution()
Definition: DifferentialEvolution.cpp:33
int ProcessFindMin(GenericCostFunction &CostFunction)
Definition: DifferentialEvolution.cpp:118
std::vector< std::vector< double > > new_population_
Definition: DifferentialEvolution.hpp:160
A class to implement the Differential Evolution optimization method.
Definition: DifferentialEvolution.hpp:44