Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
My first genetic algorithm that finds the given number
Java
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.settings
bin
src
.classpath
.project
README.md

README.md

What is this?

This is my first genetic algorithm. I have followed the tutorial here. You can observe that the code is almost the same. I only adjusted it a little for a different purpose. I strongly recommend the tutorial if you are interested.

What does it do?

It finds a given number. Each gene represents a digit. For simplicity, you need to enter the number as an int array. You don't need to worry about the length of the array.

How does it do it?

As I said, I recommend the tutorial I followed. However, I will try to summarize it. Basically, you generate a population with random gene sequences. Then you constantly try to select the best ones you have and then cross them. Also you add some randomness using mutations. The reason for this is to be able to expand our possible combinations set.

How do I use it?

Just set the variables in the Main.java and you're good to go. You can see the purposes of these variables as comments in the code. Playing with these is funnier than it looks.

Something went wrong with that request. Please try again.