From 5103463cd85f1a3efe1532941aeba730ae245ca8 Mon Sep 17 00:00:00 2001
From: Lee Spector <lspector@hampshire.edu>
Date: Sat, 14 Oct 2023 17:08:20 -0400
Subject: [PATCH] Add doc string and clean up names

---
 src/propeller/problems/boolean/mul3.cljc |  5 +++--
 src/propeller/variation.cljc             | 15 ++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/propeller/problems/boolean/mul3.cljc b/src/propeller/problems/boolean/mul3.cljc
index 09b0b6c..06364e2 100644
--- a/src/propeller/problems/boolean/mul3.cljc
+++ b/src/propeller/problems/boolean/mul3.cljc
@@ -311,8 +311,9 @@
      ;:parent-selection         :motley-batch-lexicase
      ;:max-batch-size           [1 2 4 8 16 32 64 128 256]
      ;:tournament-size          5
-     :umad-rate                0.001 ;; ah-umad
-     :ah-umad-rate             0.1 ;; ah-umad
+     ;:umad-rate                0.09
+     :ah-umad-protect-rate     0.001 ;; ah-umad
+     :ah-umad-vary-rate        0.1 ;; ah-umad
      :ah-umad-tournament-size  2 ;; ah-umad
      ;:umad-rate                [1/2
      ;                           1/4 1/4 
diff --git a/src/propeller/variation.cljc b/src/propeller/variation.cljc
index 08b7e2b..6ffbccb 100755
--- a/src/propeller/variation.cljc
+++ b/src/propeller/variation.cljc
@@ -203,6 +203,8 @@ The function `new-individual` returns a new individual produced by selection and
                 (partition 2 plushy))))
 
 (defn ah-rates
+  "Returns the sequence of rates with which each element of plushy should
+   be mutated when using autoconstructive hypervariability."
   [plushy protect-rate hypervariable-rate]
   (loop [i 0
          protected true
@@ -300,18 +302,17 @@ The function `new-individual` returns a new individual produced by selection and
              (uniform-addition (:instructions argmap) rate)
              (uniform-deletion rate)))
        ;
-       :ah-umad
-       (let [rate (utils/onenum (:umad-rate argmap))
-             ah-rate (utils/onenum (:ah-umad-rate argmap))
+       :ah-umad ;; autoconstructive hypervariability UMAD
+       (let [protect-rate (utils/onenum (:ah-umad-protect-rate argmap))
+             vary-rate (utils/onenum (:ah-umad-vary-rate argmap))
              tourn-size (utils/onenum (:ah-umad-tournament-size argmap))
              parent-genome (:plushy (selection/select-parent pop argmap))
              offspring (repeatedly
                         tourn-size
                         #(-> parent-genome
-                             (ah-uniform-addition (:instructions argmap) rate ah-rate)
-                             (ah-uniform-deletion rate ah-rate)))
-             hypervariabilities (map #(reduce + (ah-rates % 0 1))
-                                     offspring)]
+                             (ah-uniform-addition (:instructions argmap) protect-rate vary-rate)
+                             (ah-uniform-deletion protect-rate vary-rate)))
+             hypervariabilities (map #(reduce + (ah-rates % 0 1)) offspring)]
          (second (last (sort-by first (map vector hypervariabilities offspring)))))
        ;
        :uniform-addition