0% found this document useful (0 votes)
10 views15 pages

Ga Ii

Uploaded by

Sunshine Ratrey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views15 pages

Ga Ii

Uploaded by

Sunshine Ratrey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Encoding

 The process of representing the solution in the form of a string that conveys the
necessary information.
 Just as in a chromosome, each gene controls a particular characteristic of the
individual, similarly, each element in the string represents a characteristic of the
solution.
 The process can be performed using bits, numbers, trees, arrays, lists or any other
object.
Encoding
 Binary Encoding – Most common method of encoding. Chromosomes are strings of 1s and 0s
and each position in the chromosome represents a particular characteristic of the problem.

Chromosome A 1011001011001110010
Chromosome B 1111111000000001111
 Permutation Encoding –Every chromosome is a string of numbers, represented in a sequence.
In permutation encoding, every chromosome is a suing of integer/real values, which represents
number in a sequence. Useful in ordering problems such as the Traveling Salesman Problem
(TSP).
Chromosome A 1 5 3 2 6 4 7 9 8
Chromosome B 8 5 6 7 2 3 1 4 9
Encoding
 Octal Encoding – This encoding uses string made up of octal numbers (0-7).

Chromosome A 03467216
Chromosome B 15723314

 Hexadecimal Encoding –This encoding uses string made up of hexadecimal numbers (0-9, A-F).

Chromosome A 9CE7
Chromosome B 3DBA
Encoding
 Tree Encoding – This encoding is used mainly for evolving programs or expressions, i.e. for
Genetic programming. Every chromosome is a tree of some objects, such as values/arithmetic
operators or commands in a programming language.

(+ x (/ 5 y)) ( do_until step wall )


Selection
 Selection is the process of choosing two parents from the population for crossing.
 Purpose is to emphasize fitter individuals in the-population in hopes that their offspring have higher
fitness.
 According to Darwin’s theory of evolution the best ones survive to create new offspring.
 The higher the fitness function, the better chance that an individual will be selected.
 The selection pressure is defined as the degree to which the better individuals are favored.
 The higher the selection pressure, the more the better individuals are favored.
 This selection pressure drives the GA to improve the population fitness over successive generations.
 To generate new population:
 Create a mating pool
 Select a pair
 Reproduce
Types of Selection

Proportionate-based selection:
 Picks out individuals based upon their fitness values relative to the fitness of the other
individuals in the population.

Ordinal-based selection:
 Select individuals not upon their raw fitness, but upon their rank within the population.
 This requires that the selection pressure is independent of the fitness distribution of the
population, and is solely based upon the relative ordering (ranking) of the population.
Canonical Selection
 In this technique, fitness is defined for the ith individual as follows:

Fitness (i) =
Where fi = evaluation associated with ith individual in the population.
𝐹 = average evaluation of all individuals in the population size N and is defined as

 The probability that individuals in the current population are copied and placed in the mating
pool is proportional to their fitness.
Roulette-Wheel Selection
Roulette-Wheel Selection
 The probability that individuals is being selected in the mating pool is proportional to its fitness.
 The top surface area of the wheel is divided into N parts in proportion to the fitness values f1, f2,
……, fN.
 The wheel is rotated in a particular direction and a fixed pointer is used to indicate the winning
area, when it stops rotation.
 A particular sub-area representing a GA-solution is selected to be winner probabilistically and
the probability that the iit area will be declared as

pi = ∑
Roulette-Wheel Selection Implementation
Input: A population of size N with their fitness values.
Output: A mating pool of size Np.
Steps:
1. Compute

pi = ∑

2. Calculate the cumulative probability for each of the individual starting from the top of the list, that is

Pi = ∑ 𝑝
3. Generate a random number r between 0 and 1.
4. Select the jth individual such that Pj-1 < r ≤ Pj
5. Repeat step 3-4 to select Np individuals
6. End
Roulette-Wheel Selection Example
Individual pi Pi r T Fitness
1 0.05 0.05 0.26 I

2 0.09 0.14 0.04 I 5 1


20 9
3 0.13 0.27 0.48 II 2
4 0.17 0.44 0.43 I 3
13
5 0.20 0.64 0.09 II 8 4
5
6 0.08 0.72 0.30
8 6
7 0.08 0.80 0.61 17 7
8 0.20 1.0 0.89 I
20 8
Roulette-Wheel Selection
 The bottom most individual in the population has a cumulative probability PN =1.

 Cumulative probability of an individual lies between 0 and 1.

 The ith individual in the population represents the cumulative probability from Pi-1 to Pi.

 The top most individual represents the cumulative probability value between 0 and p1.

 It may be checked that the selection is consistent with the expected count Ei = N × pi
Rank Based Selection
 The process in rank selection consists of two steps.

1. Individuals are arranged in an ascending order of their fitness values. The individual, which

has the lowest value of fitness is assigned rank 1, and other individuals are ranked

accordingly.

2. The proportionate based selection scheme is then followed based on the assigned rank.

 The % area to be occupied by a particular individual I, is given by ∑

Where ri indicates the rank of the ith individual.


Rank Based Selection Implementation

Input: A population of size N with their fitness values.


Output: A mating pool of size Np.
Steps:
1. Arrange all individuals in ascending order of their fitness value.
2. Rank the individuals according to their position in the order, that is, the worst will have rank 1, the next rank 2
and best will have rank N.
3. Apply the Roulette-Wheel Selection but based on their assigned ranks

pi =

4. Stop.
Rank Based Selection Example
Individual pi Pi r T Fitness
1 0.05 0.05 0.26 I

0.08 0.04 I 5 1
6 0.13 20 9
7 0.08 0.21 0.48 2
0.09 0.43 II 3
2 0.30 13
0.13 0.09 I 8 4
3 0.43
5
4 0.17 0.60 0.30 I
8 6
5 0.20 0.80 0.61 I 17 7
8 0.20 1.00 0.89 I
20 8

You might also like