int GABin2DecGenome::write(STD_OSTREAM & os) const { for(unsigned int i=0; i<phenotypes().nPhenotypes(); i++) os << phenotype(i) << " "; return 0; }
void operator()() { // crossover parents of offspring population // timer_type xover_time; crossover(); xover_time.stop(); // mutate offspring population // timer_type mutate_time; mutate(); mutate_time.stop(); // // evaluate phenotype of offspring population // timer_type pheno_time; phenotype(); pheno_time.stop(); // evaluate fixed alleles with offspring population // timer_type fixed_time; fixed(); fixed_time.stop(); // persist time logs m_crossover_times.push_back( std::make_pair( xover_time.getStart(), xover_time.getStop())); m_mutate_times.push_back( std::make_pair( mutate_time.getStart(), mutate_time.getStop())); m_phenotype_times.push_back( std::make_pair( pheno_time.getStart(), pheno_time.getStop())); m_fixed_times.push_back( std::make_pair( fixed_time.getStart(), fixed_time.getStop())); }
// Read the incoming data as a list of phenotype values. It would be nice to // do this either as binary or decimal read, but oh well... not much need. int GABin2DecGenome::read(STD_ISTREAM & is) { float value; for(unsigned int i=0; i<phenotypes().nPhenotypes(); i++){ is >> value; if(is.fail() || is.eof()) return 1; phenotype(i, value); } return 0; }