Sunday, 6 May 2012

Genetic Simulation Chemestry

I have started work on building an environment and rules in witch and evolutionary development of 'cells' may take place. To arrive this I need to simulate a chemistry system. however i have very little understanding of chemistry and to simulate it properly would be very computationally heavy so I have chosen the flowing system:

Elements as Prime numbers:
To model a chemical we consider it as a unique combination of elements, since I do not care in witch order these elements occur the system Integer number lends itself to this, since each number is made up of a unique product of its prime factors. Therefore I can distinguish between to chemicals just my comarion their number. eg {42}$\neq${43}
and find their elements by factorizing: eg {12} = {2:2,3:1} were {n:i} depicts $n^i$.

Importantly I need a means to restrict the number of connections any element $p$ can provide to any other element $q$, ($q$ and $= p$). To do this I have adopted the  $ \phi(p_i - 1)  $  (Totientto depict the number of connections that can be made to $p$. So the total number of connections for a chemical $N$  with prime factorization: $ \left\lbrace{p_0^{a_0},p_1^{a_1},\dots p_m^{a_m}}\right\rbrace$
is:
$\left\lfloor{\frac{\left(\sum_{i=0}^{i=m} \phi(p_i - 1)\times a_i\right)}{2}} \right\rfloor +1 $

This in practice recuses the posible set of chemicals that can exists, as for instans $2^2 = 4$ is posible but $2^3 = 8 $ is not.

To ensure that energy in maintained I have adopted the following energy rules:
The total energy bound up in a chemical is the number of unique prime factors, this means that if I react:
$\lbrace2,5\rbrace +\lbrace 2\rbrace  \implies \lbrace 2^2,5 \rbrace$ the totale energy bound up in the LHS is $2+1=3$ were as the total energy on the RHS is only 2,  so this reaction will have given of 1 unit of energy.
Examples:
$\lbrace2^2,7\rbrace +\lbrace 2,13,7\rbrace  \implies \lbrace {2^3, 13, 7^2} \rbrace$
results in and energy gain of 2

$\lbrace2^2\rbrace +\lbrace 5,3\rbrace  \implies \lbrace {2, 3, 5}\rbrace +  \lbrace{2} \rbrace$
results in and energy cost of 1

Generic Catalysts --- Ways of selecting wich chems to react together:
To do this we can look at the $gcd$ of two selected chemicals the large the $gcd$ the higher the probability that when combined the will be a resulted energy gain.

Rather than be absolute i want these filters to by fallible, (i hope this may course 'poisons' to evolve).

Environment:
The simulation is based in a 2D world. With geothermal vents that emit large amount of energy and heavy chemical, (the weight of a chemical is its raw value.. eg the weight of {12} = 12) this means that there is a heigh prop of finding high value 'Element' primes in these areas, however photosynthesis will not be very successful, the greater the mass of the mean chemicals the lower the light intensity.

Other ares will be very low density and full of lighter chemicals, this is good for photosynthesis but cells with a small mass (sum of all the weights of all the chems currently within the cell) will be much more susceptible to temperature variations. Also higher value (more useful) elements will be much less common.