Exemplo n.º 1
0
/*
 * Flush best individual
 */
void FlushBest(const GARealGenome& c_genome,
               size_t un_generation) {
   std::ostringstream cOSS;
   cOSS << "best_" << un_generation << ".dat";
   std::ofstream cOFS(cOSS.str().c_str(), std::ios::out | std::ios::trunc);
   cOFS << GENOME_SIZE // first write the number of values to dump
        << " "
        << c_genome    // then write the actual values
        << std::endl;
}
Exemplo n.º 2
0
/*
 * Flush best individual
 */
void FlushIndividual(const CMPGA::SIndividual& s_ind,
                     UInt32 un_generation) {
   std::ostringstream cOSS;
   cOSS << "best_" << un_generation << ".dat";
   std::ofstream cOFS(cOSS.str().c_str(), std::ios::out | std::ios::trunc);
   /* First write the number of values to dump */
   cOFS << GENOME_SIZE;
   /* Then dump the genome */
   for(UInt32 i = 0; i < GENOME_SIZE; ++i) {
      cOFS << " " << s_ind.Genome[i];
   }
   /* End line */
   cOFS << std::endl;
}