CSMOn
Convergence Stabilization Modeling operating in Online mode
CSMOn.hpp
1 /*
2  * Copyright (c) 2017, Peter Frank Perroni (pfperroni@gmail.com)
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * Additionally, if used for any scientific purpose, the following reference
15  * must be cited:
16  *
17  * Peter Frank Perroni, Daniel Weingaertner, and Myriam Regattieri Delgado.
18  * 2017. Estimating Stop Conditions of Swarm Based Stochastic Metaheuristic
19  * Algorithms. In Proceedings of GECCO '17, Berlin, Germany, July 15-19, 2017,
20  * pg 43-50. DOI: http://dx.doi.org/10.1145/3071178.3071326
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28  * THE SOFTWARE.
29  */
30 
46 #ifndef CSMON_HPP_
47 #define CSMON_HPP_
48 
49 #include <vector>
50 #include <cmath>
51 #include "ISearch.hpp"
52 
53 using namespace std;
54 
61 typedef struct _point{
62  int x;
63  double y;
64  _point(int _x, double _y){
65  x = _x, y = _y;
66  }
67 }t_point;
68 
75 class CSMOn{
76  ISearch *search;
77  bool autoRelaxation;
78  int M, s;
79  double R, minEstimatedFit;
80  vector<t_point> gb;
81 
82  double decayE();
83  double decayL();
84  double alphaE(int p1, int p2);
85  double alphaP(int p1, int p2);
86 
87 public:
88  CSMOn(ISearch *search, int M, double R, double minEstimatedFit);
89  virtual ~CSMOn();
90  void run();
91  void getBest(int nBest);
92  int adjustExp(double r);
93  int adjustLog(double r, int pT);
94  int getNEvals();
95  double getFitness();
96  int getBestPos(double *x);
97 
98 };
99 
100 #endif /* CSMON_HPP_ */
Convergence Stabilization Modeling operating in Online Mode.
Definition: CSMOn.hpp:75
A point representing the number of evaluations and the respective fitness value.
Definition: CSMOn.hpp:61
The interface that the search methods must to implement.
Definition: ISearch.hpp:40
void search(char *method, Param *inParam, Param *outParam, double *outPos, callback_t fitnessFunction)
The wrapper function for Python calls.