Rename autoconstructive-crossover bmx, for best match crossover
This commit is contained in:
parent
30daac848a
commit
d81a9ae3b6
@ -49,7 +49,7 @@ They hold the genetic material for an `individual`. In the initial population, w
|
||||
;; call plushy->push-internal with possibly-preprocessed plushy
|
||||
([plushy argmap]
|
||||
(plushy->push-internal (if (or (> (or (:ah-umad (:variation argmap)) 0) 0) ;; must strip :vary and :protect
|
||||
(> (or (:autoconstructive-crossover (:variation argmap)) 0) 0)) ;; must strip :gene
|
||||
(> (or (:bmx (:variation argmap)) 0) 0)) ;; must strip :gene
|
||||
(filter (complement #{:vary :protect :gene}) plushy)
|
||||
plushy)
|
||||
argmap)))
|
@ -143,10 +143,10 @@
|
||||
(defn gp
|
||||
"Top-level gp function. Calls gp-loop with possibly-adjusted arguments."
|
||||
[argmap]
|
||||
(let [adjust-for-autoconstructive-crossover
|
||||
(let [adjust-for-bmx
|
||||
(fn [args]
|
||||
(let [prob (:autoconstructive-crossover (:variation args))
|
||||
n (:autoconstructive-crossover-enrichment args)]
|
||||
(let [prob (:bmx (:variation args))
|
||||
n (:bmx-enrichment args)]
|
||||
(if (and prob (> prob 0))
|
||||
(update args :instructions concat (repeat (or n 1) :gene))
|
||||
args)))
|
||||
@ -159,5 +159,5 @@
|
||||
(update args :instructions concat (flatten (repeat (or n 1) [:vary :protect])))
|
||||
args)))]
|
||||
(gp-loop (-> argmap
|
||||
(adjust-for-autoconstructive-crossover)
|
||||
(adjust-for-bmx)
|
||||
(adjust-for-ah-umad)))))
|
@ -312,7 +312,7 @@
|
||||
:ah-umad-mean 0.01
|
||||
:variation {:ah-umad 0.9
|
||||
:umad 0
|
||||
:autoconstructive-crossover 0.1}
|
||||
:bmx 0.1}
|
||||
:single-thread-mode false
|
||||
:autoconstructive-crossover-enrichment 10}
|
||||
:bmx-enrichment 10}
|
||||
(apply hash-map (map #(if (string? %) (read-string %) %) args)))))
|
||||
|
@ -239,7 +239,7 @@ The function `new-individual` returns a new individual produced by selection and
|
||||
(conj current-gene (first remainder))
|
||||
(rest remainder)))))
|
||||
|
||||
(defn autoconstructive-crossover
|
||||
(defn bmx
|
||||
"Crosses over two plushies using autoconstructive crossover, one Push instruction at a time."
|
||||
[plushy-a plushy-b]
|
||||
(let [a-genes (extract-genes plushy-a)
|
||||
@ -277,10 +277,10 @@ The function `new-individual` returns a new individual produced by selection and
|
||||
(:plushy (selection/select-parent pop argmap))
|
||||
(:plushy (selection/select-parent pop argmap)))
|
||||
;
|
||||
:autoconstructive-crossover
|
||||
:bmx
|
||||
(let [plushy1 (:plushy (selection/select-parent pop argmap))
|
||||
plushy2 (:plushy (selection/select-parent pop argmap))]
|
||||
(autoconstructive-crossover plushy1 plushy2))
|
||||
(bmx plushy1 plushy2))
|
||||
;
|
||||
:umad ;; uniform mutation by addition and deleted, see uniform-deletion for the
|
||||
;; adjustment that makes this size neutral on average
|
||||
|
Loading…
x
Reference in New Issue
Block a user