Re: [racket] simple genetic algorithm

2013-11-10 Thread Rian Shams
Yes, thank you! On Sun, Nov 10, 2013 at 2:39 PM, Matthias Felleisen wrote: > > I think this is the program you want: > > #lang racket > > (module+ test > (require rackunit)) > > ;; [List-of Real] -> [List-of Real] > > (module+ test > (check-equal? (roulette-wheel-ratio '(1 2 3)) '(1/6 2/6 3/

Re: [racket] simple genetic algorithm

2013-11-10 Thread Matthias Felleisen
I think this is the program you want: #lang racket (module+ test (require rackunit)) ;; [List-of Real] -> [List-of Real] (module+ test (check-equal? (roulette-wheel-ratio '(1 2 3)) '(1/6 2/6 3/6))) (define (roulette-wheel-ratio generation-fitness) (define total-population-fitness (f

[racket] simple genetic algorithm

2013-11-10 Thread Rian Shams
Hello All, As part of the design for a simple genetic algorithm I have this function: (define (roulette-wheel-ratio generation-fitness ) (cond [(empty? generation-fitness) empty] [else (cons (/ (first generation-fitness) (total-population-fitness genera