Global Maxima of Stalagmite Function

GENITIC ALGORITHM:    A genetic algorithm is a search heuristic that is inspired by Charles Darwin’s theory of natural evolution. This algorithm reflects the process of natural selection where the fittest individuals are selected for reproduction in order to produce offspring of the next generation. 

            A genetic algorithm is a heuristic search method used in artificial intelligence and computing. It is used for finding optimized solutions to search problems based on the theory of natural selection and evolutionary biology. Genetic algorithms are excellent for searching through large and complex data sets. They are considered capable of finding reasonable solutions to complex issues as they are highly capable of solving unconstrained and constrained optimization issues.A genetic algorithm makes uses of techniques inspired from evolutionary biology such as selection, mutation, inheritance and recombination to solve a problem. The most commonly employed method in genetic algorithms is to create a group of individuals randomly from a given population. The individuals thus formed are evaluated with the help of the evaluation function provided by the programmer. Individuals are then provided with a score which indirectly highlights the fitness to the given situation. The best two individuals are then used to create one or more offspring, after which random mutations are done on the offspring. Depending on the needs of the application, the procedure continues until an acceptable solution is derived or until a certain number of generations have passed.

The Code to maximize the stalagmite function is as follows:

clear all
close all
clc


% input parametrs

x = linspace(0,0.6,150);
y = linspace(0,0.6,150);

[xx yy] = meshgrid(x,y);
num_case = 150;

for i = 1:length(x)
    for j = 1:length(y)
        input_vector(1) = xx(i,j);
        input_vector(2) = yy(i,j);
        F(i,j) = stalagmite(input_vector);
        
    end
end

% study_1
tic
for i = 1:num_case
    [inputs,Fopt(i)] = ga(@stalagmite,2);
    xopt(i) = inputs(1);
    yopt(i) = inputs(2);
end

study_time_1 = toc;

figure(1)
subplot(2,1,1);
hold on
surfc(xx,yy,F);
shading interp;
xlabel('x data');
ylabel('y data');
plot3(xopt,yopt,Fopt,'marker','o','markersize',5,'markerfacecolor','k')
title('Unbounded Inputs')
subplot(2,1,2)
plot(Fopt)
xlabel('Iterations')
ylabel('Function Maximum')

% Study 2
tic
for i = 1:num_case
    [inputs,fopt(i)] = ga(@stalagmite,2,[],[],[],[],[0;0],[1;1]);
    xopt(i) = inputs(1);
    yopt(i) = inputs(2);
end
study_time_2 = toc;

figure(2)
subplot(2,1,1)
hold on
surfc(xx, yy, F)
shading interp
xlabel 'X data'
ylabel 'Y data'
plot3(xopt,yopt,Fopt,'marker','o','markersize',5,'markerfacecolor','k')
title('Bounded Inputs')
subplot(2,1,2)
plot(Fopt)
xlabel('Iterations')
ylabel('Function Maximum')

% Study 3
options = optimoptions('ga');
options = optimoptions(options,'PopulationSize',450);
tic
for i = 1:num_case
    [inputs,Fopt(i)] = ga(@stalagmite,2,[],[],[],[],[0;0],[1;1],[],[],options);
    xopt(i) = inputs(1);
    yopt(i) = inputs(2);
end

study_time_3 = toc;

figure(3)
subplot(2,1,1)
hold on
surfc(xx, yy, F);
shading interp
xlabel 'X data'
ylabel 'Y data'
plot3(xopt,yopt,Fopt,'marker','o','markersize',5,'markerfacecolor','k');
title('Bounded Inputs with Increased Population Size');
subplot(2,1,2);
plot(Fopt);
xlabel('Iterations');
ylabel('Function Maximum');

max_value = [Fopt];

In the above code, we are running ourstalagmite function for 3 different scenarios:

1. Unbound Inputs where the inputs do not have any resrictions i.e., the inputs are randomly distributed even outside the working space

