void PopulationControlArchitecture::setCandidateFitness(ControllerPtr candidate, double scoredFitness) {

	// running evaluation has completed. Decide if the candidate will become the active solution.
	if (candidate->GetFitness() > -1) {
		// this is a re-evaluation, average out the previous and the new score
		if (debug) {
			cout << "This was a re-evaluation, not adding a new candidate" << endl;
		}
		candidate->SetFitness((candidate->GetFitness() + scoredFitness) / 2);
		if (debug || verbose) {
			cout << "Finished re-evaluating " << candidate->ToShortString() << " - fitness: " << scoredFitness << ", avg: " << candidate->GetFitness() << endl;
		}

	} else {
		candidate->SetFitness(scoredFitness);

		// this is a first evaluation and will need to be considered for placement as an active solution
		if (activeSolutions.size() < mu) {
			// there is no full set of active solutions yet, just add this solution
			activeSolutions.push_back(candidate);

			// send out a news item about the new active solution
			population->setNews(candidate->Clone(), activeSolutions.size() - 1, currentTime);

		} else {
			// there is a full list of active solutions, compete with the active solutions
			int worstIndex = -1;
			ControllerPtr worst = candidate;

			// find the worst controller in the (unsorted) list
			for (unsigned int i = 0; i < activeSolutions.size(); i++) {
				if (worst->GetFitness() > activeSolutions[i]->GetFitness()) {
					worst = activeSolutions[i];
					worstIndex = i;
				}
			}

			// if the candidate is better than the worst controller in the list, have it take that controller's place
			if (scoredFitness > worst->GetFitness()) {
				if (debug) {
					cout << "This was first evaluation, candidate became active solution" << endl;
				}
				activeSolutions[worstIndex] = candidate;

				// send out a news item about the new active solution
				population->setNews(candidate->Clone(), worstIndex, currentTime);

			} else {
				if (debug) {
					cout << "This was first evaluation, candidate failed" << endl;
				}
				// the candidate has lost the competition; have it deleted
				// done automatically by smart pointer
			}
		}
		// Don't print if candidate was deleted
		if (candidate && (debug || verbose)) {
			cout << "Finished evaluating " << candidate->ToShortString() << " - fitness: " << scoredFitness << endl;
		}
	}

	if (!debug && !verbose) {
		// there has been no output on the fitness yet, do that now
		cout << scoredFitness << endl;
	}
}