You are on page 1of 6

What is Genetic Algorithm?

A genetic algorithm is a method for searching for the optimum solution to a


complex problem, based on the principles of natural selection. It's basically
an automated, intelligent approach to trial and error. Given specific
formulas, rules, or arrangements to be optimized, a genetic algorithm can
find a solution.

In general, genetic algorithms tend to work better than traditional


optimization algorithms because they're less likely to be led astray by local
optima. This is because they don't make use of single-point transition rules
to move from one single instance in the solution space to another. Instead,
GA's take advantage of an entire set of solutions spread throughout the
solution space, all of which are experimenting upon many potential optima.

However, in order for genetic algorithms to work effectively, a few criteria


must be met:

It must be relatively easy to evaluate how "good" a potential solution


is relative to other potential solutions.
It must be possible to break a potential solution into discrete parts
that can vary independently. These parts become the "genes" in the
genetic algorithm.
Finally, genetic algorithms are best suited for situations where a
"good" answer will suffice, even if it's not the absolute best answer.

Basics of Genetic Algorithms

The most common type of genetic algorithm works like this: a population is
created with a group of individuals created randomly. The individuals in the
population are then evaluated. The evaluation function is provided by the
programmer and gives the individuals a score based on how well they perform at
the given task. Two individuals are then selected based on their fitness, the
higher the fitness, the higher the chance of being selected. These individuals
then "reproduce" to create one or more offspring, after which the offspring
are mutated randomly. This continues until a suitable solution has been found
or a certain number of generations have passed, depending on the needs of the
programmer.
Selection:

While there are many different types of selection, I will cover the most
common type - roulette wheel selection. In roulette wheel selection,
individuals are given a probability of being selected that is directly
proportionate to their fitness. Two individuals are then chosen randomly based
on these probabilities and produce offspring. Pseudo-code for a roulette wheel
selection algorithm is shown below.

for all members of population

sum += fitness of this individual

end for

for all members of population

probability = sum of probabilities + (fitness / sum)

sum of probabilities += probability

end for

loop until new population is full

do this twice

number = Random between 0 and 1

for all members of population

if number > probability but less than next probability

then you have been selected

end for

end

create offspring
end loop

While this code is very general and will obviously not compile, it illustrates
the basic structure of a selection algorithm. Besides, you should write the
code yourself, you learn better that way.

Crossover

So now you have selected your individuals, and you know that you are supposed
to somehow produce offspring with them, but how should you go about doing it?
The most common solution is something called crossover, and while there are
many different kinds of crossover, the most common type is single point
crossover. In single point crossover, you choose a locus at which you swap the
remaining alleles from on parent to the other. This is complex and is best
understood visually.

As you can see, the children take one section of the chromosome from each
parent. The point at which the chromosome is broken depends on the randomly
selected crossover point. This particular method is called single point
crossover because only one crossover point exists. Sometimes only child 1 or
child 2 is created, but oftentimes both offspring are created and put into the
new population. Crossover does not always occur, however. Sometimes, based on
a set probability, no crossover occurs and the parents are copied directly to
the new population. The probability of crossover occurring is usually 60% to
70%.

Mutation:

After selection and crossover, you now have a new population full of
individuals. Some are directly copied, and others are produced by crossover.
In order to ensure that the individuals are not all exactly the same, you
allow for a small chance of mutation. You loop through all the alleles of all
the individuals, and if that allele is selected for mutation, you can either
change it by a small amount or replace it with a new value. The probability of
mutation is usually between 1 and 2 tenths of a percent.

Why We Genetic Algorithm


It is better than conventional AI in that it is more robust. Unlike older AI
systems, they do not break easily even if the inputs changed slightly, or in
the presence of reasonable noise. Also, in searching a large state-space,
multi-modal state-space, or n-dimensional surface, a genetic algorithm may
offer significant benefits over more typical search of optimization
techniques. (linear programming, heuristic, depth-first, breath-first, and
praxis.)

Genetic Engineering:
Genetic engineering, also called genetic modification, is the direct
manipulation of an organism's genome using biotechnology. It is a set of
technologies used to change the genetic makeup of cells, including the
transfer of genes within and across species boundaries to produce improved or
novel organisms.

Genetic engineering has the potential to make food producing plants grow
faster, grow in less fertile areas, produce higher quality harvests, and be
more resistant to weeds, diseases, and insects. But the techniques now being
used are not very precise. Many attempts are usually required before the new
plant or animal survives. Then several generations need to be observed to
ensure that the organism has no deformities. It is almost impossible to be
certain that there will be no long term negative impact on consumers or the
environment until the plant or animal has already been released, and by then
it is too late.

particle swarm optimization :


particle swarm optimization (PSO) is a computational method that optimizes a
problem by iteratively trying to improve a candidate solution with regard to a
given measure of quality. Particle Swarm Optimization might sound complicated,
but it's really a very simple algorithm. Over a number of iterations, a group
of variables have their values adjusted closer to the member whose value is
closest to the target at any given moment
.

You might also like