                                                                (inc sel-count)))))
     selected))
 
-
-
-
-
-
-

(defn tournament-selection
  "Returns an individual that does the best out of a tournament."
  [pop location {:keys [tournament-size total-error-method]}]
  (let [tournament-set 
        (doall
          (for [_ (range tournament-size)]
            (lrand-nth pop)))
        err-fn (case total-error-method
                 :sum :total-error
                 (:hah :rmse :ifs) :weighted-error

(defn elitegroup-lexicase-selection
  "Returns an individual produced by elitegroup lexicase selection."
  [pop]
  (loop [survivors (retain-one-individual-per-error-vector 
                     (possibly-remove-individuals-with-empty-genomes
                       (age-mediate pop argmap) 
                       argmap))
         cases (lshuffle (map lrand-nth @elitegroups))]
    (if (or (empty? cases)
            (empty? (rest survivors)))
