Simulation::Simulation(InfoFile &info, ProgramOptions &theProgOpt, ThreadPool &_tp) : progOpt(theProgOpt) , numGen(progOpt.getNumberOfGenerations()) , tp(_tp) { // create chromosomes Randomness &rng = tp[0].getRNG(); vector<seqLen_t> lengths = progOpt.get<vector<seqLen_t> >("length"); nat idC = 0; nat numPop = 1; // TODO pops for(auto& length : lengths) { FitnessFunction fFun(progOpt.get<vector<string>>("selCoef")); Chromosome* chromo = new Chromosome(length, theProgOpt.hasOption("neutral"), fFun, idC++, numPop); chromo->init(rng); chromosomes.push_back(chromo); } // create parameters of populations vector<nat> popSizes = progOpt.get<vector<nat> >("popSize"); assert(popSizes.size() == 1 ); popParams.push_back( PopulationParams(0, numGen, popSizes[0], progOpt)); fractionalSimulation = new FractionalSimulation(tp,info, progOpt, numGen, chromosomes, popParams); }
Chromosome make_chromo(const Mat& m, const int size) { Chromosome c; c.init(size); for(size_t x = 0; x < m.rows; ++x) { for(size_t y = 0; y < m.cols; ++y) { c[c.getKernelOffset() + (x * m.cols) + y] = m.at<double>(x, y); } } //FIXME properly calculate the weight c[1] = -1.0; c[0] = 0.1; while(c.getKernelSize() < m.rows) { c[1] += 0.01; } CHECK(c.getKernelSize() == m.rows); return c; }