Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn crossover
- "Produces a new vector based on the genotypes [gt1 gt2] taking the mask as
- the crossover guide {1 = copy, 0 = not-copy}. The genes from [gt2] are
- copyed to [gt1]."
- [gt1 gt2 mask]
- (let [inv-mask (mapv #(- 1 %) mask)
- masked-gt1 (mapv * gt1 inv-mask)
- masked-gt2 (mapv * gt2 mask)]
- (mapv + masked-gt1 masked-gt2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement