Evolutionary systems & genetic algorithms
From GenerativeArt
(Difference between revisions)
(→Genetic Variation Operations) |
(→An Aside Regarding Bit String Genetic Representations) |
||
In both cases the mean degree of change is 3.75. In the case of binary codes there are as many transitions above the mean as below the mean. But in the case of gray codes 44 transitions are below the mean and 20 transitions are above the mean. Gray code provides a system where mutations result in a greater number of small changes, and a lesser number of large changes. | In both cases the mean degree of change is 3.75. In the case of binary codes there are as many transitions above the mean as below the mean. But in the case of gray codes 44 transitions are below the mean and 20 transitions are above the mean. Gray code provides a system where mutations result in a greater number of small changes, and a lesser number of large changes. | ||
- | + | <span style="font-size:larger">Binary to Gray Code Conversion</span> | |
+ | 1. Number the digits 1, 2, 3 … n | ||
+ | 2. Copy B[1] to G[1] | ||
+ | 3. For G[2], G[3] … G[n] | ||
+ | G[i] = XOR(B[i], B[i-1]) | ||
- | + | Example: convert 1011 | |
+ | Binary Gray | ||
+ | <font color="red">1</font>011 COPY <font color="red">1</font> | ||
+ | <font color="red">10</font>11 XOR 1<font color="red">1</font> | ||
+ | 1<font color="red">01</font>1 XOR 11<font color="red">1</font> | ||
+ | 10<font color="red">11</font> XOR 111<font color="red">0</font> | ||
+ | Note: XOR is the eXclusive-OR function | ||
+ | Inputs Outputs | ||
+ | 0 0 0 | ||
+ | 0 1 1 | ||
+ | 1 0 1 | ||
+ | 1 1 0 | ||
+ | |||
+ | <span style="font-size:larger">Gray Code to Binary Conversion</span> | ||
+ | 1. Number the digits 1, 2, 3 … n | ||
+ | 2. Copy G[1] to B[1] | ||
+ | 3. For B[2], B[3] … B[n] | ||
+ | B[i] = XOR(G[i], B[i-1]) | ||
+ | |||
+ | Example: Convert 0100 | ||
+ | Gray Binary | ||
+ | <font color="red">0</font>100 COPY <font color="red">0</font> | ||
+ | 0<font color="red">1</font>00 XOR 0<font color="red">1</font> | ||
+ | 01<font color="red">0</font>0 XOR 01<font color="red">1</font> | ||
+ | 010<font color="red">0</font> XOR 011<font color="red">1</font> | ||
== Example of Classic Genetic Programming for Problem Solving - Lawrence Fogel == | == Example of Classic Genetic Programming for Problem Solving - Lawrence Fogel == |