 (ns algebolic.algorithms.spea2
-  "An implementation of the SPEA2 algorithm of Zitzler et al. Nearly. See the archive thinner functions
-  for details of the difference.
+  "An implementation of the SPEA2 algorithm of Zitzler et al. Well, almost. There's a very slight
+  difference in way the archive is constructed. Using my technique you can replicate SPEA2 exactly, but
+  it runs slowly. You can approximate the behaviour of SPEA2 and have it run pretty fast. I've tested
+  the approximation on a few problems and it doesn't seem to make any real difference. See the archive
+  thinner functions for details of the difference.
 
   This code is currently limited to two objectives, but the API is arranged so that should be easy to
   generalise if needed."

  if there are too few. Finally, a new generation is bred from the archived individuals, using binary
  tournament selection on the :spea2-fitness, and the cycle begins again."
  [config]
  (let [{:keys [unary-ops binary-ops goals archive-size]} config]
    {:elite-selector       (fn [rabble elite] (make-new-archive goals archive-size rabble elite))
     :mating-pool-selector (fn [_ elite] elite)
     :reproduction-config  {:selector   (partial selection/tournament-selector 2 :spea2-fitness)
                            :unary-ops  unary-ops

      ;; is to just sort and select from the pool.
      (< new-size archive-size) (take archive-size (sort-by :spea2-fitness < scored-pool))
      ;; and finally, if we've got too many non-dominated individuals then some of them are for the chop
      (> new-size archive-size) (thin-archive goals new-elites comparison-depth archive-size))))


;; * algebolic.evolution.core configuration *
