Professional Documents
Culture Documents
Genetic Algo Final
Genetic Algo Final
Phenotype Genotype
Decode
Genotype Representation (Encoding)
• Let us find the maximum value of the function
(15x-x^2)
• where parameter x varies between 0 and 15.
• For simplicity, we may assume that x takes only
integer values.
• Chromosomes can be built with only four genes
Genotype Representation (Encoding)
• Let us find the maximum value of Knapsack Problem
A=5kg (profit=100)
B=10kg(profit= 150)
C=15kg (profit= 200)
CONSTRAINT, M=25 kg
A B C Profit (fitness value) Total weight
1 1 0 250 15
1 0 1 300 20
0 1 1 350 25
1 1 1 450 30>25
Convergence criteria
• Manual Checking
• Solution found that satisfy objective criteria
• Fixed number of generation
• Budget Limit Reached
• graph
Genetic Algorithms Steps
• Step 1: Represent the problem variable domain as a
chromosome of a fixed length, choose the size of a
chromosome population N, the crossover probability pc and
the mutation probability pm.
• Step 2: Define a fitness function to measure the
performance, or fitness, of an individual chromosome in the
problem domain. The fitness function establishes the basis
for selecting chromosomes that will be mated during
reproduction.
• Step 3: Randomly generate an initial population of
chromosomes of size N: x1; x2; ... ; xN
• Step 4: Calculate the fitness of each individual
chromosome:
• Step 5: Select a pair of chromosomes for mating from the
current population. Parent chromosomes are selected with
a probability related to their fitness. Highly fit
chromosomes have a higher probability of being selected
for mating than less fit chromosomes.
Encoding Technique:
min=0 =>00000 in binary
max=31=>11111 in binary
can use 5 bit binary for each solution
the fitness function: f(x)=x^2 which should be
maximized
Select Initial Population: