Week 5 - Genetic Algorithm
function [s] = func_tot(input_vector)
a = input_vector(1);
b = input_vector(2);
s1 = ((sin(5.1*pi.*a+0.5))).^6;
s2 = ((sin(5.1*pi.*b+0.5))).^6;
s3 = 2.^((0.0667-a)/0.1);
s4 = 2.^((0.0667-b)/0.1);
s = 1/(s1*s2*s3*s4);
end
(OR)
%considering -ve of the function to get the least value by ga which would be the highest value for the original function
function [s] = conj_tot(input_vector)
a = input_vector(1);
b = input_vector(2);
s1 = ((sin(5.1*pi.*a+0.5))).^6;
s2 = ((sin(5.1*pi.*b+0.5))).^6;
s3 = 2.^((0.0667-a)/0.1);
s4 = 2.^((0.0667-b)/0.1);
s = -(s1*s2*s3*s4);
end
% final ga cases
clear all
close all
clc
x = linspace(0,0.6,150); % doesn't guarantee the search space
y = linspace(0,0.6,150); % doesn't guarantee the search space
[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);
S(i,j) = func_tot(input_vector);
end
end
num_cases = 75;
%study1 - statistical behaviour
tic
for k = 1:num_cases
[inputs, Sopt(k)] = ga(@conj_tot,2);
ropt(k) = inputs(1);
dopt(k) = inputs(2);
end
study1_time = toc
figure(1)
subplot(2,1,1)
hold on
surfc(xx,yy,S)
shading interp
plot3(ropt,dopt,Sopt,'marker','o','markersize',5,'markerfacecolor','r')
xlabel('x axis')
ylabel('y axis')
title('unbound inputs')
subplot(2,1,2)
plot(Sopt)
xlabel('iterations')
ylabel('function minimum')
%study2- with lower and upper bounds
tic
for j = 1:num_cases
[inputs, Oopt(j)] = ga(@conj_tot,2,[],[],[],[],[0;0],[1;1],[]);
hopt(j) = inputs(1);
qopt(j) = inputs(2);
end
figure(2)
subplot(2,1,1)
hold on
surfc(xx,yy,S)
shading interp
plot3(hopt,qopt,Oopt,'marker','o','markersize',5,'markerfacecolor','r')
title('bounded inputs')
subplot(2,1,2)
plot(Oopt)
xlabel('iterations')
ylabel('optimum point')
study2_time = toc
%study3- by increasing the population size
options = gaoptimset;
options = gaoptimset(options,'PopulationSize',170);
tic
for l = 1:num_cases
[inputs, Mopt(l)] = ga(@conj_tot,2,[],[],[],[],[0;0],[1;1],[],options);
iopt(l) = inputs(1);
vopt(l) = inputs(2);
end
study3_time = toc
figure(3)
subplot(2,1,1)
hold on
surfc(xx,yy,S)
shading interp
plot3(iopt,vopt,Mopt,'marker','o','markersize',5,'markerfacecolor','r')
title('bounded inputs with options')
subplot(2,1,2)
plot(Mopt)
xlabel('iterations')
ylabel('optimum point')
For the above optimisation problem a steepest gradient method can be used first and then can be switched to genetic algorithm optimisation.This case can be carefully exercised.
Data mining is a form of knowledge discovery essential for solving problems in a specific domain. Individual data sets may be gathered and studied collectively for purposes other than those for which they are originally created. New knowledge may be obtained in the process while eliminating one of the largest costs which is data collection which can be in an unstructured format. The application of data mining can facilitate systematic analysis in such cases.It is often required to not only get the data cleaned of errors and redundancy, but also needs to be organised in a fashion that makes sense to the problem.Data mining,also popularly known as Knowledge Discovery in data bases (or KDD), refers to the nontrivial extraction of implicit, previously unknown and potentially useful information from data in the databases are frequently treated in the same sense. Data mining is one of the process in the route to Knowledge discovery.Data mining in its simplest form, automates the detection of relevant patterns in a database, using defined approaches and algorithms to look into the current and the historical data that can be analysed to predict future trends. Because data mining tools predict future trends and behaviours by reading through databases for hidden patterns, they show organisations to make proactive, knowledge-driven decisions and answer questions that were previously too time consuming to resolve.The overall KDD process is outlined as below:
It is interactive and iterative involving, more or less the following steps:
1) Understand the application domain ( mechanical systems like Aircraft wing, IC Engine piston design are of particular interest to us).
2) Extracting the target data set: this includes selecting a dataset or focusing on a subset of variables.
Step 2 is best achieved when the domain knowledge/expertise is applied to the problem in hand.
3) Data cleaning and Data pre processing which includes processes like noise removal and handling of the missing data.
4) Data integration : includes integrating multiple, heterogeneous data sources.
5) Data reduction and projection which includes finding useful features to represent the data which is wisely chosen based on the objective of the problem. Dimensionality reduction(using Non dimensional numbers or else transformative methods are used for this purpose).
6) Next important step is to choose the function of the data mining which again is based on the objective of the model derived by the data mining algorithm.
7) Choosing the data mining algorithm (s): includes selecting method(s) to be used for searching patterns in data, such as deciding on which models and parameters/variables would be appropriate.
8) Data mining: includes searching for interesting patterns
9) Interpretation: which includes interpreting the discovered patterns as well as possible visualization of the extracted patterns.Auto and semi- Auto means may be used to identify truly interesting/ useful patterns for the user.
10) Taking actions based on the knowledge by applying aptly to fit the domain limitations. The performance effect may be shown in this step.
Until some point it is deterministic, thereafter it is probabilistic 'stochiastic'
fitness value of the function of the function increases
Survival of the fittest
Steepest gradient method for smoothly or with random peaks and valleys works out well.
IC Engine efficiency is conjugate with ic engine maximum efficiency is conjugate with minimum efficiency
Hybrid optimisation method: Start with the steepest gradient and try to apply the genetic algorithm
Mimic the biological systems
Medical research and life expectancy: Starting from independence
Single variable function with the gradient methods work well.
Multi variable function: exhaustive search or random walk is used
2n to 4n values are chosen
The values are represented as numbers which are in turn represented as bits.
Range,population,number of iterations are used to compute further
Heat transfer problem (first lectur 45 min) is considered
Ship efficiency problem is considered.
Artificial neural networks and the inputs they give to Genetic algorithm is considered.
Genetic algorithms are basically search algorithms
Heuristic methods
Where GA dominates Fluent in the case of Discrete Heat Sources (end of the lecture)
Cross over sites
Roulette wheel for natural selection
Roulette wheel and population consideration and mutation
x1, x2 are considered-- they are stored in A; f(A) is evaluated
x3,x4 are considered-- they are stored in B; f(B) is evaluated
x5,x6 are considered-- they are stored in C; f(C) is evaluated
relative fitness of f(A) - f(A)/sum(f(A))
Population is further considered according to the relative fitness of the individual
Multiply the desired away by 10^2 (for example exponent is chosen based on desired accuracy) and
convert it into bits and then for final result it is converted back.
Simulated annealig is another technique
How the design vectors are used?what are the design vectors?
Professor C.Balaji
Department of Mechanical Engineering
IIT Madras
Premature convergence is to be overcomed
Best explained in pink,white and blue region example-first video @25 min approximately starts
Tournament Strategy
Heat Transfer problem can be solved by Lagrangian multipliers (45 min)
Q = hAθ
h = 2 + (0.5 θ^ (0.2))/D
Dθ = 20
Q = π*D^2*h*θ
Q = π*(2D^2+0.5*D*θ^(0.2))*θ
(800-Q) is chosen as the objective function
(800-Q) is chosen so that the function gets always a +ve value 800 is always greater than function value
estimate.
Copied from notes here:
800-62.83(2D+0.91D^(-0.2)) 0<D<6.3
fitness concept; 42:50 min
Green_one_has_been_packed-->elitist strategy
How far deterministic and then from where on Stochiastic
47:04---> Green one eliminated
| Initial Population | P | Actual | Mating pool | Parameter 1 | Parameter 2 | Parameter 3 | Parameter 4 | Fitness | |
Strategies for choosing parents:
Tournament Selection strategy as follows:
| PARAMETER 1 | PARAMETER 2 | PARAMETER 3 |
Converged values:
are these parameters? D,θ,Q?
from the lecture find out.