The "evolution" of GA Math
- Posted by DB James <larch at adelphia.net> Sep 30, 2005
- 673 views
Report on the "evolution" of GA Math Version 1.2 To everyone (sorry for any mangled formatting): I have continued to modify GA Math. The latest update is version 1.2. It is now flicker-free and the user interface is simple and stripped-down. The program is now more sophisticated, faster, and capable of handling moderately complex formulas. As before the program is a "tweaker's paradise". If you do change the program, it might be good to modify a copy. Here is a list of formulas for which it has successfully created matching algorithms: "v=l*w*h" "a=3.14159*(r^2)"--area of circle "a=4*3.14159*(r^2)"--harder (area of sphere) "v=4/3*3.14159*(r^3)"--harder (volume of a sphere) "x=2*a*3*b*4*c" "a=100*x" "a=(x-y)/z" "a=(2*x-y)/z" -- hard, but doable "a=(2*x-(3*y))/z" -- harder, but doable "a=(2*x-(3*y))/(4*z)" -- harder, but doable (takes a longish time) A typical report with comments added: -------------------------------------------------- GA Math Beings Report -------------------------------------------------- Math Beings working on formula : a=(x-y)/z -- <<< the formula Number of try-sets per run : 1200 --<<< maximum number of try sets per run Number of runs this session : 3 -- --<<< number of runs this attempt Number of tries per try-set : 8 --<<< each population has this number of tries before assessment This is try-set number : 520 --<<< this many try-sets have occurred in this run Target value : 0.0010 --<<< must get within this percentage to be successful Current closeness (percent) : 0.000000 --<<< the percentage at moment of success Most successful being's original register values: {[5.46] , [7.53] , [3.70] , [8.99] , [0.30] , [8.00] , [0] , [0] , [0]}--<<<nine register locations (in this case) -- x-val y-val z-val Priv1 Priv2 Priv3 <<<< three variables & three private numbers --********************************************************************************************** -- <<< Note the private numbers above; there is one for each variable. Each being has a set of randomly -- <<< generated private numbers that *do not change* in a being's lifetime, but do change in transferring -- <<< to a clone. --********************************************************************************************** Most successful being's genes: --<<< In this example, there were only two relevant genes needed to -- <<< create an algorithm to solve the formula. Most successful being's original register values: -- <<< Repeating these two lines {[5.46] , [7.53] , [3.70] , [8.99] , [0.30] , [8.00] , [0] , [0] , [0]}--<<<nine register locations (in this case) sub, 1, 2, 2 {[5.46] , [-2.07] , [3.70] , [8.99] , [0.30] , [8.00] , [0] , [0] , [0]} div, 2, 3, 9 {[0] , [-2.07] , [3.70] , [-5.29] , [0.30] , [-8.99] , [-3.70] , [0] , [-0.56]} Last actual answer from formula: -0.560 ------------------------------------------------ The above successful being had to deal with at least 16 randomly generated sets of x, y, and z values, of which you see in this report only the last one. More general comments: There are now 7 register locations in each being where the math operations take place. The final answer must always be in the last register location. There are 11 operations as follows: constant OPS={ {"abs",1}, {"rec",1}, {"chg",1}, {"add",2}, {"sub",2}, {"mul",2}, {"div",2}, {"int",1}, {"rem",2}, {"frc",1}, {"nop",0} } Note: the number next to each operation is the number of "from" register locations it uses. abs=absolute, rec=reciprocal, chg=change-sign, int=floor, rem=remainder, frc=decimal fraction, and nop=no operation ============================================================= To ck, Well, do you think GA Math does exhibit evolution? Of course you know that I think it does. One thing I've seen over and over is that there are two different sorts of evolution: gradual and dramatic. The gradual type is represented, for example, by the way PI is often found. Beginning with maybe a "3", using the private numbers (which change when cloning occurs), the program can edge closer and closer to true PI over time, and consequently its accuracy improves toward success. This gradual type is what we often think of as "evolution". However, many math algorithms depend on a set of discrete actions in the right order or it doesn't work at all, that is, it is not a matter of being close, but of getting a complex thing right bang on. Evolution can handle that, but it takes much longer. The formula "a=(2*x-(3*y))/4z" is an example. GA Math can figure it out, but it takes a while. You might say it works, but isn't pretty. With bio-evolution, though, once such a thing is made, it then becomes subject to gradual evolution. ============================================================= To Al Getz, The private numbers occur one-to-one for each variable used. They last the lifetime of the being, so tracking it shouldn't be an issue. They do evolve over time as the successful half of the population is cloned. Many thanks for testing this program and letting me know how it went. Most of the changes have been in response to your investigations. ============================================================= A recent example of good luck: -------------------------------------------------- GA Math Beings Report -------------------------------------------------- Math Beings working on formula : 3.14159*r*r Number of try-sets per run : 1200 Number of runs this session : 2 Number of tries per try-set : 8 This is try-set number : 121 Target value : 0.0010 Current closeness (percent) : 0.000058 Most successful being's original register values: {[11.38] , [3.14] , [0] , [0] , [0] , [0] , [0]} Most successful being's genes: mul, 1, 1, 7 {[11.38] , [3.14] , [0] , [0] , [0] , [0] , [129.39]} mul, 2, 7, 7 {[11.38] , [3.14] , [0] , [0] , [0] , [0] , [406.47]} Last actual answer from formula: 406.492 -------------------------------------------------- It usually takes longer than that! Keep in mind that though there are checks to try to eliminate "lucky inputs", it does happen, so some algorithms will not prove out. For that reason, it is a good idea to make several runs on a formula to assure getting a decent (though sometimes quite weird) algorithm. I want to turn my attention to other programming for awhile, so won't be doing any more upgrades in the near future, though others can do so if they wish and send them to RDS. However, I'll be around to answer any questions about the program. --Quark