-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulation.cpp
More file actions
91 lines (69 loc) · 3.21 KB
/
population.cpp
File metadata and controls
91 lines (69 loc) · 3.21 KB
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
#include "population.h"
//#include "debug.h"
/******************************************************************************/
/******************************************************************************/
CPopulation::CPopulation() : m_nGenerationRandomSeed(0),
m_unNumberOfElites(1),
m_unNumberOfCrossovers(1),
m_unCrossoverDistance(1),
m_fMutationRate(0.1),
m_fCrossoverRate(0.0)
{
}
/******************************************************************************/
/******************************************************************************/
CPopulation::~CPopulation()
{
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetGenerationRandomSeed(int seed)
{
m_nGenerationRandomSeed = seed;
}
/******************************************************************************/
/******************************************************************************/
int CPopulation::GetGenerationRandomSeed()
{
return m_nGenerationRandomSeed;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetElitism(unsigned int un_number_of_elites)
{
m_unNumberOfElites = un_number_of_elites;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetNumberOfCrossovers(unsigned int un_number_of_crossovers)
{
m_unNumberOfCrossovers = un_number_of_crossovers;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetCrossoverDistance(unsigned int un_crossover_distance)
{
m_unCrossoverDistance = un_crossover_distance;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetMutationRate(double f_mutation_rate)
{
m_fMutationRate = f_mutation_rate;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::SetCrossoverRate(double f_crossover_rate){
m_fCrossoverRate=f_crossover_rate;
}
/******************************************************************************/
/******************************************************************************/
void CPopulation::GetNBestChromosomes(unsigned int un_number_of_chromosomes,
double*** pppf_chromosomes,
unsigned int* pun_chromosome_length)
{
printf("GetNBestChromosomes is not implemented for the current population type");
fflush(stdout);
}
/******************************************************************************/
/******************************************************************************/