Genetic Algorithms And Evolutionary Learning .*;

Simple Function Example 2

This one is similar to Example 1, but includes mutation and some code improvements.  Again, it's a simple genetic algorithm that generates combinations of five numbers and four operators with results that aim toward a target number.

These are the constraints of this example:

  1. The population remains the same size from one generation to the next; the chromosomes that aren't selected for reproduction are overwritten by the offspring of those that are selected.  Only enough offspring are created to make the population a specified size, so even though several chromosomes are selected for reproduction, not all get to reproduce.
  2. Selection is accomplished using a general random method.
  3. The usual operator precedence rules of algebra are not used, the expressions are simply evaluated from left to right.
  4. Mutation is implemented this time.  Simply set the mRate to the desired proportion.  0.01 = one mutation randomly chosen among 100 offspring, 0.001 = one among a thousand.

You can adjust:

  • Target - the target number the algorithm should try to achieve.
  • MaxInputs - the number of chromosomes in the population.
  • MaxEpochs - number of generations to attempt before giving up.
  • mRate - mutation rate.
  • ShowVerboseResults - setting this to False will only print out the first and last generations, and definitely speed up the program!

In the VB.Net example, "Button2" is added to manually stop testing altogether.

This time, the solution chromosome(s) are decoded and displayed with GetDecodedFunction(), so you don't have to decipher it from the results. :)

NaN means "not a number".  This will often show up when a "divide-by-zero"-like error occurs while using type Double variables (as opposed to integers).  The way I've  implemented this genetic algorithm, it will sometimes weed out all but the one chromosome closest to the target, which leaves nothing but a whole population of the exact same chromosome.  And when there's no diversity, the algorithm will only be able to generate "NaN" for fitness scores.  So, I added some code to stop the testing when this happens.

 

Example Results 1

I'm sure you'll notice that larger populations (MaxInputs) stand a better chance of finding the target solution; and faster, too.  Target = 100.

Mutation helps a little.  If you set the mutation rate (mRate) too high the results are chaotic, but if you set it too low the algorithm has less chance of finding the target.  The only way to really know how to set the mutation rate, it seems, is through experimentation.

This set of results didn't even get to use mutation (mRate = 0.001).  It seems that a denser population of 100 helped the most.

 

