Skip to content

This algorithm uses genetic programming to find the formula of volume and area of the cylinder.

Notifications You must be signed in to change notification settings

emre-sahinn/GeneticProgramming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Genetic Programming

Genetic programming was derived from the model of biological evolution. At first we generate random trees that holds p, r, h strings and " * , / , +, -" operations as string. As you know, area of the cylinder is 2xpxrxh and volume is pxr^2xh. Then we randomly crossover tree's genes that generated randomly. After crossovers our radiation session starts! We randomly mutate our trees genes. At last, we kill all the trees that are under some threshold. Repeat these steps until there are few trees left. Finally, we can print all the remaining trees!

Main Program

9

Finding the area of the cylinder formula

10

Wait!? This looks like wrong! but actually it is not. Program traverse our trees in infix order and we do not have parenthesis, so actually this is "pxhx(r+r) = pxhx2r"

Now let's try to find the volume of the cylinder formula

11

Again, it looks wrong at first glance but it is NOT! We actually multiply h by h then divide by h, this is equivalent to h.

About

This algorithm uses genetic programming to find the formula of volume and area of the cylinder.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages