Sorry but this is a quick question, can anyone tell why this for loop is not incrementing either i or j? They are staying at 0 and 1.
void Environment::tourneyselection(std::vector<Tree>& popvec) {
std:random_shuffle(popvec.begin(), popvec.end());
for (int i = 0, j = 1; j <= Popsize; i + 2, j + 2) {
std::cout << popvec[i].fitness << " and " << popvec[j].fitness << ":";
if (popvec[i].fitness < popvec[j].fitness) {
popvec.erase(popvec.begin() + i);
std::cout << " erase " << i << std::endl;
}
else {
popvec.erase(popvec.begin() + j);
std::cout << " erase " << j << std::endl;
}
}
}
Thank you