Add diploid-flip genetic operator
This commit is contained in:
parent
4df6ea7fdd
commit
224d33c19d
@ -67,6 +67,14 @@
|
|||||||
(/ 1 (+ 1 (/ 1 umad-rate)))))
|
(/ 1 (+ 1 (/ 1 umad-rate)))))
|
||||||
(partition 2 plushy))))
|
(partition 2 plushy))))
|
||||||
|
|
||||||
|
(defn diploid-flip
|
||||||
|
"Randomly flips pairs in a diploid plushy at some rate."
|
||||||
|
[plushy flip-rate]
|
||||||
|
(flatten (map #(if (< (rand) flip-rate)
|
||||||
|
(reverse %)
|
||||||
|
%)
|
||||||
|
(partition 2 plushy))))
|
||||||
|
|
||||||
(defn new-individual
|
(defn new-individual
|
||||||
"Returns a new individual produced by selection and variation of
|
"Returns a new individual produced by selection and variation of
|
||||||
individuals in the population."
|
individuals in the population."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user