000111110111101110011110000110111000 = 17	93.7371663244353%
100011010100111100111101100011011000 = -15	90.4517453798768%
010111010010111110001110000110100101 = 5	92.5051334702259%
100011000101110001101110000011000100 = -4	91.5811088295688%
011011100111101101011111001111100101 = 78	100%
010010100010101100011011100111101001 = 144	97.741273100616%
010111100111101100101011000111011000 = 30	95.0718685831622%
011011000000101001001010000111000101 = 6	92.6078028747433%
100110110000111000101101011010111000 = 20	94.0451745379877%
001011111001110010011011000111000100 = -12	90.7597535934292%
011110110111110101001110000011000111 = -7	91.2731006160164%
010111010001101001011101001011010111 = 0	91.9917864476386%
100011100011110001011100010110100001 = 15	93.5318275154004%
001111100001101101001100010111001000 = -6	91.3757700205339%
000110100110110001001110001111000110 = 3	92.299794661191%
011011000101101000001101011111110101 = -1	91.8891170431211%
100011011001110001111100010111000111 = -20	89.9383983572895%
010011100101111010001110000011000110 = -6	91.3757700205339%
011111100000110000111111100111010110 = -6	91.3757700205339%
000110110000110101011101010111010011 = -12	90.7597535934292%
010011011000110001001110010111010100 = -44	87.4743326488706%
100011000001101001101100100011010100 = 1	92.0944558521561%
011111110110110100111100100010100011 = -7	91.2731006160164%
100010110111101101101110011011010100 = 122	100%
011111100010111000011011000111000110 = 9	92.9158110882957%
011010110001110001111100100110111000 = -1	91.8891170431211%
000011000101110010011110100011101000 = -896	0%
011011010110101101111100011111101000 = 0	91.9917864476386%
011110110111110000011111011110111001 = 11	93.1211498973306%
011110100010111110001101010011110011 = -1	91.8891170431211%
011011100101111001011101001011111000 = 18	93.8398357289528%
011110110001110110001100010111000110 = -11	90.8624229979466%
011110100100111000011011001011100000 = 0	91.9917864476386%
010011100001101010001100011011010101 = 1	92.0944558521561%
011011000010110010011011001011010110 = -9	91.0677618069815%
011011011001101100011110010011011000 = -16	90.3490759753593%
010011010111101001001101010010110110 = 3	92.299794661191%
000110110110101101101100010011110100 = 2	92.1971252566735%
011011011000111000101101000110101000 = 3	92.299794661191%
000111000111101110011011010111000000 = 8	92.8131416837782%
000111100001101100111011011111111001 = 1	92.0944558521561%
100010100100110101111100010111011000 = -8	91.170431211499%
100011110111110001011100000111101000 = -39	87.9876796714579%
001011101000101100011110000011000100 = -4	91.5811088295688%
000010110100111100111111010011100010 = 1	92.0944558521561%
011111111000101110001100000010110011 = 12	93.2238193018481%
001011000111101000101011010011100111 = 7	92.7104722792608%
001111000000101101011101010010101001 = 13	93.3264887063655%
100111110001111010001010001111101000 = 600	50.9240246406571%
001011110000111000111111010111000001 = 0	91.9917864476386%
100010110001111100101100000110100111 = 10	93.0184804928131%
011111000100111000111101001011100001 = 7	92.7104722792608%
001110100000111100101011011011000101 = 2	92.1971252566735%
011011010111101100011101010111100010 = -10	90.9650924024641%
100011000110110001001110100111100100 = -72	84.5995893223819%
001111000011110000011111000111010010 = -3	91.6837782340862%
100010110011110000101101001011100101 = 35	95.5852156057495%
010010110101110000101101011011000011 = -2	91.7864476386037%
000111100011111000011100100111000000 = -6	91.3757700205339%
000111010011110000101101010111110011 = -3	91.6837782340862%
100011111000101100101100100011100001 = -5	91.4784394250513%
001010110111101001001110000110101000 = 21	94.1478439425051%
010011010110110101101100001011001001 = -19	90.041067761807%
001010110101110101101101100110110001 = -7	91.2731006160164%
011111000101111101001101011110100100 = -2	91.7864476386037%
011011000010111000011011011010110110 = 16	93.6344969199179%
001111001000110001101101100011100010 = -38	88.0903490759754%
011010110000111100011100011110111001 = 8	92.8131416837782%
000111010100101000011110000110110011 = 1	92.0944558521561%
000111101000111110001010010011010111 = -2	91.7864476386037%
001111010101111010001111011111000101 = -7	91.2731006160164%
010010110111111000101110100010110001 = 177	94.35318275154%
011110100100110000001011010011110011 = 5	92.5051334702259%
100011000111101101111111100010111000 = 9	92.9158110882957%
001110100010110000101100011110100010 = -2	91.7864476386037%
001011001000111000111100000010110101 = -13	90.6570841889117%
011011000001111110011111000111101000 = 4	92.4024640657084%
000011001000111000101111000011100011 = -48	87.0636550308008%
100011010100101110001011000111110010 = 6	92.6078028747433%
010010100000111001111100010011100011 = 72	99.3839835728953%
011010110110101000111010000011110010 = 8	92.8131416837782%
001011010011110101101101011110110001 = -13	90.6570841889117%
010111010111101110001100011011000100 = -4	91.5811088295688%
100011110111110000111100001111000001 = -6	91.3757700205339%
100110100110101110001011001111000010 = 24	94.4558521560575%
011010110111110101001011010111000010 = 12	93.2238193018481%
010111100011110000011110001111100001 = 42	96.3039014373717%
001111110011101000011101001111000010 = -3	91.6837782340862%
010111011001110010001111100010110010 = 0	91.9917864476386%
010011101000101000101011011110100100 = 45	96.611909650924%
011110110000111001001101011011010110 = 16	93.6344969199179%
010010110100111100101011010111010110 = 3	92.299794661191%
010111110010101101111100010111110100 = 1	92.0944558521561%
010111100000110001101100001011100001 = -8	91.170431211499%
000111010011110100111100100011000110 = -19	90.041067761807%
010111100111101101101011000011110001 = 41	96.2012320328542%
010011100010111100011101010010100001 = 5	92.5051334702259%
011010100010110000011110100011111000 = 7	92.7104722792608%
000011000101111000111101010111101000 = -160	75.564681724846%
100111100011110101001011011111100010 = 60	98.1519507186858%

-- results abbreviated --

010010110111101101101110011011010100 = 98	98%
100010110111101100011110011011010100 = 92	92%
010010110110101101101110011011010100 = 92	92%
010110110111101101101110011011010100 = 104	96%
010010110111101101101110011011010100 = 98	98%
010110110111101101101110011011010100 = 104	96%
010010110111101101101110011011010100 = 98	98%
010011101000101000101011000011100011 = 102	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110001111100010 = 102	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010110110111101101101110011011010100 = 104	96%
010010110111101101101110011011010100 = 98	98%
010011101000101000101011000011100011 = 102	98%
100010110111101100011110011011010100 = 92	92%
010110110111101101001110001111100010 = 96	96%
010110110111101101001110001111100010 = 96	96%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010110110110101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010110110111101101101110011011010100 = 104	96%
010111100011110000011110011011010100 = 80	80%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110001111100010 = 102	98%
010011100011101101101110011011010100 = 104	96%
010011101000101000101011000011100011 = 102	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010111100011101100011110011011010100 = 92	92%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110001111100010 = 102	98%
010010110111101101101110011011010100 = 98	98%
011111101000110000011110100011110100 = 110	90%
010011100011101101101110011011010100 = 104	96%
010010110111101101001110011010101000 = 98	98%
010110110111101101101110011011010100 = 104	96%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010011100011101101101110011011010100 = 104	96%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101001110011010101000 = 98	98%
010010110111101101001101000111101000 = 112	88%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010011100011101101101110011011010100 = 104	96%
010110110110101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010110110111101101101110011011010100 = 104	96%
010010110111101101101110001111100010 = 102	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010011100011101101101110011011010100 = 104	96%
010110110110101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010011 = 99	99%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010011 = 99	99%
010010110110101101101110011011010100 = 92	92%
010010110111101101001110011010100100 = 94	94%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010010 = 100	100%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110000011100011 = 0	0%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
010010110111101101101110011011010100 = 98	98%
100010110111101100011110011011010100 = 92	92%
010110110111101101101110011011010100 = 104	96%
010010110011101101101110011011010100 = 74	74%
010010110111101101101110011011010100 = 98	98%
010010110111101100011110011011010100 = 68	68%

Done.
010010110111101101101110011011010010
4 + 7 + 6 * 6 - 2 = 100
Completed 42 epochs.
Encountered 0 mutations in 683 offspring.

 

Example Results 2

Here, I lowered the population to 50, and increased the mutation rate to 0.1 (i.e.; 1 in 10 randomly chosen to mutate).  The results are chaotic, but the target was randomly achieved after only 10 generations.

 

001010101000101100011110000111000000 = 11	70.6521739130435%
000011100101101001001101100111011001 = -14	61.5942028985507%
011011100010101010011110001010110101 = 47	83.695652173913%
000011000101110101111110000111010101 = -17	60.5072463768116%
011011110111110001101010010011100110 = -7	64.1304347826087%
010010100010101100101100000011110000 = 8	69.5652173913043%
011011101000101100101100000111011000 = 41	81.5217391304348%
011111000001101101011011001011000110 = 7	69.2028985507246%
000111000001111000111110011110111000 = 8	69.5652173913043%
001011110001110100011011001011010100 = -1	66.304347826087%
100011000111110101011110000111000111 = -11	62.6811594202899%
010111100010101101101110001111101000 = 384	0%
100111100100110101011101011010100010 = 27	76.4492753623188%
001111110010101101001101011011001000 = -8	63.768115942029%
001010100111110001001110010011010111 = 13	71.3768115942029%
011011000110101100011101011110100101 = -1	66.304347826087%
100111010000110010001100010111001000 = -12	62.3188405797101%
010111110110111010011110000111000111 = 0	66.6666666666667%
100011110001110101001010000011010111 = -3	65.5797101449275%
000111000001111001101101010111100100 = -20	59.4202898550725%
010111010000110101011110011011010101 = -5	64.8550724637681%
100111010001101101111101100011100101 = 35	79.3478260869565%
011110100110110101001100100110110011 = 3	67.7536231884058%
100010111000110001101111011011010101 = -3	65.5797101449275%
100011100010111100101011001011000111 = 3	67.7536231884058%
011110110010110010001100000111001001 = -9	63.4057971014493%
000111000110110000001111100111110000 = -1	66.304347826087%
011111010111110010001101100011111001 = -2	65.9420289855073%
011111001000110000011010100010110001 = 7	69.2028985507246%
100010110011101000001110010110100100 = 59	88.0434782608696%
011011110110111101101110001010101001 = 9	69.9275362318841%
100010110001110100001100010111010111 = -3	65.5797101449275%
011110100101110101101111011111000110 = -5	64.8550724637681%
000011000111110101001010001010110010 = -7	64.1304347826087%
001110101000101001101110100010110010 = 138	89.1304347826087%
001110110110111101111100000110110101 = 5	68.4782608695652%
000110110100110100011100000111100011 = 9	69.9275362318841%
011111100011111100101111000111010001 = 10	70.2898550724638%
001110110101110010001100011111010101 = -12	62.3188405797101%
011110110100111001011110001010110110 = 116	97.1014492753623%
011111000111111010011110010011010101 = -5	64.8550724637681%
010111010001101100111111001010110100 = 8	69.5652173913043%
010111010100111100101010011111000100 = 4	68.1159420289855%
100011000101111001101100011010110001 = 13	71.3768115942029%
011011100001110110011101000011001000 = -11	62.6811594202899%
010011010100111001011111011011101001 = 0	66.6666666666667%
100010110100111010001111000111010100 = 92	100%
000010100110111000011100000111100110 = 30	77.536231884058%
011011010110110001011101000011010101 = -10	63.0434782608696%
011111010110110110011101000110110111 = -2	65.9420289855073%

