#include "SimFitness.hpp" bool SimFitness::startSpecs() { if (!text.startup(this, SELECTION_BY_FITNESS)) { return false; } std::unique_ptr dummy; if (prms.netClass == SINGLE_MLP) { dummy = std::unique_ptr(new SingleMLP(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == DUAL_MLP) { dummy = std::unique_ptr(new DualMLP(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == SIMPLE_RN) { dummy = std::unique_ptr(new SimpleRN(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == FULLY_RN) { dummy = std::unique_ptr(new FullyRN(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } unsigned chromosomeSize = dummy->getChromosomeSize(); population = std::unique_ptr(new Population(prms.popQtty * prms.popSize, prms.elites, chromosomeSize)); // Set first population guppies.resize(prms.popSize); unsigned index = 0; for (auto &i : guppies) { i.startup(this); if (prms.netClass == SINGLE_MLP) { i.neuralNet = std::shared_ptr(new SingleMLP(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == DUAL_MLP) { i.neuralNet = std::shared_ptr(new DualMLP(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == SIMPLE_RN) { i.neuralNet = std::shared_ptr(new SimpleRN(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } else if (prms.netClass == FULLY_RN) { i.neuralNet = std::shared_ptr(new FullyRN(82, prms.npHiddenLayer, 5, prms.nodeClass, true)); } i.create(); // Set neural net initial random weights i.neuralNet->setChromosome(population->getChromosome(index)); ++index; } return true; }