2. Bound Inputs where the inputs are restricted and are not allowed to go beyond our working space

3. Bounded Inputs with increased iterations: Here we are increasing the number of iterations and try out dufferent iterations.

Stalagmite Function:

function [F] = stalagmite(input_vector)

term_1 = (sin(5.1*pi*input_vector(1)+0.5))^6;
term_2 = (sin(5.1*pi*input_vector(2)+0.5))^6;
term_3 = exp((-4*log(2)*(((input_vector(1) - 0.0667)^2)/0.64)));
term_4 = exp((-4*log(2)*(((input_vector(2) - 0.0667)^2)/0.64)));
F = (term_1.*term_2.*term_3.*term_4);
F = 1/(1+F);
end

Unbound Inputs where the inputs do not have any resrictions

Bound Inputs where the inputs are restricted and are not allowed

 Bounded Inputs with increased iterations


Projects by Harish Arroju

a new title
Harish Arroju · 2018-11-19 12:30:21

OBJECTIVETo Create a 3D Model of Centrifugal Pump and to run a Flow Simulation.To Obtain a relation between Pressure ratio and Mass Flow rate.INTRODUCTION      Centrifugal Pumps are the sub class of the Turbomachinery. Centrifugal pumps are used Read more

a new title
Harish Arroju · 2018-11-19 12:30:11

OBJECTIVETo Create a 3D Model of Centrifugal Pump and to run a Flow Simulation.To Obtain a relation between Pressure ratio and Mass Flow rate.INTRODUCTION      Centrifugal Pumps are the sub class of the Turbomachinery. Centrifugal pumps are used Read more

OBJECTIVE To Create a 3D Model of Centrifugal Pump and to run a Flow Simulation. To Obtain a relation between Pressure ratio and Mass Flow rate. INTRODUCTION       Centrifugal Pumps are the sub class of the Turbomachinery. Centrifugal pu Read more

a new title
Harish Arroju · 2018-11-13 13:48:17

SIMULATING A FLOW OVER AN  NACA AIRFOILIn this report, a flow over a NACA airfoil has been simulated at the different angle of attack. Our main aim was to determine and compare the drag force ( X-direction ) and the lifting force ( Y-direction )  on Read more

A flow-bench is a device used for testing the internal aerodynamic qualities of a component of an engine, primarily for testing the intake and exhaust ports of cylinder heads of IC engines. Mostly this is used for designing purpose Geometry Creation Read more

Flow over a cylinder
Harish Arroju · 2018-10-29 17:53:33

This project was all about simulating the flow of air over the cylinder In this project, a cylinder was created using solid works CAD software and then the flow of air over the cylinder was simulated using Solidworks flow simulation. Geometry creation and Meshing-&nbs Read more

Flow over an airfoil
Harish Arroju · 2018-10-27 14:52:26

SIMULATING A FLOW OVER AN  NACA AIRFOIL In this report, a flow over a NACA airfoil has been simulated at the different angle of attack. Our main aim was to determine and compare the drag force ( X-direction ) and the lifting force ( Y-direction ) &nb Read more

This project was all about simulating the flow of water inside a pipe. In this project, a pipe was created using solid works CAD software and then the flow inside the pipe was simulated using SolidWorks flow simulation. Geometry creation- The pipe created was a hollo Read more

DATA ANALYSIS
Harish Arroju · 2018-10-09 12:45:56

1. This program uses the data from the extension(.out) file and It also checks the file.compatibility. If the file is not having a proper format then the code will throw an error statement. \". If the format is correct following steps:- 2. Data analysis is carried out Read more

Curve Fitting
Harish Arroju · 2018-10-08 13:45:40

Theory Curve fitting is the process of constructing a curve, or mathematical functions, which possess the closest proximity to the real series of data. By curve fitting, we can mathematically construct the functional relationship between the observed dataset and parame Read more


Loading...

The End