Next: Repair, Previous: Evaluation, Up: Usage [Contents][Index]
Using the test function defined in the previous example
(see Evaluation), the code block below generates a number of
variants of the original program which still satisfy the test suite,
known as “neutral mutants” (see Software Mutational
Robustness available at http://arxiv.org/abs/1204.4224).
(in-package :software-evolution-example)
(defvar variants nil "List to hold accumulated neutral variants.")
(let ((orig (from-file (make-instance 'asm) "../test/gcd/gcd.s")))
(setf (fitness orig) (test orig))
(do ((variant (mutate (copy orig))))
((>= (length variants) 10) variants)
(setf (fitness variant) (test variant))
(when (= (fitness variant) (fitness orig))
(push variant variants))))