aboutsummaryrefslogtreecommitdiff
path: root/Population.hpp
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 03:15:03 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 03:15:30 +0100
commit6fd23da97fa9700f59c61a966b4bf7d25fa46b34 (patch)
treed5fe3a8305a5f57e5b4cedc8300e951c74696cc5 /Population.hpp
initial commitHEADmaster
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__