public override double Evaluate(BinaryVector vector, IRandom random) {
   if (Evaluations >= maxEvaluations) throw new OperationCanceledException("Maximum Evaluation Limit Reached");
   Evaluations++;
   double fitness = problem.Evaluate(vector, random);
   if (double.IsNaN(BestQuality) || problem.IsBetter(fitness, BestQuality)) {
     BestQuality = fitness;
     BestSolution = (BinaryVector)vector.Clone();
     BestFoundOnEvaluation = Evaluations;
   }
   return fitness;
 }
 private void AddIfUnique(BinaryVector solution, int level) {
   // Don't add things you have seen
   if (seen.Contains(solution)) return;
   if (level == pyramid.Count) {
     pyramid.Add(new Population(tracker.Length, random));
   }
   var copied = (BinaryVector)solution.Clone();
   pyramid[level].Add(copied);
   seen.Add(copied);
 }