CalcAllFitness
Home ] Up ] Initcel() ] SelectParents ] [ CalcAllFitness ] GraphCellFitness ] PrintCell ] Declarations ]

 


In the CalcAllFitness routine, we determine the fitness of each chromo in the cell. Fitness is simply how close the value of a formula is to the desired value.

     First, we decode the chromosome into it's genes.  We convert those bit pattern groupings into numbers which represent the values in our formula. 

wpe1.jpg (20318 bytes)

    Second, we plug those values into the equation to get the value of the whole equation.

wpe2.jpg (17133 bytes)


Finally, we determine fitness by how close our current equation's value is to the goal state we've set for the equation. In this case 25245 is pretty dang far from, say 52.  (That's assuming 52 is the magic number you're trying to solve for.)