A genetic algorithm is a search algorithm that is inspired by "Darwin's idea of evolution in Nature." It is used in machine learning to tackle optimization problems. It is an important algorithm since it aids in the solution of difficult problems that would otherwise take a long time to solve.
Genetic algorithms are frequently employed in a variety of real-world applications, such as designing electronic circuits, breaking codes, image processing, and artificial creativity.
To better comprehend this algorithm, let's first define some basic terms:
- Population: A population is a subset of all viable or probable solutions to a particular problem.
- Chromosomes: A chromosome is one of the population's solutions to a given problem, and a chromosome is generated by a collection of genes.
- Gene: A chromosome is divided into various genes, or it is a chromosome element.
- Allele: An allele is the value assigned to a gene on a specific chromosome.
- Fitness Function: The fitness function is used to determine an individual's fitness level in comparison to the rest of the population. It refers to a person's ability to compete with other people. Individuals are evaluated based on their fitness function in each iteration.
- Genetic Operators: The best individual mate in a genetic algorithm to regenerate children better than parents. Here, genetic operators influence the genetic composition of the next generation.
- Selection: After determining the fitness of each individual in the population, a selection procedure is employed to identify which individuals in the population will reproduce and generate the seed that will become the next generation.
Styles of selection available
- Choosing a roulette wheel
- Choosing an Event
- Selection based on rank
So, a genetic algorithm can now be defined as a heuristic search technique for solving optimization problems. It is a subset of evolutionary algorithms that are employed in computer science. A genetic algorithm solves optimization issues by combining genetic and natural selection techniques.
The evolutionary generational cycle is used by the genetic algorithm to create high-quality solutions. These algorithms employ several processes that either enhance or replace the population to provide a better fit answer.
Solving Optimization issues with 5 steps
To solve difficult optimization issues, it consists of five steps, which are as follows:
- Fitness Assignment
The operation of a genetic algorithm begins with the generation of a population of humans. Each person is the solution to the given problem. Genes are a set of parameters that define or define an individual. The difficulty can be solved by stringing together genes to form chromosomes. The usage of random binary strings is one of the most prevalent initialization strategies.
What fitness function is used to determine an individual's level of fitness? It refers to a person's ability to compete with other people. Individuals are evaluated based on their fitness function in each iteration. Each individual receives a fitness score from the fitness function. This score also impacts the likelihood of being chosen for reproduction. The higher the fitness score, the more likely it is that the individual will be selected for reproduction.
Individuals for progeny reproduction are chosen during the selection phase. To enhance reproduction, all of the selected individuals are put in pairs of two. These people then pass on their genes to the next generation.
There are three kinds of selection procedures available:
- Choosing a roulette wheel
- Selection for the tournament
- Selection by rank
Following the selection process, the reproduction step results in the birth of a kid. The genetic algorithm employs two variation operators in this step, which are applied to the parent population. The following are the two operators involved in the reproduction phase:
- Crossover: The crossover is crucial in the reproduction phase of the genetic algorithm. A crossover point within the genes is chosen at random throughout this process. The crossover operator then switches the genetic information of two current generation parents to create a new individual representing the offspring.
Parents' genes are transferred among themselves until the crossover point is reached. These newly produced children are incorporated into the population. This procedure is also known as crossover. Available crossover styles include:
- One point crossover
- Two-point crossover
- Inheritable Algorithms crossover
- Livery crossover
To preserve population variety, the mutation operator introduces random genes into the progeny (new child). It is possible to accomplish this by flipping some chromosomal bits.
Mutation helps to solve the problem of early convergence and boosts diversification. The following picture depicts the mutation process:
- Flip bit mutation
- Exchange/Swap mutation
- Gaussian mutation
When the threshold fitness solution is attained, the algorithm terminates. It will select the final solution as the best in the population.
General Workflow of simple Genetic Algorithm
In machine learning, a genetic algorithm is a member of the evolutionary algorithm family that is employed in computation. Because they employ historical data to find the best feasible solution, they are far more sophisticated than random search algorithms. In this article, we have covered what is Genetic Algorithm, its application. Hope you find this article helpful!