02 MA Genetic Algorithms Research

The research was based on the study of Shiffman’s Genetic algorithm explanations as the groundwork for the field of study. This was also the basis of our MA openframeworks journey and code using Genetic algorithms.


The basis of genetic algorithms is the solving of quite difficult problems which if done sequentially will be very hard to complete in a short space of time. (Example: How to obtain a sentence that is calculated using genetic code.)

Population  We need a population of something defined (examples; sentances ;graphical objects) that we can use our DNA on and to somehow change the physical aspects of the objects in some way. 

The population creation should also create its own DNA. Whenever a class object is created.

Perhaps the attraction force to a mouse or blobs increases when the objects are selected. Also, the attraction force is hereditary.


We define a phenotype and genotype

genotype. The DNA. What is the DNA? Normally a code, or number stored in a array list. No limit on number of DNA codes. The key to the DNA is the phenotype. How we choose to physically express the DNA. We can either express the DNA as a actual defined object ( e.g. types of animals ) or we can be quite obtuse and define the DNA as a floating decimal between 0-1.

phenotype: How do we use the DNA? In this case we use a population of spheres with a simple physics engine using perlin noise as the force vector driving the acceleration. What does the the DNA do? We can access only one agent of the DNA. What do we do with it? We use it to drive both the size and speed of the spheres. The direction is using the perlin noise. The DNA give us the values between 0-1 and then we map them to a phenotype ( a physical property).


The fitness algorithm. 

This is probably the most important feature of genetic algorithms, It decides on whether an existing member of the population exists or not. How do we decide that? We can either use a simple algorithm to make the case for a member of the population to survive or we can use the input from an outside force the user! The third option is fascinating. Decide on whether a element of the population survives by using a random means. In this case we create x,y point of “food: whereby if the element of the population comes near them then they can be fed and stay alive ( be healthy ). Also if they stay alive for long enough they can create new offspring. They survive and breed.

Why use them ?  – We can obtain difficult solutions very fast. The classical way of using them is to run a series of sequences (either using time as a factor of finishing an event or having a lifespan determining a measured event). However, the clever way to use them is to have “health” factor determine there existence then have this heath factor augmented by a user event, an interactive event. Or do both!


Shiffman’s solution for Genetic Algorithms


The initial equation by shiffman just uses spheres: Each sphere receives its DNA that defines is speed and size and its color is defined by its “health”. The spheres are dying since there birth. There health is defined by a clock that ticks downwards. If they manage to find food (the grey rectangles) they increase there health. If they live for long enough they have a higher chance of reproduction.





Development of the ecology experiment

From the initial setup of the ecology programme the first thing I did was to expand the DNA values to accept over 20 values and start populating them with different variables as a test:


The DNA values could also include elements to address the sound associated with each class of display elements. Something to investigate later.

The first two tests showed the DNA controlling the colour,  the  no. of polygons and the type of element displayed.



The second one shows the food following the mouse position


User Interaction

The next step was to add the health if they come into contact with the mouse or attraction force target.



Add-on DNA attraction force

Add the ability for the elements to be attracted to the mouse if they are selected by the user (or come within a certain distance of the mouse.).