Add autoconstructive hypervariability tournaments

This commit is contained in:
Lee Spector 2023-10-14 16:43:14 -04:00
parent 9f3c6f46ff
commit a8d046e52e
2 changed files with 12 additions and 4 deletions

View File

@ -313,6 +313,7 @@
;:tournament-size 5
:umad-rate 0.001 ;; ah-umad
:ah-umad-rate 0.1 ;; ah-umad
:ah-umad-tournament-size 2 ;; ah-umad
;:umad-rate [1/2
; 1/4 1/4
; 1/8 1/8 1/8

View File

@ -302,10 +302,17 @@ The function `new-individual` returns a new individual produced by selection and
;
:ah-umad
(let [rate (utils/onenum (:umad-rate argmap))
ah-rate (utils/onenum (:ah-umad-rate argmap))]
(-> (:plushy (selection/select-parent pop argmap))
ah-rate (utils/onenum (:ah-umad-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)]
(second (last (sort-by first (map vector hypervariabilities offspring)))))
;
:uniform-addition
(-> (:plushy (selection/select-parent pop argmap))