src/population.cpp
/**
 *	Create new covers through doing cross-overs
 *	and mutating existing members of the pool. This
 *	process overwrites the given worst fraction of
 *	the ordering.
 */
Create new covers through doing cross-overs
and mutating existing members of the pool. This
process overwrites the given worst fraction of
the ordering.
Create new covers through doing cross - overs and mutating existing members of the pool . This process overwrites the given worst fraction of the ordering .
void Population::breed(const Pizza& pizza, const double a, const double b) {
	int a_cut = floor(pop_count_ * a),
		b_cut = floor(pop_count_ * b);
	for (int i = a_cut; i < b_cut; i++) {
		pool_[i] = Cover(pizza);
	}
	for (int i = b_cut; i < pop_count_; i++) {
		pool_[i] = Cover(pool_[rand() % b_cut], pool_[rand() % b_cut]);
	}
}
void Population :: breed ( const Pizza & pizza , const double a , const double b ) { int a_cut = floor ( pop_count_ * a ) , b_cut = floor ( pop_count_ * b ) ; for ( int i = a_cut ; i < b_cut ; i ++ ) { pool_ [ i ] = Cover ( pizza ) ; } for ( int i = b_cut ; i < pop_count_ ; i ++ ) { pool_ [ i ] = Cover ( pool_ [ rand ( ) % b_cut ] , pool_ [ rand ( ) % b_cut ] ) ; } }
Create new covers through doing cross-overs
      and mutating existing members of the pool.
Create new covers through doing cross - overs and mutating existing members of the pool .
// Compute the cut-offs. // Perform cross-overs. // Randomly choose two members of the pool from // before the cutoff to serve as parents.