-- results abbreviated --

011110110100111001011110001010110110 = 116	83.5051546391753%
011110110100111001011110001010110111 = 117	82.4742268041237%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110100111010001111000111011000 = 88	87.6288659793814%
011111000001111001011110001010110111 = 67	65.979381443299%
100010110100111010001111000110110101 = 101	98.9690721649485%
100010110010101010011110001010110101 = 43	41.2371134020619%
100010110100111010001111000111011000 = 88	87.6288659793814%
100010110010101010011110010011010101 = 71	70.1030927835052%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110100111010001111000111010100 = 92	91.7525773195876%
011110110100111010001111000111010100 = 84	83.5051546391753%
011110110100111001011110001010110101 = 115	84.5360824742268%
100010110100111001011110001010110110 = 126	73.1958762886598%
011110110100111010001111000110110101 = 93	92.7835051546392%
100010110100111010001111000111010101 = 91	90.7216494845361%
100010110100111010001111000111010100 = 92	91.7525773195876%
011110110001111001011110000111011000 = 32	29.8969072164948%
011110110100111010001111000111010100 = 84	83.5051546391753%
011111000001111010011110001010110101 = 113	86.5979381443299%
100010110100111010001111000111011000 = 88	87.6288659793814%
011110110100111001011110000111010100 = 51	49.4845360824742%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110100111010001111000111010100 = 92	91.7525773195876%
011110110100111010001111000111010100 = 84	83.5051546391753%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110001101110011110010011010101 = 67	65.979381443299%
011111010001101110011110010011010101 = 55	53.6082474226804%
011110110100111001011110000111010100 = 51	49.4845360824742%
011110110001111001011110000111010011 = 37	35.0515463917526%
011110110001111001011110000111010101 = 35	32.9896907216495%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110010101010011110001010110110 = 44	42.2680412371134%
100010110100111001011110001010110111 = 127	72.1649484536082%
011111000001111010011110001010110100 = 112	87.6288659793814%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110100111010001111000111010101 = 91	90.7216494845361%
100010110010101010011110001010110101 = 43	41.2371134020619%
100010110100111010001111000110110100 = 100	100%
100010110100111010001111000111011000 = 88	87.6288659793814%
100010110100111010001110001010110101 = 197	0%
011110110100111010001111000111010100 = 84	83.5051546391753%
011111000001111010011110001010110101 = 113	86.5979381443299%
100010110110111010001111000111010100 = 108	91.7525773195876%
100010110100111010001111000111010100 = 92	91.7525773195876%
011110110100111010001111000111010100 = 84	83.5051546391753%
100010110001111001011110001010110111 = 97	96.9072164948454%
100010110100111010001111000111010100 = 92	91.7525773195876%
100010110100111010001111000111010100 = 92	91.7525773195876%
011111000001111001011110000111011000 = 22	19.5876288659794%

Done.
100010110100111010001111000110110100
8 + 4 * 8 / 1 + 4 = 100
Completed 10 epochs.
Encountered 17 mutations in 174 offspring.

 

Example Results 3

This time, the population was set to 50, mutation rate set to 0.001.  The results show a resulting population of clones, all with the same chromosome.  The testing stopped as the fitness values all became "NaN".

