 1593350760

# Genetic Algorithm (GA): A Simple and Intuitive Guide

Learn what are metaheuristics and why we use them sometimes instead of traditional optimization algorithms. Learn the metaheuristic Genetic Algorithm (GA) and how it works through a simple step by step guide.

#genetic-algorithm #algorithms #optimization #metaheuristics #data-science #algorithms

## Buddha Community  1593350760

## Genetic Algorithm (GA): A Simple and Intuitive Guide

Learn what are metaheuristics and why we use them sometimes instead of traditional optimization algorithms. Learn the metaheuristic Genetic Algorithm (GA) and how it works through a simple step by step guide.

#genetic-algorithm #algorithms #optimization #metaheuristics #data-science #algorithms 1624882500

## A Guide to Genetic ‘Learning’ Algorithms for Optimization

In a broader mathematical or computational perspective, an optimization problem is defined as a problem of finding the best solution from all feasible solutions. In terms of Machine Learning and Artificial Intelligence, two significant algorithms that perform these tasks are Reinforcement Learning and Genetic Algorithms. They serve the purpose of finding the ‘best fit’ solutions from a range of possible solutions for a given problem statement. In the article that follows below, we will be working closely on these algorithms and will see their implementation in action on an Image Processing problem.

### What is a Genetic Algorithm (GA)?

Genetic algorithms are random, adaptive heuristic search algorithms that act on a population of doable solutions. they need loosely supported the mechanics of population biology and choice.

Genetic algorithms are based on the ideas of natural selection and genetics. New solutions are typically made by ‘mutating’ members of this population, and by ‘mating’ 2 resolutions along to create a replacement solution.

The upper solutions are selected to breed and change and so the more severe ones are discarded. They are probabilistic search methods; this implies that the states that they explore are not determined entirely by the properties of the problems. A random method helps to guide the search. Genetic algorithms are utilized in AI like different search algorithms utilized in AI — to seem for potential solutions to hunt out one that solves the matter.

#artificial-intelligence #genetics #algorithms #data-science #genetic ‘learning’ algorithms 1626429780

## What is Optimization?

• Making something better.
• Increase efficiency.

## Optimization problem

• A problem in which we have to find the values of inputs (also called solutions or decision variables) from all possible inputs in such a way that we get the “best” output values.
• Definition of “best”- Finding the values of inputs that result in a maximum or minimum of a function called the objective function.
• There can be multiple objective functions as well (depends on the problem).

## Optimization algorithm

An algorithm used to solve an optimization problem is called an optimization algorithm.

## Evolutionary Algorithms

Algorithms that simulate physical and/or biological behavior in nature to solve optimization problems.

## Genetic Algorithm (GA)

• It is a subset of evolutionary algorithms that simulates/models Genetics and Evolution (biological behavior) to optimize a highly complex function.
• A highly complex function can be:
• 1. Very difficult to model mathematically.
• 2. Computationally expensive to solve. Eg. NP-hard problems.
• 3. Involves a large number of parameters.

## Background of GA

• Introduced by Prof. John Holland in 1965.
• The first article on GA was published in 1975.
• GA is based on two fundamental biological processes:
• 1. Genetics (by G.J. Mendel in 1865): It is the branch of biology that deals with the study of genes, gene variation, and heredity.
• 2. Evolution (by C. Darwin in 1875): It is the process by which the population of organisms changes over generations.

## Natural selection in Evolution

1. A population of individuals exists in an environment with limited resources.
2. Competition for those resources causes the selection of those fitter individuals that are better adapted to the environment.
3. These individuals act as seeds for the generation of new individuals through recombination and mutation.
4. Evolved new individuals act as initial population and Steps 1 to 3 are repeated.

## Applications of GA

• 1. Acoustics
• 2. Aerospace Engineering
• 3. Financial Markets
• 4. Geophysics
• 5. Materials Engineering
• 6. Routing and Scheduling
• 7. Systems Engineering

## Problems with GA

• 1. Population Selection Problem
• 2. Defining Fitness Function
• 3. Premature or rapid convergence of GA
• 4. Convergence to Local Optima

#evolutionary-algorithms #data-science #genetic-algorithm #algorithm 1598775060

## Optimization Techniques: Genetic Algorithm

In complex machine learning models, the performance usually depends on multiple input parameters. In order to get the optimal model, the parameters must be properly tuned. However, when there are multiple parameter variables, each ranging across a wide spectrum of values, there are too many possible configurations for each set of parameters to be tested. In these cases, optimization methods should be used to attain the optimal input parameters without spending vast amounts of time finding them. In the diagram above, it shows the distribution of the model based on only two parameters. As evident in the example shown, it is not always an easy task to find the maximum or minimum of the curve. This is why optimization methods and algorithms are crucial in the field of machine learning.

## Genetic Algorithm

The most commonly used optimization strategy are Genetic Algorithms. Genetic Algorithms are based off of Darwin’s theory of natural selection. It is relatively easy to implement and there is a lot of flexibility for the setup of the algorithm so that it can be applied to a wide range of problems.

### Choosing a Fitness Function

To start off, there must be a fitness function that measures how well a set of input parameters perform. Solutions with a higher fitness derived from a fitness function will be better than ones with a lower fitness.

For example, if a solution has a cost of x + y + z, then the fitness function should try to minimize the cost. This can be done with the following fitness function #genetic-algorithm #optimization #genetics #optimization-algorithms #machine-learning 1593358380

## A genetic algorithm is a higher level method to produce

• A genetic algorithm (GA) is a higher level method to produce/ generate a sufficiently good solution to an optimization problem, inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA).
• Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on biologically inspired operators such as mutation, crossover and selection.
• John Holland introduced genetic algorithms in 1960 based on the concept of Darwin’s theory of evolution

Evolutionary algorithms (EA):

In artificial intelligence (AI), an evolutionary algorithm (EA) is a subset of evolutionary computation, a generic population-based metaheuristic optimization algorithm. An EA uses mechanisms inspired by biological evolution, such as reproduction, mutation, recombination, and selection.

Evolutionary algorithms have three main characteristics:

· Population-Based: Evolutionary algorithms are to optimize a process in which current solutions are bad to generate new better solutions. The set of current solutions from which new solutions are to be generated is called the population.

· Fitness-Oriented: If there are some several solutions, how to say that one solution is better than another? There is a fitness value associated with each individual solution calculated from a fitness function. Such fitness value reflects how good the solution is.

· Variation-Driven: If there is no acceptable solution in the current population according to the fitness function calculated from each individual, we should make something to generate new better solutions. As a result, individual solutions will undergo a number of variations to generate new solutions.

In

a genetic algorithm, a population of candidate solutions (called individuals, creatures, or phenotypes) to an optimization problem is evolved toward better solutions. Each candidate solution has a set of properties (its chromosomes or genotype) which can be mutated and altered; traditionally, solutions are represented in binary as strings of 0s and 1s, but other encodings are also possible.

The process of natural selection starts with the selection of fittest individuals from a population. They produce offspring which inherit the characteristics of the parents and will be added to the next generation. If parents have better fitness, their offspring will be better than parents and have a better chance at surviving. This process keeps on iterating and at the end, a generation with the fittest individuals will be found.

Six phases are considered in a genetic algorithm:

· Initial population

· Fitness function

· Selection

· Crossover

· Mutation

· Termination

flowchart for process in a genetic algorithm

#evolutionary-algorithms #optimization #genetic-algorithm #machine-learning #ai #algorithms