Skip to content

Commit

Permalink
Implement bmx-umad operator; allow collection for bmx-rate
Browse files Browse the repository at this point in the history
  • Loading branch information
lspector committed Nov 21, 2023
1 parent c61934e commit ad20e43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/propeller/problems/boolean/mul3.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@
:ah-umad-min 0.001
:ah-umad-max 0.5
:ah-umad-mean 0.01
:variation {:ah-umad 0.9
:variation {:ah-umad 0
:umad 0
:bmx 0.1}
:bmx 0
:bmx-umad 1}
:single-thread-mode false
:bmx-rate 0.1
:bmx-enrichment 10}
Expand Down
18 changes: 14 additions & 4 deletions src/propeller/variation.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
;
:bmx
:bmx ;; best match crossover
(let [plushy1 (:plushy (selection/select-parent pop argmap))
plushy2 (:plushy (selection/select-parent pop argmap))]
(bmx plushy1 plushy2 (or (:bmx-rate argmap) 0.5)))
plushy2 (:plushy (selection/select-parent pop argmap))
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
(let [rate (utils/onenum (:umad-rate argmap))]
(-> (:plushy (selection/select-parent pop argmap))
(uniform-addition (:instructions argmap) 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
;; number of additions made
Expand Down

0 comments on commit ad20e43

Please sign in to comment.