Professional Documents
Culture Documents
10
Objectives:-
1. Understanding of steps in Genetic Algorithm
2. Hyper parameters of Genetic Algorithm
Problem Statement:
Optimize (Minimization) of a continuous function x[0]^2+x[1]^2 that input variables and has
an optima at f(0, 0) = 0.0. Bounds (i.e. Range of inputs) provided for search are [-5,5] and
[-5,5]
1
Fig-Flowchart of Genetic Algorithm
2
"Genetic algorithms borrow inspiration from biological evolution, where fitter individuals are
more likely to pass on their genes to the next generation."
➢ First, the population of bitstrings (candidate solutions) are evaluated using the
objective function. The objective function evaluation for each candidate solution is
taken as the fitness of the solution, which may be minimized or maximized.
Reproduction:
• All the solutions in a population may not be equally good in terms of their fitness
values. An operator named reproduction (also known as selectionscheme) is utilized
to select the good solutions using their fitness values.
• Thus, it forms a mating pool consisting of good solutions probabilistically.
• It is important to note that the mating pool may contain multiple copies of aparticular
good solution.
• The size of the mating pool is kept equal to that of the population of
solutionsconsidered before reproduction.
• Thus, the average fitness of the mating pool is expected to be higher than thatof the
pre-reproduction population of solutions.
3
• There exists a number of reproduction schemes in the GA-literature, namely
proportionate selection such as Roulette-Wheel selection, tournament
selection,ranking selection, and others.
Crossover:
• The mating pairs (also known as the parents) are selected at random fromthe above
pool, which may participate in crossover depending on the value of crossover
probability.
• In crossover, there is an exchange of properties between the parents andas a result of
which, new children solutions are created.
• It is important to mention that if the parents are good, the children areexpected to be
good.
• Various types of crossover operators are available in the GA-literature, such as single-
point crossover, two-point crossover, multi-pointcrossover, uniform crossover, and
others.
• Crossover is controlled by a hyperparameter set to a large value, such as 80 percent or
90 percent.
Mutation:
• In biology, the word: mutation means a sudden change of parameter.
• For example, the crows are generally black in colour. However, if we could see a
white crow by chance, it might have happened due to a sudden change in parameter
on the gene level, which is known as biological mutation.
• In a GA-search, it is used for achieving a local change around thecurrent solution.
• Thus, if a solution gets stuck at the local minimum, this operator mayhelp it to come
out of this situation.
• Mutation involves flipping bits in created children candidate solutions.Typically, the
mutation rate is set to 1/1, where I. is the length of the bit string
• For example, if a problem used a bitstring with 20 bits, then a good default mutation
rate would be or a probability of 5 percent.
• After the reproduction, crossover and mutation are applied to the whole population of
solutions, one generation of a GA iscompleted
• Different criteria may be used to terminate the program, such as the maximum
number of generations, a desired accuracy in thesolution, and others.