Hello everyone and welcome!
In this post, I’m going to show you my adaptive restart genetic algorithm for solving optimization problems.
This innovative genetic algorithm with adaptive restart mechanism is proposed to improve the success rate of achieving global optimal solution of the algorithm.
Here is the general structure of my adaptive restart genetic algorithm.
Here are the details of the benchmark function.
Let’s see how my adaptive restart genetic algorithm works.
For more videos like this, check my YouTube channel here.
population.m
function Y = population(n)
% n = population size
% 60 = number of bits to express the number. Why? It depends on
% the required accuracy (the number of digits after comma) that we want
Y=round(rand(n,60));
crossover.m
function Y=crossover(P,n)
% P = population
% n = pair of chromosomes to be crossovered
[x1 y1]=size(P);
Z=zeros(2*n,60);
for i = 1:n
r1=randi(x1,1,2);
while r1(1)==r1(2)
r1=randi(x1,1,2);
end
A1=P(r1(1),:);
A2=P(r1(2),:);
r2=1+randi(59);
B1=A1(1,r2:60);
A1(1,r2:60)=A2(1,r2:60);
A2(1,r2:60)=B1;
Z(2*i-1,:)=A1;
Z(2*i,:)=A2;
end
Y=Z;
mutation.m
function Y=mutation(P,n)
% P = population
% n = chromosomes to be mutated
[x1 y1]=size(P);
Z=zeros(n,60);
for i = 1:n
r1=randi(x1);
A1=P(r1,:);
r2=randi(60,1,2);
while r2(1)==r2(2)
r2=randi(60,1,2);
end
B1=A1(1,r2(1));
A1(1,r2(1))=A1(1,r2(2));
A1(1,r2(2))=B1;
Z(i,:)=A1;
end
Y=Z;
evaluation.m
function Y=evaluation(P)
[x1 y1]=size(P);
H=zeros(x1,1);
for i = 1:x1
A=bi2de(P(i,1:30));
x=-100+A*(100-(-100))/(2^30-1);
B=bi2de(P(i,31:60));
y=-100+B*(100-(-100))/(2^30-1);
H(i,1)= ((sin(x-y/8))^2 + (sin(y+x/8))^2)/(sqrt((x-8.6998)^2 + (y-6.7665)^2) +1);
end
Y=H;
selection.m
…
Sorry! This is only a half of the code.
Notice: It would take you from 1 to 3 hours to re-type the Matlab code yourself; or with just €3.99 (the cost of a cup of coffee), you can download/copy the whole Matlab code within 2 minutes. It’s your choice to make.
Original price is €9.99 but today it’s only €3.99 (save €6 today – available for a limited time only)
Download the whole Matlab code here (Membership Code ID: 018)
No need to build the Matlab code from scratch because it’s very time-consuming. My idol, Jim Rohn, once said: “Time is more value than money. You can get more money, but you cannot get more time”. If you think this code can be used in your research/teaching work, you should download it and then customize/modify/apply it to your work, without any obligation of citing the original source if you don’t want. However, redistribution (i.e., downloading the code/script here and then making it available on another site on the Internet) is strictly prohibited.
If you have any question or problem, please contact Dr. Panda by email: learnwithpanda2018@gmail.com
Thank you very much and good luck with your research!
Major thankies for the article post. Really Great. Florrie Walton Sharos
My country not allow PayPal how can i buy codes ?
Hi, thanks for your interest! You can use Debit or Credit Card. After clicking the button “Check out with PayPal”, Debit or Credit Card button will be shown. Thanks
Only wanna admit that this is very helpful , Thanks for taking your time to write this. Ashleigh Oliver Danyluk
Great to hear that. Thank you!
Hello,
The contents you shared is very useful. Thank you so much.
The website shows the Donate contents, but how to donate. I didn’t find the button or link to donate on this website and on the youtube channel. I want to donate to thank you. Thank you for your sharing.
Hello Huali! Many thanks for your support! This blog is still under development but you can donate now from here: https://learnwithpanda.com/donation/
Succeeded. I hope your website becomes more and more popular.
Hello Huali, I have received 100 euros from you. Thank you very much! To acknowledge your financial support to this blog, could you please share your information like: address, university, or website?
Hello. Thank you for your message. The information is as follows. Address: Wuhan, China. University: Wuhan University of Science and Technology. Have a nice day.
Done, Huali. Many thanks!!!