dvunkannon
Posts: 1377 Joined: June 2008
|
Nakashima whips it out.
Quote | 246
Nakashima
07/23/2009
12:45 pm PopSize = 1000 IndSize = 1000 MaxTime = 1000 mutationRate = 0.05 allocate Pop[PopSize, IndSize], Fitness[PopSize] for i = 1, PopSize for j = 1, IndSize Pop[i, j] = rnd(0, 1) next j Fitness[i] = evaluate(Pop[i, *]) next i
allocate NewInd[1, IndSize] for t = 1, MaxTime * PopSize for j = 1, IndSize p1 = rnd(1, PopSize) p2 = rdn(1, PopSize) if Fitness[p1] > Fitness[p2] then newBit = Pop[p1, j] else newBit = Pop[p2, j] if rnd(0,1) < mutationRate then newBit = not(newBit) NewInd[1, j] = newBit next j p3 = rnd(1, PopSize) Pop[ p3, *] = NewInd[1, *] Fitness[p3] = evaluate(Pop[p3, *]) next t
evaluate( Ind ) {
} |
Not the best code in the world, but ok for lunch time.
Quote | 252
Nakashima
07/23/2009
9:39 pm Mr Jerry,
I did not know that God was writing comments on this site. Did He also write the code that Nakashima gave us.
While I think you are expressing it somewhat jokingly, this question of where to assign credit (or blame) for FSCI is key. Do we give credit to the first cause or to the last cause? If the first cause, then I understand naming God as the author of the FSCI. If the last cause, then the GA itself is the author of the FSCI, not of itself, but of the Pop data array inside it. (Note that the bits in Pop come from the random function or copied from other places in Pop. The ultimate source of every bit in Pop is random. |
I will be interested to see how the UD crowd react to that last observation.
-------------- I’m referring to evolution, not changes in allele frequencies. - Cornelius Hunter
I’m not an evolutionist, I’m a change in allele frequentist! - Nakashima
|