From a32b3263c55cefdad5bb303ff4e13e14c8ea3652 Mon Sep 17 00:00:00 2001 From: Shuzo Katayama Date: Wed, 14 Jul 2021 14:55:45 -0400 Subject: [PATCH] fizz buzz, gcd, and luhn added --- src/propeller/gp.cljc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/propeller/gp.cljc b/src/propeller/gp.cljc index 55b026d..1ad3f71 100755 --- a/src/propeller/gp.cljc +++ b/src/propeller/gp.cljc @@ -16,20 +16,18 @@ "Reports information each generation." [pop generation argmap] (let [best (first pop)] - (println {:generation generation - :best-plushy (:plushy best) - :best-program (genome/plushy->push (:plushy best) argmap) - :best-total-error (:total-error best) - :best-errors (:errors best) - :best-behaviors (:behaviors best) - :genotypic-diversity (float (/ (count (distinct (map :plushy pop))) (count pop))) - :behavioral-diversity (float (/ (count (distinct (map :behaviors pop))) (count pop))) - :average-genome-length (float (/ (reduce + (map count (map :plushy pop))) (count pop))) - :average-total-error (float (/ (reduce + (map :total-error pop)) (count pop)))}) + (clojure.pprint/pprint {:generation generation + :best-plushy (:plushy best) + :best-program (genome/plushy->push (:plushy best) argmap) + :best-total-error (:total-error best) + :best-errors (:errors best) + :best-behaviors (:behaviors best) + :genotypic-diversity (float (/ (count (distinct (map :plushy pop))) (count pop))) + :behavioral-diversity (float (/ (count (distinct (map :behaviors pop))) (count pop))) + :average-genome-length (float (/ (reduce + (map count (map :plushy pop))) (count pop))) + :average-total-error (float (/ (reduce + (map :total-error pop)) (count pop)))}) (println))) -;; clojure.pprint/pprint - (defn gp "Main GP loop." [{:keys [population-size max-generations error-function instructions