-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitialization.hpp
109 lines (96 loc) · 3.92 KB
/
initialization.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* initialization.hpp
*
* This namespace will have all of the different implementations of the population
* initialization of the evolutionary algorithm.
*/
#ifndef BBO_INITIALIZATION_HPP
#define BBO_INITIALIZATION_HPP
#include "API/WindFarmLayoutEvaluator.h"
#include "API/Matrix.hpp"
#include "functions.hpp"
#include "structures.hpp"
#include "scenario.hpp"
namespace initialization {
/* initialization_1
*
* This function takes the relevant layout data as parameter and produces
* a population / vector of those turbine layouts.
* The returned layouts are completely random based and
* will be corrected by the "replaceviolations" function
*
* !! srand(time(0)); needs to be in the main function !!
*
* parameters: WindScenario wscenario, int pop_size
* return: std::vector<individual> population
*
*/
std::vector<individual> initialization_1(WindFarmLayoutEvaluator &evaluator,
Scenario &scenario,
int pop_size);
/* initialization_2
*
* This implementation initializes the population for the current generation
* params:
* KusiakLayoutEvaluator &evaluator : a reference of the evaluator variable
* used in the main program.
* WindScenario &wscenario : a reference of the wind scenario variable
* used in the main program.
* 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 collection of all the different layouts
* that are produced. In other words
* this represents the population.
*/
std::vector<individual> initialization_2(WindFarmLayoutEvaluator &evaluator,
Scenario &scenario,
int num_population);
/* replace_violations
*
* This functions takes a population reference and the layout
* constraints as parameters, and automatically corrects
* all turbine positions within the given population by new
* random positions. No return value.
*
* !! srand(time(0)); needs to be in the main function !!
*
* parameters: std::vector<individual> &population
* WindScenario wscenario
*
* return: void
*/
void replace_violations(std::vector<individual> &population, Scenario &scenario);
/* evaluate_population
*
* This functions takes the population and the evaluator
* as parameter, casts the population's individuals
* to matrixes and evaluates them, storing the new fitnesses
* in the population structures, no return value;
*
* parameters: std::vector<individual> &population, WindScenario &wscenario
*
* return: void
*
*/
void evaluate_population(WindFarmLayoutEvaluator &evaluator,
std::vector<individual> &population);
/* create_individual_2
*
* This implementation initializes creates an individual, which is used in
* initialization_2. It creates a layout with random coordinates, using
* the std::uniform_real_distribution to generate them.
*
* params:
* KusiakLayoutEvaluator &evaluator : a reference of the evaluator variable
* used in the main program.
* WindScenario &wscenario : a reference of the wind scenario variable
* used in the main program.
*
* returns:
* struct individual : this is the individual created
*/
individual create_individual_2(WindFarmLayoutEvaluator &evaluator,
Scenario &scenario);
}
#endif