Challenge

Week 4.1 - Genetic Algorithm

AIM :- GENETIC ALGORITHM (OR) STALAGMITE MATHEMATICAL MODEL
DISCRIPTION :-
GENETIC ALGORITHM :- A GENETIC ALOGORITHM IS A METHOD FOR SOLVING BOTH CONSTRAINED AND UNCONSTRAINED OPTIMAZATION PROBLEM BASED ON NATURAL SELECTION PROCESS THAT MINICS BILOGICAL EVALUTION
GLOBAL MAXIMA :- THE GLOBAL MAXIMUM IS A POINT WHEAR THE FUNCTION VALUE IS GREATER THAN ALL THE FEASIBLE POINTS
LOCAL MAXIMA :- THE LOCAL MAXIMA OF A FUNCTION IS APOINT WHERE THE FUNCTION VALUE IS SMALLER THAN NEAR POINTS
STALGNITE FUNCTIONS :- THE FUNCTION GENERALLY REFRESH TO THE FUNCTION WITH WHICH WE ARE GIVEN AND GENERATING THE VALUES OVER A STALAGMITE KIND OF SURFACE FOR FINDING OUT THE LOCAL AND GLOBAL MAXIMA AND MINIMIZE OF THAT PARTICULAR GIVEN FUNCTION
OPTIMAZATION TOOL BOX :- THE TOOL BOX PROVIDES FUNCTION FOR FINDING PARAMETERS THAT MINIMIZE OR MAXIMIZE OBJECTIVES WHILE ASATISFYING CONSTRAINTS YOU CAN DEFINE YOUR OPTIMIZATION PROBLEM WITH FUNCTION MATRICES OR SPECIFYING VARIABLE EXPRESSION
BODY OF THE CONTENT :- WHEN IT COMES TO THE ENGINEERING SYSTEM SOMTHING LIKE YOUR INTERNAL COMBURTION ENGINE IN YOUR AIRCRAFT WIND THEIR ARE CERTEN THINGS TO DO VERY WELL
THE ENGINEERING SYSTEM SOMTHING LIKE YOUR INTERNAL COMBURTION ENGINE IN YOUR AIRCRAFT WIND THEIR ARE CERTEN THINGS TO DO VERY WELL
WE CAN DESINE ALL THE DESINE PARAMETER AND WHICH DESINE PARAMETERS COMBINATION GIVES YOU THE LOWEST DRAG COEFFICIENT AND TO CACULATE THE BEST DESINE SYSTEM
CONTENT :- THE ENGINEERING SYSTEM SOMTHING LIKE YOUR INTERNAL COMBURTION ENGINE IN YOUR AIRCRAFT WIND THEIR ARE CERTEN THINGS TO DO VERY WELL THE ENGINEERING SYSTEM SOMTHING LIKE YOUR INTERNAL COMBURTION ENGINE IN YOUR AIRCRAFT WIND THEIR ARE CERTEN THINGS TO DO VERY WELL WE CAN DESINE ALL THE DESINE PARAMETER AND WHICH DESINE PARAMETERS COMBINATION GIVES YOU THE LOWEST DRAG COEFFICIENT AND TO CACULATE THE BEST DESINE SYSTEM
CONCLUSION :- THE CONCLUSION IS MAKING A ENGINEERING SYSTEM SOMTHING LIKE INTERNAL COMBURTION ENGINE IN YOUR AIRCRAFT WIND
clear all
close all
clc
% defining our serch space
x = linspace (0,0.6,150);
y = linspace (0,0.6,150);
% creating a 2Dimensional mesh
[xx yy] = meshgrid (x,y);
%evaluating the stalagmite function
for i = 1:length(xx)
for j = 1:length(yy)
input_vector(1) = xx(i,j);
input_vector(2) = yy(i,j);
f(i,j) = stalagmite(input_vector);
end
end
surfc(xx,yy,-f)
xlabel('x value')
ylabel('y value')
shading interp
[inputs,fval] = ga(@ stalagmite,2);
stalagmite code
function f = stalagmite(a)
x = a(1)
y = a(2)
p = (sin(5.1*pi*x+0.5))^6;
q = (sin(5.1*pi*y+0.5))^6;
r = exp(-4*log(2)*(x-0.0667)^2/0.64);
s = exp(-4*log(2)*(y-0.0667)^2/0.64);
f = -p*q*r*s;
end
get_stalagmite code
function f = get_stalagmite(x,y)
x = linspace (0,0.6,150);
y = linspace (0,0.6,150);
[xx,yy] = meshgrid(x,y)
for i = 1:length(xx)
for j = 1:length(yy)
input_vector(1) = xx(i,j);
input_vector(2) = yy(i,j);
f(i,j) = stalagmite(input_vector);
end
end
ga_study code
% program for a genetic algorithm
clear all
close all
clc
% defining our search space
x = linspace(0,0.6,150);
y = linspace(0,0.6,150);
num_case = 60;
% creating a 2Dimensional mesh
[xx, yy] = meshgrid(x, y);
% Evaluating the stalagmite function
for i = 1:length(xx)
for j = 1:length(yy)
input_vector(1) = xx(i,j);
input_vector(2) = yy(i,j);
f(i,j) = stalagnite(input_vector);
end
end
% study1- statical behaviour
tic
for i = 1:num_case
[inputs,fopt(i)] = ga(@stalagnite,2);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study1_time = toc
figure(1)
subplot(2,1,1)
surfc(x,y,f)
shading interp
hold on
plot3(xopt,yopt,fopt,'marker','o','markersize',5,'markerfacecolor','r')
title('unbounded inputs')
subplot(2,1,2)
plot(fopt)
xlabel('Iterations')
ylabel('function maxima')
% study2- satistical behaviour with upper and lower bounds
tic
for i = 1:num_case
[inputs,fopt(i)]= ga(@stalagnite,2,[],[],[],[],[0;0],[0.6;0.6]);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study2_time = toc
figure(2)
subplot(2,1,1)
surfc(x,y,f)
shading interp
hold on
plot3(xopt,yopt,fopt,'marker','o','markersize',5,'markerfacecolor','r')
title('bounded inputs')
subplot(2,1,2)
plot(fopt)
xlabel('Iterations')
ylabel('function maxima')
% study3 increasing GA Iterations
options = optimoptions('ga');
options = optimoptions(options,'populationsize',150);
tic
for i = 1:num_case
[inputs,fopt(i)] = ga(@stalagnite,2,[],[],[],[],[0;0],[1;1],[],[],options);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study3_time = toc
figure(3)
subplot(2,1,1)
surfc(x,y,f)
shading interp
hold on
plot3(xopt,yopt,fopt,'marker','o','markersize',5,'markerfacecolor','r')
title('bounded inputs')
subplot(2,1,2)
plot(fopt)
xlabel('Iterations')
ylabel('function maxima')
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.