This project demonstrates a Genetic Algorithm (GA) implemented in Python to evolve a population of strings until it matches a given target string.
It is a beginner-friendly example showing the core concepts of evolutionary algorithms.
- Random population initialization
- Fitness-based sorting of individuals
- Selection of best parents
- Crossover to create new children
- Mutation to maintain diversity
- Stops automatically when the target string is found
- Population โ set of candidate solutions
- Fitness Function โ measures how close a string is to the target
- Selection โ choosing best individuals for reproduction
- Crossover โ combining two parents to form a child
- Mutation โ random character change to explore new solutions
- Elitism โ keeping the best individuals for the next generation
- Python 3
- Standard libraries (
random)
- Clone this repository:
git clone https://github.com/NARASIMHA045/genetic-algorithm.git