aboutsummaryrefslogtreecommitdiff
path: root/Population.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Population.hpp')
-rw-r--r--Population.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Population.hpp b/Population.hpp
new file mode 100644
index 0000000..075a08f
--- /dev/null
+++ b/Population.hpp
@@ -0,0 +1,30 @@
+#ifndef __POPULATION_HPP__
+#define __POPULATION_HPP__
+
+#include "NNUtils.hpp"
+
+class Population
+{
+public:
+ Population(unsigned popSize, unsigned eliteCount, unsigned chromosomeSize);
+
+ void roulleteWheel();
+
+ unsigned getPopSize() const { return m_popSize; }
+ unsigned getChromosomeSize() const { return m_chromosomeSize; }
+ unsigned getEliteCount() const { return m_eliteCount; }
+
+ void setFitness(unsigned i, unsigned fitness) { m_fitnesses[i] = fitness; }
+ Chromosome getChromosome(unsigned i) const { return m_chromosomes[i]; }
+ unsigned getFitness(unsigned i) const { return m_fitnesses[i]; }
+
+private:
+ unsigned m_popSize = 0;
+ unsigned m_eliteCount = 0;
+ unsigned m_chromosomeSize = 0;
+
+ std::vector<Chromosome> m_chromosomes;
+ std::vector<unsigned> m_fitnesses;
+};
+
+#endif // __POPULATION_HPP__