Skip to content

lchavez1/genetic_algorithm_java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

genetic_algorithm_java 🧬

This is the genetic algorithm with Java to solve One Max problem.

What is GA? 🧬

A genetic algorithm (or GA for short) is a programming technique inspired by the reproduction of living beings and that mimics biological evolution as a strategy to solve optimization problems.

GA and Biological Evolution 🧬🐒

The Genetic Algorithm is based on Biological Evolution, Darwin defined evolution as "descent with modification," the idea that species change over time, give rise to new species, and share a common ancestor. On this case we simulate that teory using 3️⃣ operators:

  • Selection, this is like natural selection. It is just as we human beings do, throughout our lives we choose a partner, in this case, as it is an algorithm, this partner is defined by certain random parameters.
  • Crossover, Simulates the reproduction process of a living being, where the child obtains traits from both parents. 👨‍👩‍👧‍👦 Here we simulate with a random process.
  • Mutation, Darwin back in 1859, in his fifth chapter of the book "The Origin of Species" 📖, said that: "The species that survive are not the strongest, but those that are best adapted to change". on this algorithm we need to make some mutations to the solutions to get the most suitable solutions.

What is One Max? 1️⃣

The OneMax Problem [SE91] (or BitCounting) is a simple problem consisting in maximizing the number of ones of a bitstring.

  • Example:

We have the solution [1, 0, 0, 1] the One Max say the solution should be to [1, 1, 1, 1] so the max number of 1's and that means the solution are optimized. On this case I apply tis principle to a population of n solutions.

image

If you have some question I would be happy to help you. 😄 Also, you can contact me on Twitter (@luischavez_713), I speak spanish too.

Made with ❤️ by Fer Chávez 😊

About

This is the genetic algorithm with Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages