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

 


When a solution is found, all the chromosomes and all the pertinent information is printed out in the debug screen in visual basic.  (It would be very easy to modify this routine to dump this information to a screen form or to a disk or to email.  Whatever.)  The information looks something like this:

  				Cell()Info
( 1 , 1 ): [ .25 ]0000011000010001 ( 2 , 1 ): 	[ .25 ]0000011000010001 
( 1 , 2 ): [ .25 ]0000011000010011 ( 2 , 2 ): 	[ .25 ]0000011000010001 
( 1 , 3 ): [ .25 ]0000011000010011 ( 2 , 3 ): 	[ .25 ]0000011000010001 
( 1 , 4 ): [ .25 ]0000011000010001 ( 2 , 4 ): 	[ .25 ]0000011000010001 
( 1 , 5 ): [ .25 ]0000011000010001 ( 2 , 5 ): 	[ 1 ]0000011000010010 
( 1 , 6 ): [ .25 ]0000011000010011 ( 2 , 6 ): 	[ .25 ]0000011000010001 
( 1 , 7 ): [ .25 ]0000011000010001 ( 2 , 7 ): 	[ .25 ]0000011000010001 
( 1 , 8 ): [ .25 ]0000011000010001 ( 2 , 8 ): 	[ .25 ]0000011000010011 
( 1 , 9 ): [ .25 ]0000011000010001 ( 2 , 9 ): 	[ .25 ]0000011000010001 
( 1 , 10 ): [ .25 ]0000011000010001 ( 2 , 10 ): [ 1.515152E-02 ]0000111000010001 
( 1 , 11 ): [ .25 ]0000011000010001 ( 2 , 11 ): [ 1.923077E-02 ]0000011000000001 
( 1 , 12 ): [ .25 ]0000011000010001 ( 2 , 12 ): [ 4.545455E-02 ]0000011000011001 
( 1 , 13 ): [ .25 ]0000011000010001 ( 2 , 13 ): [ .25 ]0000011000010001 
( 1 , 14 ): [ .25 ]0000011000010001 ( 2 , 14 ): [ .25 ]0000011000010001 
( 1 , 15 ): [ .25 ]0000011000010001 ( 2 , 15 ): [ .25 ]0000011000010001 
( 1 , 16 ): [ .25 ]0000011000010011 ( 2 , 16 ): [ 1.845018E-03 ]0100011000010001 
( 1 , 17 ): [ .25 ]0000011000010001 ( 2 , 17 ): [ 3.703704E-03 ]0010011000010001 
( 1 , 18 ): [ .25 ]0000011000010001 ( 2 , 18 ): [ .25 ]0000011000010011 
( 1 , 19 ): [ .25 ]0000011000010001 ( 2 , 19 ): [ .25 ]0000011000010001 
( 1 , 20 ): [ 5.263158E-03 ]0000011001010001 ( 2 , 20 ): [ .25 ]0000011000010001 

Cell size ( 2 x 20 )
Chromosomes: 40 
Run: 1 
Gen: 15 
Chromosome Length: 16 
Avg. Fitness: 0.2335162 
Goal: 55 

I suppose you really don't have to see this stuff, if you're only interested in solving for unknown variables.  But eventually, you will probably want a solution for more complex problems.  At that point you'll have to consider what is happening in your cell.  This is a big picture view of all of your chromosomes.   I've structured my cell to be 2 x 20.  This makes them fit in the debug window nicely, but you might have a 3 x 20 or anything else.  Everytime the program finds a solution it prints out the cell to the debug screen 

Consider what is in cell position (2,5):

        [ 1 ]0000011000010010

The number in brackets is the fitness.  In this case it is a one, so the fitness is 100%.  This chromosome is exactly a solution for some equation for which I entered. It turns out that my equation was X * Y + 1 = 55.  Admittedly, not hard, but it's just an example, so cool out a second.  Anyway, the first gene was nine bits long in my chromosome.  So the value of the first nine bits is 18; that is, the value of the X  gene is 18. The second gene was seven bits long in my chromosome.  So the value of the subsequent seven bits is 3; that is the value of the Y gene is 3.  3 * 18 + 1 = 55.

Of course there are other genes around too. some have a fitness of only .25, which is considerably less fit. Then some are of value .005263158. In genetic algorithm parlance, we say a fitness value this far off "sucks."  As you run larger cells you will see a wider range of fitness values, but if things are structured correctly, you should see continual improvement.  (Those who have had experience with building genetic algorithms know I'm almost lying here, but we'll skip the pessimistic spin on things.)