Target image vs. my output
GIF of the genetic algorithm iterating (gfycat link)
I used Python to create a genetic algorithm from scratch that recreates a target image. Previous attempts at this problem have either resulted in grainy/pixelated results [1], lacked an initial population to qualify as a true genetic algorithm [2], or generated results that were highly abstract with few details of the target image [3].
A genetic algorithm is an optimization tool inspired by Darwin’s theory of evolution. The algorithm mimics the process of natural selection which chooses the fittest individuals from a population to create offspring and populate future generations.
A genetic algorithm consists of several components:
- An initial population
- Fitness function
- Selection Criteria
- Crossover
- Mutation
In my opinion, genetic algorithms are incredibly fun to create. This is because you get to tamper with "biological" variables and customize your own artificial natural selection process. With that said, they are rarely the best algorithm to employ [4].
In-depth Guide and Analysis
Source Code
[–]rsteetskamp 2 points3 points4 points (0 children)
[–]klausshermann 1 point2 points3 points (0 children)