From 8fe6bf767655c5d009531f731abbfd991f6d35da Mon Sep 17 00:00:00 2001 From: TobiasEberharter Date: Sun, 4 Dec 2016 23:52:24 +0100 Subject: [PATCH 1/2] added initialization_1 and autocorrection signatures added the initialization_1 function and the autocorrection function that is beeing used within the initialization function. --- initialization.hpp | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/initialization.hpp b/initialization.hpp index ae170d2..992c1db 100644 --- a/initialization.hpp +++ b/initialization.hpp @@ -7,22 +7,40 @@ namespace initialization{ std::vector initialization_1(KusiakLayoutEvaluator &evaluator, WindScenario &wscenario); -} + /* initialization_1 -* -* This implementation does... -* 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: -* vector : this is a collection of all the different layouts -* that are produced. In other words -* this represents the population. -*/ + * + * 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: int width, int height, int turbines, int pop_size + * return: std::vector population + * + */ +std::vector initialization_1(WindScenario wscenario,int pop_size); + + +/* 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 &population + * double radius, int width, int height + * + * return: void + */ +void replace_violations(std::vector &population,WindScenario wscenario); +} std::vector initialization::initialization_1( KusiakLayoutEvaluator &evaluator, WindScenario &wscenario){ From 7285270a28016211220533bb5b552dcc12bfa75a Mon Sep 17 00:00:00 2001 From: TobiasEberharter Date: Mon, 5 Dec 2016 00:04:25 +0100 Subject: [PATCH 2/2] updated comments --- initialization.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/initialization.hpp b/initialization.hpp index 992c1db..09110da 100644 --- a/initialization.hpp +++ b/initialization.hpp @@ -18,7 +18,7 @@ namespace initialization{ * * !! srand(time(0)); needs to be in the main function !! * - * parameters: int width, int height, int turbines, int pop_size + * parameters: WindScenario wscenario, int pop_size * return: std::vector population * */ @@ -34,8 +34,8 @@ std::vector initialization_1(WindScenario wscenario,int pop_size); * * !! srand(time(0)); needs to be in the main function !! * - * parameters: std::vector &population - * double radius, int width, int height + * parameters: std::vector &population, + * WindScenario wscenario * * return: void */