web viewgenetic algorithms (gas) are search algorithms based on the mechanics of natural selection...

113
LECTURE NOTES ELECTIVE 2 GENETIC ALGORITHMS Course Teachers Dr. Faris Nabih Abu-Ali Mr. Alighazi Siddiqui COLLEGE OF COMPUTER SCIENCE AND INFORMATION SYSTEMS JAZAN UNIVERSITY, JAZAN (KSA) 1

Upload: ngotu

Post on 06-Feb-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

LECTURE NOTES

ELECTIVE 2

GENETIC ALGORITHMS

Course Teachers

Dr. Faris Nabih Abu-Ali

Mr. Alighazi Siddiqui

COLLEGE OF COMPUTER SCIENCE AND INFORMATION SYSTEMS

JAZAN UNIVERSITY, JAZAN (KSA)

(2015-2016)

CHAPTER 1

Introduction to Genetic algorithms

Genetic Algorithms

Genetic Algorithms (GAs) are search algorithms based on the mechanics of natural selection and natural genetics. A genetic Algorithm is an iterative procedure maintaining a population of structures that are candidate solutions to specific domain challenges. During each temporal increment (called a generation), the structures in the current population are rated for their effectiveness as domain solutions, and on the basis of these evaluations, a new population of candidate solutions is formed using specific genetic operators such as reproduction, crossover, and mutation.

They combine survival of the fittest among string structures with a structured yet randomized information exchange to form a search algorithm with some of the innovative flair of human search. In every generation, a new set of artificial creatures (strings) is created using bits and pieces of the fittest of the old; an occasional new part is tried for good measure. While randomized, genetic algorithms are no simple random walk. They efficiently exploit historical information to speculate on new search points with expected improved performance.

A Genetic Algorithm (GA) is a stochastic algorithm that models the evolutionary process of biological species through natural selection. Genetic algorithms are patterned after natural genetic operators that enable biological populations to effectively and robustly adapt to their environment and to changes in their environment.

Genetic algorithms, as Goldberg states and demonstrates, are theoretically and empirically proven to provide robust search in complex spaces. The GA performs its search balancing the need to retain population diversity exploration, so that potentially important information is found, with the need to focus on fit portions of the population, exploitation. Reproduction in GA theory, as in biology, is defined as the process of producing offspring. However, mating may occur between any two strings, as there is no male-female distinction.

In computational terms, genetic algorithms are distinguished from other search methods by the following features:

A population of structures that can be interpreted as candidate solutions to the given problem.

The competitive selection of structures for reproduction, based on each structure's fitness as a solution to the given problem.

Idealized genetic operators that recombine the selected structures to create new structures for further testing.

Genetic Algorithms are used in solving three classical problems:

Learning.

Search, and

Optimization.

The execution cycle of genetic algorithms

A Genetic Algorithm operates through a simple cycle of stages:

1) Creation of a population of strings.

2) Evaluation of each string.

3) Selection of the best strings, and

4) Genetic manipulation to create new population of strings.

Each cycle in GA produces a new generation of possible solutions for a given problem.

In the first phase, an initial population, describing representatives of the potential solutions, is created to initiate the search process.

The elements of the population are encoded into bit-strings, called chromosomes.

The performance of the strings, often called fitness, is then evaluated with the help of some functions, representing the constraints of the problem.

Depending on the fitness of the chromosomes, they are selected for a subsequent genetic manipulation process.

The selection process is mainly responsible for assuring survival of the best-fit individuals.

Genetic Algorithms Overview

Lets apply our simple genetic algorithm to a particular optimization problem step by step. Consider the problem of maximizing the function f(x) = x2, where x is permitted to vary between 0 and 31.

String No.

Initial population Randomly Generated

X Value Unsigned integer

F(x) X2

Pselecti

Expected count

Actual count from Roulette Wheel

1

0 1 1 0 1

13

169

0.14

0.58

1

2

1 1 0 0 0

24

