Implement bmx-umad operator; allow collection for bmx-rate

This commit is contained in:
Lee Spector 2023-11-21 16:23:26 -05:00
parent c61934e50b
commit ad20e43516
2 changed files with 17 additions and 6 deletions

View File

@ -310,9 +310,10 @@
:ah-umad-min 0.001 :ah-umad-min 0.001
:ah-umad-max 0.5 :ah-umad-max 0.5
:ah-umad-mean 0.01 :ah-umad-mean 0.01
:variation {:ah-umad 0.9 :variation {:ah-umad 0
:umad 0 :umad 0
:bmx 0.1} :bmx 0
:bmx-umad 1}
:single-thread-mode false :single-thread-mode false
:bmx-rate 0.1 :bmx-rate 0.1
:bmx-enrichment 10} :bmx-enrichment 10}

View File

@ -251,17 +251,27 @@ The function `new-individual` returns a new individual produced by selection and
(:plushy (selection/select-parent pop argmap)) (:plushy (selection/select-parent pop argmap))
(:plushy (selection/select-parent pop argmap))) (:plushy (selection/select-parent pop argmap)))
; ;
:bmx :bmx ;; best match crossover
(let [plushy1 (:plushy (selection/select-parent pop argmap)) (let [plushy1 (:plushy (selection/select-parent pop argmap))
plushy2 (:plushy (selection/select-parent pop argmap))] plushy2 (:plushy (selection/select-parent pop argmap))
(bmx plushy1 plushy2 (or (:bmx-rate argmap) 0.5))) rate (utils/onenum (or (:bmx-rate argmap) 0.5))]
(bmx plushy1 plushy2 rate))
; ;
:umad ;; uniform mutation by addition and deleted, see uniform-deletion for the :umad ;; uniform mutation by addition and deletion, see uniform-deletion for the
;; adjustment that makes this size neutral on average ;; adjustment that makes this size neutral on average
(let [rate (utils/onenum (:umad-rate argmap))] (let [rate (utils/onenum (:umad-rate argmap))]
(-> (:plushy (selection/select-parent pop argmap)) (-> (:plushy (selection/select-parent pop argmap))
(uniform-addition (:instructions argmap) rate) (uniform-addition (:instructions argmap) rate)
(uniform-deletion rate))) (uniform-deletion rate)))
;
:bmx-umad ;; applies umad to the results of bmx
(let [umad-rate (utils/onenum (:umad-rate argmap))]
(-> (let [plushy1 (:plushy (selection/select-parent pop argmap))
plushy2 (:plushy (selection/select-parent pop argmap))
bmx-rate (utils/onenum (or (:bmx-rate argmap) 0.5))]
(bmx plushy1 plushy2 bmx-rate))
(uniform-addition (:instructions argmap) umad-rate)
(uniform-deletion umad-rate)))
; ;
:rumad ;; responsive UMAD, uses a deletion rate computed from the actual :rumad ;; responsive UMAD, uses a deletion rate computed from the actual
;; number of additions made ;; number of additions made