000011100110101010001101100010110111 = 7	91.2237330037083%
011111010011111000101100011111000111 = -6	89.6168108776267%
010011010000111001111101000011110011 = 9	91.4709517923362%
011110110011110001011101100010110011 = 0	90.3584672435105%
010111010101101101001110001011010100 = 4	90.8529048207664%
001011100000101000001011100011101000 = 64	98.2694684796045%
010011010110111100001010100011000110 = 0	90.3584672435105%
010110111000111100111110100110110100 = 43	95.6736711990111%
100010111000110100011101010110100110 = 16	92.336217552534%
000011101000110010001010100111000010 = -1	90.2348578491965%
011010110101110000111101100010110110 = 6	91.1001236093943%
001111010000111101001101000111010110 = -6	89.6168108776267%
011111010010110000111100010011100000 = 0	90.3584672435105%
000111101001111100111100010010110111 = 6	91.1001236093943%
000011100101101100101101001011000101 = -5	89.7404202719407%
010110110100111110001100010111100100 = -16	88.380716934487%
011111001000101101101011010010110110 = 15	92.21260815822%
001111100100110101111101100010110101 = 2	90.6056860321384%
011011011000110000101110011111000101 = -33	86.2793572311496%
100110111000110101001100010011000010 = 7	91.2237330037083%
001111000111110000111101010011000011 = -14	88.627935723115%
011111001000111001011100011011010011 = -14	88.627935723115%
011011100100110000101011011111110010 = 14	92.0889987639061%
011010100110101101001110010011000011 = 61	97.8986402966625%
011011010001111010011010100110110101 = 59	97.6514215080346%
010111110000101101101011100010110111 = 26	93.5723114956737%
100010110100101101111110011111100111 = 931	0%
010111000101101101101100011011100111 = 0	90.3584672435105%
011010100110101110001110011010101000 = 128	99.2583436341162%
011011110001111001111101001111100010 = 78	100%
010011100100111001001101000011100111 = 448	59.7033374536465%
011010101000110001111011001111000101 = 5	90.9765142150803%
010111100011110001011101010110110100 = 9	91.4709517923362%
011110110101110000101110000010100000 = 0	90.3584672435105%
000111100110111001001101011011110000 = 18	92.5834363411619%
000111110100111001011011100011110011 = 3	90.7292954264524%
100011110010110010001011100011010001 = 3	90.7292954264524%
010111010001111000001110100011001000 = -8	89.3695920889988%
000111110011101101101011010111000011 = 8	91.3473423980222%
010111110010110100111101000011110100 = 0	90.3584672435105%
010110110101110101111101001011000011 = -2	90.1112484548826%
001111001000101000011110100111110011 = -12	88.8751545117429%
001111000010111000001110010110110010 = 2	90.6056860321384%
011010110011110101011011010011111000 = 1	90.4820766378245%
010011011000110001111100100010110110 = -13	88.7515451174289%
001011000011110100111110010011010111 = -23	87.5154511742892%
011011110010110101101101100011000010 = -13	88.7515451174289%
011111100100110110011011100011010100 = 23	93.2014833127318%
010011000100101100111100011111000011 = -7	89.4932014833127%
010111000100101101111100100011100101 = 0	90.3584672435105%

-- results abbreviated --

011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%
011011110001111001001110010010110011 = 99	NaN%

Done.
The whole population's fitness score is NaN.
Completed 69 epochs.
Encountered 1 mutations in 577 offspring.

 

Example Results 4

Sometimes the algorithm completes all epochs up to MaxEpochs, and achieves nothing.

There are a couple possibilites why this might happen. One reason is that the mutation rate might be to high (i.e.; too frequent), or the mutation function is too extensive (i.e.; changing too many genes at once), can cause the overall solution to become too erratic to ever acheive its target. Another possibility is when the algorithm gets stuck in local minima (i.e.; when the whole population become clones, as in Example Results 3).

-- results abbreviated --
011011100110110001101011001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110110001101011001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	100.0%
011011100110101100001101001111100011 = 99	0.0%

Epoch: 101
Done.
Completed 101 epochs.
Encountered 0 mutations in 649 offspring.

 

Notice that no solution appears in the printed results.

 

 

public void footer() {
About | Contact | Privacy Policy | Terms of Service | Site Map
Copyright© 2009-2012 John McCullock. All Rights Reserved.
}