-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenetics.h
48 lines (31 loc) · 910 Bytes
/
Genetics.h
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
//
// Created by bruno on 12/03/2019.
//
#ifndef GENETICALGORITHM_GENETICS_H
#define GENETICALGORITHM_GENETICS_H
#include "Individual.h"
#include <fstream>
class Genetics {
std::vector<Individual*> populationCurrent;
std::vector<Individual*> populationNew;
int degree;
std::vector<std::vector<double>> positive;
std::vector<std::vector<double>> negative;
public:
Genetics(int degree);
int initializePopulation();
void evaluatePopulation();
void mutation(int index);
void crossOver(int indexA, int indexB);
void orderElite(int cont);
int selectElite();
void selection(int index);
int tournament();
void readInputFile(const char * inputFile);
void overwriteCurrent();
void printCurrentPopulation();
void printNewPopulation();
void printDataSet();
void printBestIndividual();
};
#endif //GENETICALGORITHM_GENETICS_H