Challenge

Week 4.1 - Genetic Algorithm

clear all
close all
clc

% defining our search 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);

for f = stalagmite (input_vector)
x = input_vector(0,0.6,150);
y = input_vector(0,0.6,150);
f1_x = (sin(5.1*3.14*x+0.5)).^6;
f1_y = (sin(5.1*3.14*y+0.5)).^6;

t1 = ((x-0.0667).^2)/(0.64);

f2_x = exp(-4.*log(2)*t1);

t2 = ((y-0.0667).^2)/(0.64);

f2_y = exp(-4.*log(2)*t2);

f = (f1_x.*f2_x.*f1_y.*f2_y);
f(i,j)= stalagmite(input_vector)
end

end
end

% surfc(xx,yy,f)

shading interp
[x,fval] = ga(@stalagmite,2)

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.