# GENETIC ALGORITHM MATLAB

Genetic Algorithm consists a class of probabilistic optimization algorithms. GENETIC ALGORITHM MATLAB tool is used in computing to find approximate solutions to optimization and search problems. Set of possible solutions are randomly generated to a problem, each as fixed length character string.  Keep best solution to generate new possible solutions.

• COMPLETED GENETIC ALGORITHM MATLAB PROJECTS 57%
• ON GOING GENETIC ALGORITHM MATLAB PROJECTS 27%

SAMPLE CODE FOR GENETIC ALGORITHM MATLAB SIMULATION PROJECTS:

Key Terms of Genetic Algorithm Matlab:

• Population.
• Trait.
• Search Space.
• Individual.
• Locus.
• Chromosome.
• Allele.
• Genome.

Operators of Genetic Algorithm:

• Reproduction.
• Mutation.
• Cross Over.

Components of Genetic Algorithm Matlab:

• Encoding Principles.
• Initialization Procedure.
• Selection of Parents.
• Genetic Operators.
• Evaluation Function.
• Termination Condition.

Steps involved in of Genetic Algorithm Matlab Projects:

• Represent the problem variable domain.
• Define a fitness function.
• Random generation of initial population.
• Calculate the fitness of each individual chromosome.
• Select a pair of chromosomes.
• Create a pair of offspring chromosomes.

% Setup the GA
ff=’testfunction’; % objective function
npar=2; % number of optimization variables
varhi=10; varlo=0; % variable limits
% Stopping criteria
maxit=100; % max number of iterations
mincost=-9999999; % minimum cost
% GA parameters
popsize=12; % set population size
mutrate=.2; % set mutation rate
selection=0.5; % fraction of population kept
Nt=npar; % continuous parameter GA Nt=#variables
keep=floor(selection*popsize); % #population members that survive
nmut=ceil((popsize-1)*Nt*mutrate); % total number of mutations
M=ceil((popsize-keep)/2); % number of matings

% Create the initial population
iga=0; % generation counter initialized
par=(varhi-varlo)*rand(popsize,npar)+varlo; % random
cost=feval(ff,par); % calculates population cost using ff[cost,ind]=sort(cost); % min cost in element 1
par=par(ind,:); % sort continuous
minc(1)=min(cost); % minc contains min of
meanc(1)=mean(cost); % meanc contains mean of population
% Iterate through generations
while iga<matrix
iga=iga+1; %increments generation counter
% Performs mating using single point crossover
ix=1:2:keep; % index of mate #1
xp=ceil(rand(1,M)*Nt); % crossover point
r=rand(1,M); % mixing parameter for ic=1:M
xy=par(ma(ic),xp(ic))-par(pa(ic),xp(ic)); % ma and pa mate
par(keep+ix(ic),:)=par(ma(ic),:); % 1st offspring
par(keep+ix(ic)+1,:)=par(pa(ic),:); % 2nd offspring
par(keep+ix(ic),xp(ic))=par(ma(ic),xp(ic))-r(ic).*xy; % 1st par(keep+ix(ic)+1,xp(ic))=par(pa(ic),xp(ic))+r(ic).*xy; % 2nd
if xp(ic)maxit | cost(1)<mincost
break
end[iga cost(1)] end %iga
%