$ clisp <...snip...> [1]> (load "lsystem-fitness.l") ;; Loading file lsystem-fitness.l ... ;; Loading file lsystem-crossover.l ... ;; Loading file lsystem-mutation.l ... ;; Loading file lsystem.l ... ;; Loaded file lsystem.l ;; Loading file genetics-population-copy.l ... ;; Loading file utils.l ... ;; Loaded file utils.l ;; Loading file genetics-individual.l ... ;; Loaded file genetics-individual.l ;; Loaded file genetics-population-copy.l ;; Loaded file lsystem-mutation.l ;; Loaded file lsystem-crossover.l ;; Loaded file lsystem-fitness.l T ; make an unbalanced individual [2]> (setf ind1 (make-individual (make-lsys '((a b a b b a b) (b b b b b b)) '(a)) 1)) # ; make a perfectly balanced individual [3]> (setf ind2 (make-individual (make-lsys '((a b) (b c) (c d) (d e) (e f) (f g) (g a)) '(a)) 2)) # [4]> (setf *DEMO* t) T [5]> (fitness-balancing ind1) (B A B B A B B B B B B) (2 9) (0.22222222 4.5) Fitness: 0.42352942 NIL [6]> (individual-fitness ind1) 0.42352942 [7]> (setf *alphabet* '(a b c d e f g)) (A B C D E F G) <...snip...> [10]> (fitness-balancing ind2) (B C D E F G A) (1 1 1 1 1 1 1) (1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0) Fitness: 1.0 NIL ; slightly unbalance it [11]> (setf ind3 (make-individual (make-lsys '((a b b) (b c) (c d) (d e) (e f) (f g) (g a)) '(a)) 3)) # [12]> (fitness-balancing ind3) (B B C D E F G A) (1 2 1 1 1 1 1) (0.5 1.0 1.0 1.0 1.0 1.0 2.0 2.0 2.0 2.0 2.0 2.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0) Fitness: 0.93333334 NIL ; add a bit more entropy [13]> (setf ind4 (make-individual (make-lsys '((a b b) (b c c) (c d) (d e) (e f) (f g) (g a)) '(a)) 4)) # [14]> (fitness-balancing ind4) (B B C C D E F G A) (1 2 2 1 1 1 1) (0.5 0.5 1.0 1.0 1.0 1.0 2.0 1.0 2.0 2.0 2.0 2.0 2.0 1.0 2.0 2.0 2.0 2.0 1.0 0.5 0.5 1.0 1.0 1.0 1.0 0.5 0.5 1.0 1.0 1.0 1.0 0.5 0.5 1.0 1.0 1.0 1.0 0.5 0.5 1.0 1.0 1.0) Fitness: 0.893617 NIL ; kill it completely [15]> (setf ind4 (make-individual (make-lsys '((a b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b) (b c) (c d) (d e) (e f) (f g) (g a)) '(a)) 4)) # [16]> (fitness-balancing ind4) (B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B C D E F G A) (1 147 1 1 1 1 1) (0.006802721 1.0 1.0 1.0 1.0 1.0 147.0 147.0 147.0 147.0 147.0 147.0 1.0 0.006802721 1.0 1.0 1.0 1.0 1.0 0.006802721 1.0 1.0 1.0 1.0 1.0 0.006802721 1.0 1.0 1.0 1.0 1.0 0.006802721 1.0 1.0 1.0 1.0 1.0 0.006802721 1.0 1.0 1.0 1.0) Fitness: 0.046050575 NIL ; kill it just a bit more [17]> (setf ind4 (make-individual (make-lsys '((a b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b) (b c) (c d) (d e) (e f) (f g) (g a)) '(a)) 4)) # [18]> (fitness-balancing ind4) (B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B C D E F G A) (1 148 1 1 1 1 1) (0.006756757 1.0 1.0 1.0 1.0 1.0 148.0 148.0 148.0 148.0 148.0 148.0 1.0 0.006756757 1.0 1.0 1.0 1.0 1.0 0.006756757 1.0 1.0 1.0 1.0 1.0 0.006756757 1.0 1.0 1.0 1.0 1.0 0.006756757 1.0 1.0 1.0 1.0 1.0 0.006756757 1.0 1.0 1.0 1.0) Fitness: 0.04574961 NIL [19]> (bye) Bye.