Add variable umad (vumad) genetic operator; mul3 parameter experiments

This commit is contained in:
Lee Spector 2023-08-30 16:43:49 -04:00
parent b49ced0567
commit aeae30d0d4
2 changed files with 30 additions and 24 deletions

View File

@ -173,13 +173,13 @@
:boolean_nand ;; defined here :boolean_nand ;; defined here
:boolean_nor ;; defined here :boolean_nor ;; defined here
:boolean_xnor ;; defined here :boolean_xnor ;; defined here
:boolean_dup ;:boolean_dup
:boolean_swap ;:boolean_swap
:boolean_rot ;:boolean_rot
:boolean_pop ;:boolean_pop
:exec_pop ;:exec_pop
:exec_dup ;:exec_dup
'close ;'close
true true
false)) false))
@ -238,13 +238,13 @@
:parent-selection :lexicase :parent-selection :lexicase
;:parent-selection :tournament ;:parent-selection :tournament
:tournament-size 5 :tournament-size 5
:umad-rate 0.1 :umad-rate 0.01
;:variation {:umad 1} :variation {:vumad 1}
:diploid true ;:diploid true
:variation {:diploid-umad 0.8 ;:variation {:diploid-umad 0.8
:diploid-uniform-silent-replacement 0.1 ; :diploid-uniform-silent-replacement 0.1
:diploid-flip 0.1} ; :diploid-flip 0.1}
:replacement-rate 0.1 ;:replacement-rate 0.1
:diploid-flip-rate 0.1 ;:diploid-flip-rate 0.1
:elitism false} :elitism false}
(apply hash-map (map #(if (string? %) (read-string %) %) args))))) (apply hash-map (map #(if (string? %) (read-string %) %) args)))))

View File

@ -202,13 +202,13 @@ The function `new-individual` returns a new individual produced by selection and
(case op (case op
:crossover :crossover
(crossover (crossover
(:plushy (selection/select-parent pop argmap)) (:plushy (selection/select-parent pop argmap))
(:plushy (selection/select-parent pop argmap))) (:plushy (selection/select-parent pop argmap)))
; ;
:tail-aligned-crossover :tail-aligned-crossover
(tail-aligned-crossover (tail-aligned-crossover
(:plushy (selection/select-parent pop argmap)) (:plushy (selection/select-parent pop argmap))
(:plushy (selection/select-parent pop argmap))) (:plushy (selection/select-parent pop argmap)))
; ;
:umad :umad
(-> (:plushy (selection/select-parent pop argmap)) (-> (:plushy (selection/select-parent pop argmap))
@ -229,6 +229,12 @@ The function `new-individual` returns a new individual produced by selection and
(uniform-deletion after-addition effective-addition-rate)) (uniform-deletion after-addition effective-addition-rate))
; Adds and deletes instructions in the parent genome with the same rate ; Adds and deletes instructions in the parent genome with the same rate
:vumad ;; variable umad: :umad-rate is interpreted as max, actual uniform 0-max
(let [rate (rand (:umad-rate argmap))]
(-> (:plushy (selection/select-parent pop argmap))
(uniform-addition (:instructions argmap) rate)
(uniform-deletion rate)))
:uniform-addition :uniform-addition
(-> (:plushy (selection/select-parent pop argmap)) (-> (:plushy (selection/select-parent pop argmap))
(uniform-addition (:instructions argmap) (:umad-rate argmap))) (uniform-addition (:instructions argmap) (:umad-rate argmap)))
@ -247,13 +253,13 @@ The function `new-individual` returns a new individual produced by selection and
; ;
:diploid-crossover :diploid-crossover
(diploid-crossover (diploid-crossover
(:plushy (selection/select-parent pop argmap)) (:plushy (selection/select-parent pop argmap))
(:plushy (selection/select-parent pop argmap))) (:plushy (selection/select-parent pop argmap)))
; ;
:tail-aligned-diploid-crossover :tail-aligned-diploid-crossover
(tail-aligned-diploid-crossover (tail-aligned-diploid-crossover
(:plushy (selection/select-parent pop argmap)) (:plushy (selection/select-parent pop argmap))
(:plushy (selection/select-parent pop argmap))) (:plushy (selection/select-parent pop argmap)))
; ;
:diploid-umad :diploid-umad
(-> (:plushy (selection/select-parent pop argmap)) (-> (:plushy (selection/select-parent pop argmap))
@ -278,4 +284,4 @@ The function `new-individual` returns a new individual produced by selection and
:else :else
(throw #?(:clj (Exception. (str "No match in new-individual for " op)) (throw #?(:clj (Exception. (str "No match in new-individual for " op))
:cljs (js/Error :cljs (js/Error
(str "No match in new-individual for " op))))))}) (str "No match in new-individual for " op))))))})