Optimization using genetic algorithm for 3 variable.
Show older comments
I want to minimize the RMSE i.e., Function final upto tolarence of 0.002 which is depends on three variable
E = [E1 E2 E3] with range of
ub = [1200 3000 200]
lb =[600 20 120]
I am pretty new to MATLAB and read all the documentation related to GA but that still didn't help me to go further and optimize the required problem
If you can help me out.
I am attaching my code and every necessary stuff.
Just tell me how to solve it.
===========================================================================================================
Main code
%define variable
D = [0,0];
%real deflection Value
A= [0.2316,0.1496,0.0978,0.0602,0.042,0.0244,0.0218];
%plate thickness
a = 150;
% declaring elastic modulus
lb = [1200 200 20];
ub = [3000 600 120];
% declaring thickness of layer of pavement
H = [200,550];
% declaring poisson ratio
V = [0.5,0.4,0.4];
% declaring equivalent thickness
t1 = eq1(H , E , V);
t2 = eq2(H, E, t1);
T = [t1,t2];
% finding defelction
RMSE = obj_fit(E,H,V,a,A,D);
=========================================================================================================================
Fitness function
function y = obj_fit(E,H,V,a,A,D)
t1 = H(1)*nthroot((E(1)*(1-V(2).^2))/(E(2)*(1-V(1).^2)) ,3);
t2 = 0.8*(t1+H(2))*nthroot(E(2)/E(3),3);
T = [t1,t2];
for i = 1:7
if i==1
d1 = 0.566*(1+V(1))*a*(1-(power(1+power(H(1)/a,2),-0.5)+(1-2*V(1))*(power(1+power(H(1)/a,2),0.5)-H(1)/a)))/E(1);
d2 =((0.566*(1+V(2))*a*(power(1+power(T(1)/a,2),-0.5)+(1-2*V(2))*(power(1+power(T(1)/a,2),0.5)-T(1)/a)))...
-(0.566*a*(1+V(2))*(power(1+power((T(1)+H(2))/a,2),-0.5)+(1-2*V(2))*(power(1+power((T(1)+H(2))/a,2),0.5)...
-(T(1)+H(2))/a))))/E(2);
d3 = 0.566*(1+V(3))*a*(((power(1+power(T(2)/a,2),-0.5)+(1-2*V(1))*(power(1+power(T(2)/a,2),0.5)-T(2)/a))))/E(3);
D(i)= d1+d2+d3;
else
r= 300*(i-1);
d1 = 0.283*power(a,2)*(((1+V(1))*(H(1).^2)*(power((r.^2)+(H(1).^2),-1.5))+2*(1-(V(1).^2))...
*(power((r.^2)+(H(1).^2),-0.5))))/E(1);
d2 = ((0.283*power(a,2)*((1+V(2))*(T(1).^2)*(power((r.^2)+(T(1).^2),-1.5))+2*(1-(V(2).^2))...
*(power((r.^2)+(T(1).^2),-0.5))))-(0.283*power(a,2)*((1+V(2))*((T(1)+H(2)).^2)*...
(power((r.^2)+((T(1)+H(2)).^2),-1.5))+2*(1-(V(2).^2))*(power((r.^2)+((T(1)+H(2)).^2),-0.5)))))/E(2);
d3 = 0.283*power(a,2)*((1+V(3))*(T(2).^2)*(power((r.^2)+(T(2).^2),-1.5))+2*(1-(V(3).^2))*(power((r.^2)+(T(2).^2),-0.5)))/E(3);
D(i) = d1+d2+d3;
end
end
r=0;
for i=1:7
r = r+(A(i)-D(i)).^2;
end
r= r/7;
y = sqrt(r);
end
===========================================================================================
With your help I just made a obj function.
If it is correct then how to create a random population.
Just help me out to solve this problem.
6 Comments
Geoff Hayes
on 14 May 2020
Aditya - in the above code, what corresponds to the three variables E1, E2, and E3? If they were defined, how would they be used in the code? Presumably they correspond to something in the main code...
ADITYA ANUPAM
on 15 May 2020
Edited: ADITYA ANUPAM
on 15 May 2020
Walter Roberson
on 15 May 2020
if you are optimizing with respect to E then create lb and ub with appropriate content
ADITYA ANUPAM
on 15 May 2020
Walter Roberson
on 15 May 2020
Leave the population, cross-over, and mutation functions as the default to start out.
Remove
E = [1200:3000;200:600;20:120];
and define
lb = [1200 200 20];
ub = [3000 600 120];
ADITYA ANUPAM
on 15 May 2020
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!