Make boundaries of hypervariable segments hypervariable
This commit is contained in:
parent
37df3432fb
commit
e3ba58587a
@ -210,9 +210,35 @@ The function `new-individual` returns a new individual produced by selection and
|
|||||||
(let [initial-mean (/ (reduce + v) (count v))]
|
(let [initial-mean (/ (reduce + v) (count v))]
|
||||||
(map #(* m (/ % initial-mean)) v))))
|
(map #(* m (/ % initial-mean)) v))))
|
||||||
|
|
||||||
|
;;; version of ah-rates in which boundaries of hypervariable segments are protected
|
||||||
|
;;; retained for experimentation
|
||||||
|
;; (defn ah-rates
|
||||||
|
;; "Returns the sequence of rates with which each element of plushy should
|
||||||
|
;; be mutated when using autoconstructive hypervariability."
|
||||||
|
;; [plushy protection rate]
|
||||||
|
;; (loop [i 0
|
||||||
|
;; protected true
|
||||||
|
;; rates []
|
||||||
|
;; remainder plushy]
|
||||||
|
;; (if (empty? remainder)
|
||||||
|
;; (with-mean rate rates)
|
||||||
|
;; (if (and (not protected)
|
||||||
|
;; (= (first remainder) :protect))
|
||||||
|
;; (recur i
|
||||||
|
;; true
|
||||||
|
;; rates
|
||||||
|
;; remainder)
|
||||||
|
;; (recur (inc i)
|
||||||
|
;; (if protected
|
||||||
|
;; (not= (first remainder) :vary)
|
||||||
|
;; false)
|
||||||
|
;; (conj rates (if protected (/ 1 protection) 1))
|
||||||
|
;; (rest remainder))))))
|
||||||
|
|
||||||
(defn ah-rates
|
(defn ah-rates
|
||||||
"Returns the sequence of rates with which each element of plushy should
|
"Returns the sequence of rates with which each element of plushy should
|
||||||
be mutated when using autoconstructive hypervariability."
|
be mutated when using autoconstructive hypervariability. Boundaries of
|
||||||
|
hypervariable segments are hypervariable."
|
||||||
[plushy protection rate]
|
[plushy protection rate]
|
||||||
(loop [i 0
|
(loop [i 0
|
||||||
protected true
|
protected true
|
||||||
@ -222,17 +248,22 @@ The function `new-individual` returns a new individual produced by selection and
|
|||||||
(with-mean rate rates)
|
(with-mean rate rates)
|
||||||
(if (and (not protected)
|
(if (and (not protected)
|
||||||
(= (first remainder) :protect))
|
(= (first remainder) :protect))
|
||||||
(recur i
|
(recur (inc i)
|
||||||
true
|
true
|
||||||
rates
|
(conj rates 1)
|
||||||
remainder)
|
(rest remainder))
|
||||||
(recur (inc i)
|
(recur (inc i)
|
||||||
(if protected
|
(if protected
|
||||||
(not= (first remainder) :vary)
|
(not= (first remainder) :vary)
|
||||||
false)
|
false)
|
||||||
(conj rates (if protected (/ 1 protection) 1))
|
(conj rates (if (and protected
|
||||||
|
(not= (first remainder) :vary))
|
||||||
|
(/ 1 protection)
|
||||||
|
1))
|
||||||
(rest remainder))))))
|
(rest remainder))))))
|
||||||
|
|
||||||
|
;(ah-rates [0 0 :vary 0 :protect 0 0 :protect :vary] 10 0.1)
|
||||||
|
|
||||||
(defn ah-uniform-addition
|
(defn ah-uniform-addition
|
||||||
"Returns plushy with new instructions possibly added before or after each
|
"Returns plushy with new instructions possibly added before or after each
|
||||||
existing instruction. Rates are autoconstructively hypervariable."
|
existing instruction. Rates are autoconstructively hypervariable."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user