bool DifferentialEvolution::advanceGeneration(StateP state, DemeP deme)
{
	// create donor vectors for each population member
	for(uint iIter = 0; iIter < deme->size(); iIter++){ 
		createDonorVectors(deme, state);
	}

	// perform DE crossover, generate trial vectors (stored in donor_vector)
	for(uint iIter = 0; iIter < deme->size(); iIter++) {
		crossover(deme, iIter, state);
	}
	
	// select the better one for each population member and trial vector
	for(uint iIter = 0; iIter < deme->size(); iIter++) {
		evaluate(donor_vector[iIter]);
		if(donor_vector[iIter]->fitness->isBetterThan(deme->at(iIter)->fitness))
			replaceWith(deme->at(iIter), donor_vector[iIter]);
	}

	//for(uint i = 0; i < deme->size(); i++){
	//	state->getLogger()->log(5, "deme[" + uint2str(i) + "]: " + dbl2str(deme->at(i)->fitness->getValue()) + "\t" + uint2str(deme->at(i)->index));
	//}

	donor_vector.clear();

	return true;
}
bool RandomSearch :: advanceGeneration(StateP state, DemeP deme)
{
	// initialize and evaluate all individuals
	for(uint i = 0; i < deme->size(); i++) {
		deme->at(i)->initialize(state);
		evaluate(deme->at(i));
	}

	return true;
}