Roulette_wheel::Roulette_wheel ( const int num_alleles_, const int num_bases_per_allele_, const int num_agents_per_group_ ) : GA( num_agents_per_group_) { solution = new Chromosome <chromosome_type> [num_tot_solutions]; tmp_solution = new Chromosome <chromosome_type> [num_tot_solutions]; for(int c=0; c < num_tot_solutions; c++){ solution[c].set_diploid ( DIPLOID_FLAG ); solution[c].init_allele_values ( num_alleles_, num_bases_per_allele_ ); tmp_solution[c].set_diploid ( DIPLOID_FLAG ); } rank.assign (num_tot_solutions, 0); wheel.assign (num_tot_solutions, 0); fitness.clear(); #ifdef _RANK_BASED_ linear_rank_wheel(); #endif }
Roulette_wheel::Roulette_wheel ( const int num_alleles_, const int num_bases_per_allele_, const int num_agents_per_group_ ) : GA( num_agents_per_group_) { chromosome = new Chromosome <chromosome_type> *[num_groups/* population size*/]; tmp_chromosome = new Chromosome <chromosome_type> *[num_groups]; for (int g = 0; g < num_groups; g++){ chromosome[g] = new Chromosome <chromosome_type> [num_agents_per_group]; tmp_chromosome[g] = new Chromosome <chromosome_type> [num_agents_per_group]; for(int ind = 0; ind < num_agents_per_group; ind++){ chromosome[g][ind].set_diploid ( DIPLOID_FLAG ); chromosome[g][ind].init_allele_values ( num_alleles_, num_bases_per_allele_ ); tmp_chromosome[g][ind].set_diploid ( DIPLOID_FLAG ); } } wheel.assign (num_tot_solutions, 0); fitness.clear(); #ifdef _RANK_BASED_ linear_rank_wheel(); #endif }