This is the genetic algorithm with Java to solve One Max problem.
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.
- Conogasi, (2018). Algoritmos genéticos | Conogasi. https://conogasi.org/articulos/algoritmos-geneticos/
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.
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.
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 😊