-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreplacement.hpp
50 lines (45 loc) · 1.74 KB
/
replacement.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* replacement.hpp
*
* This namespace has all of the different implementations of the population
* replacement of the evolutionary algorithm.
*/
#ifndef BBO_REPLACEMENT_HPP
#define BBO_REPLACEMENT_HPP
#include "structures.hpp"
namespace replacement {
/* replacement_1
*
* This implementation does a survivor selection mechanism, in which the most
* fitted members ar eselected, as well as some others randomly, to prevent
* the local optimum problem
*
* params:
* const vector<individual> &old : a reference of the current
* population.
* const vector<individual> &children : a reference of the children created
* in the current iteration
* int num_population : The population number, which is the number of layouts or
* individuals we are going to have per generation
*
* returns:
* vector<individual> : this is a new population created from both of the
* parameters received
*/
std::vector<individual> replacement_1(std::vector<individual> &old,
std::vector<individual> &children,
int num_population);
/* replacement::age_based
*
* implements age-based replacement, aka just population = children
*
* params:
* old - the old population, will be discarded
* children - the children, will make up the new population
*
* returns:
* the new population
*/
std::vector<individual> age_based(std::vector<individual>& old,
std::vector<individual>& children);
}
#endif