576

0.49

1.97

2

3

0 1 0 0 0

8

64

0.06

0.22

0

4

1 0 0 1 1

19

361

0.31

1.23

1

Sum

1170

1.00

4.00

4.0

Average

293

0.25

1.00

1.0

Max

576

0.49

1.97

2.0

Referring to the table below, random choice of mates has selected the second string in the mating pool to be mated with the first. With a crossing site of 4, the two strings 0 1 1 0 1 and the string 1 1 0 0 0 cross and yield two new strings 0 1 1 0 0 and 1 1 0 0 1. The remaining two strings in the mating pool are crossed at site 2; the resulting strings may be checked in the table.

The last operator, mutation, is performed on a bit-by-bit basis. We assume that the probability of mutation in this test is 0.001. With 20 transferred bit positions we should expect 20 * 0.001 = 0.02 bits to undergo mutation during a given generation. Simulation of this process indicates that no bits undergo mutation for this probability value. As a result, no bit positions are changed from 0 to 1 or vice versa during this generation.

Mating Pool after Reproduction (Cross Site Shown)

Mate (Randomly Selected)

Crossover Site (Randomly Selected)

New Population

X Value

f(X) X2

0 1 1 0 | 1

2

4

0 1 1 0 0

12

144

1 1 0 0 | 0

1

4

1 1 0 0 1

25

625

1 1 | 0 0 0

4

2

1 1 0 1 1

27

729

1 0 | 0 1 1

3

2

1 0 0 0 0

16

256

1754

439

729

Following reproduction, crossover, and mutation, the new population is ready to be tested. To do this, we simply decode the new strings created by the simple genetic algorithm and calculate the fitness function values from the x values thus decoded.

Genetic Algorithms Overview

Developed by John Holland in 1975.

Genetic Algorithms (GAs) are search algorithms based on the mechanics of the natural selection process (biological evolution). The most basic concept is that the strong tends to adapt and survive while the weak tends to die out. That is, optimization is based on evolution, and the "Survival of the fittest" concept.

GAs have the ability to create an initial population of feasible solutions, and then recombine them in a way to guide their search to only the most promising areas of the state space.

Each feasible solution is encoded as a chromosome (string) also called a genotype, and each chromosome is given a measure of fitness via a fitness (evaluation or objective) function.

The fitness of a chromosome determines its ability to survive and produce offspring.

A finite population of chromosomes is maintained.

Gas use probabilistic rules to evolve a population from one generation to the next. The generations of the new solutions are developed by genetic recombination operators:

Biased Reproduction: selecting the fittest to reproduce.

_ Crossover: combining parent chromosomes to produce children chromosomes

_ Mutation: altering some genes in a chromosome.

_ Crossover combines the "fittest" chromosomes and passes superior genes to the next generation.

_ Mutation ensures the entire state-space will be searched (given enough time) and can lead the population out of a local minima.

_ Most Important Parameters in GAs:

_ Population Size

_ Evaluation Function

_ Crossover Method

_ Mutation Rate

_ Determining the size of the population is a crucial factor

Choosing a population size too small increases the risk of converging prematurely to a local minima, since the population does not have enough genetic material to sufficiently cover the problem space. A larger population has a greater chance of finding the global optimum at the expense of more CPU time.

The population size remains constant from generation to generation.

A robust search technique

GAs will produce "close" to optimal results in a "reasonable" amount of time

Suitable for parallel processing

Some problems are deceptive

Can use a noisy fitness function

Fairly simple to develop

Makes no assumptions about the problem space

_ GAs are blind without the fitness function. The fitness function drives the population toward better solutions and is the most important part of the algorithm.

_Probability and randomness are essential parts of GA.

Use Genetic Algorithms

_ When an acceptable solution representation is available.

_ When a good fitness function is available.

_ When it is feasible to evaluate each potential solution.

_ When a near-optimal, but not optimal solution is acceptable.

_ When the state-space is too large for other methods