SlideShare a Scribd company logo
% ============================================================ %
% Files of the Matlab programs included in the book: %
% Xin-She Yang, Nature-Inspired Metaheuristic Algorithms, %
% Second Edition, Luniver Press, (2010). www.luniver.com %
% ============================================================ %
% ------------------------------------------------------------ %
% Bat-inspired algorithm for continuous optimization (demo) %
% Programmed by Xin-She Yang @Cambridge University 2010 %
% For details, please see the following papers:
% 1) Xin-She Yang, Bat algorithm for multi-objective optimization,
% Int. J. Bio-Inspired Computation, Vol.3, No.5, 267-274 (2011).
% 2) Xin-She Yang, Xingshi He, Bat Algorithm: Literature Review
% and Applications, Int. J. Bio-Inspired Computation,
% Vol. 5, No. 4, pp. 141-149 (2013).
% ------------------------------------------------------------ %
function Q=moba_demo(NPareto)
if nargin<1,
NPareto=40; % Number of points on the Pareto front
end
global w;
for k=1:NPareto,
% Generate a weighting coefficient:w so that w1=w, w2=1-w, w1+w2=1.
% Observations suggest that systematically monotonic weights are
% better than random weights.
w=k/NPareto;
[best,fmin]=bat_algorithm;
[obj1,obj2]=Funobj(best);
Q(k,:)=[obj1,obj2];
% Output/display
disp(['Weight: ',num2str(w)]);
disp(['Best Obj1=',num2str(obj1),' Obj2=',num2str(obj2)]);
end
% Display the Pareto front
plot(Q(:,1),Q(:,2),'o');
xlabel('Obj_1'); ylabel('Obj_2');
% The main part of the Bat Algorithm %
% Usage: bat_algorithm([20 0.25 0.5]); %
function [best,fmin,N_iter]=bat_algorithm(para)
% Default parameters
if nargin<1, para=[10 0.25 0.5]; end
n=para(1); % Population size, typically 10 to 25
A=para(2); % Loudness (constant or decreasing)
r=para(3); % Pulse rate (constant or decreasing)
% This frequency range determines the scalings
Qmin=0; % Frequency minimum
Qmax=2; % Frequency maximum
% Iteration parameters
%% In order to obtain better/more accurate results, N_iter
%% should be increased to N_iter=2000 or more if necessary.
N_iter=1000; % Total number of function evaluations
% Dimension of the search variables
d=3;
% Initial arrays
Q=zeros(n,1); % Frequency
v=zeros(n,d); % Velocities
% Initialize the population/solutions
for i=1:n,
Sol(i,:)=randn(1,d);
Fitness(i)=Fun(Sol(i,:));
end
% Find the current best
[fmin,I]=min(Fitness);
best=Sol(I,:);
% ====================================================== %
% Note: As this is a demo, here we did not implement the %
% reduction of loudness and increase of emission rates. %
% Interested readers can do some parametric studies %
% and also implementation various changes of A and r etc %
% ====================================================== %
% Start the iterations -- Bat Algorithm
for i_ter=1:N_iter,
% Loop over all bats/solutions
for i=1:n,
Q(i)=Qmin+(Qmin-Qmax)*rand;
v(i,:)=v(i,:)+(Sol(i,:)-best)*Q(i);
S(i,:)=Sol(i,:)+v(i,:);
% Pulse rate
if rand>r
S(i,:)=best+0.01*randn(1,d);
end
% Evaluate new solutions
Fnew=Fun(S(i,:));
% If the solution improves or not too loudness
if (Fnew<=Fitness(i)) & (rand<A) ,
Sol(i,:)=S(i,:);
Fitness(i)=Fnew;
end
% Update the current best
if Fnew<=fmin,
best=S(i,:);
fmin=Fnew;
end
end
end
% End of the main bat algorithm and output/display can be added here.
% Put your objective functions here
function z=Fun(u)
global w;
[obj1,obj2]=Funobj(u);
z=obj1*w+(1-w)*obj2;
% Two objectives
function [obj1,obj2]=Funobj(u)
% In the simplest 1D case, f1=x^2, f2=(x-2)^2.
% In the d-dim case, the Pareto front extends from (0,4d) to (4d,0).
obj1=sum(u.^2);
obj2=sum((u-2).^2);

More Related Content

TXT
Bat algorithm (demo)
Xin-She Yang
 
PPTX
Java script array methods
chauhankapil
 
PPTX
Lecture 18: Gaussian Mixture Models and Expectation Maximization
butest
 
PDF
Bat Algorithm: A Novel Approach for Global Engineering Optimization
Xin-She Yang
 
PDF
Route Optimization to make Energy Efficient MANET using Vishal Fuzzy Genetic ...
ijsrd.com
 
PDF
STUDY AND PERFORMANCE EVALUATION OF ANTHOCNET AND BEEHOCNET NATURE INSPIRED M...
IAEME Publication
 
PDF
NEW APPROACH TO IMPROVING LIFETIME IN HETEROGENEOUS WIRELESS SENSOR NETWORKS ...
chokrio
 
PDF
Bat Algorithm: Literature Review and Applications
Xin-She Yang
 
Bat algorithm (demo)
Xin-She Yang
 
Java script array methods
chauhankapil
 
Lecture 18: Gaussian Mixture Models and Expectation Maximization
butest
 
Bat Algorithm: A Novel Approach for Global Engineering Optimization
Xin-She Yang
 
Route Optimization to make Energy Efficient MANET using Vishal Fuzzy Genetic ...
ijsrd.com
 
STUDY AND PERFORMANCE EVALUATION OF ANTHOCNET AND BEEHOCNET NATURE INSPIRED M...
IAEME Publication
 
NEW APPROACH TO IMPROVING LIFETIME IN HETEROGENEOUS WIRELESS SENSOR NETWORKS ...
chokrio
 
Bat Algorithm: Literature Review and Applications
Xin-She Yang
 

Viewers also liked (14)

PDF
Bat algorithm for Topology Optimization in Microelectronic Applications
Xin-She Yang
 
PPTX
IMPLEMENTATION OF DYNAMIC REMOTE OPERATED USING BAT ALGORITHMNAVIGATION EQUIP...
AlameluPriyadharshini
 
PPTX
Bat Algorithm
Arman Hemel
 
PPTX
Energy Efficient Routing Approaches in Ad-hoc Networks
Kishan Patel
 
PPTX
BAT Algorithm
Ayushi Gagneja
 
PPTX
Mathematical Modelling of Wireless sensor Network and new energy Aware Routing
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
PPTX
Bat algorithm explained. slides ppt pptx
Mahdi Atawneh
 
PDF
Nature-Inspired Optimization Algorithms
Xin-She Yang
 
PPTX
Bat algorithm and applications
Md.Al-imran Roton
 
PDF
A BA-based algorithm for parameter optimization of support vector machine
Aboul Ella Hassanien
 
PPTX
ABC Algorithm.
N Vinayak
 
PPT
My Final Year B.Tech Research Project
Eeshan Srivastava
 
PPTX
Bat algorithm
Priya Kaushal
 
PDF
2016 중국 BAT 투자현황 분석보고
Platum
 
Bat algorithm for Topology Optimization in Microelectronic Applications
Xin-She Yang
 
IMPLEMENTATION OF DYNAMIC REMOTE OPERATED USING BAT ALGORITHMNAVIGATION EQUIP...
AlameluPriyadharshini
 
Bat Algorithm
Arman Hemel
 
Energy Efficient Routing Approaches in Ad-hoc Networks
Kishan Patel
 
BAT Algorithm
Ayushi Gagneja
 
Mathematical Modelling of Wireless sensor Network and new energy Aware Routing
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
Bat algorithm explained. slides ppt pptx
Mahdi Atawneh
 
Nature-Inspired Optimization Algorithms
Xin-She Yang
 
Bat algorithm and applications
Md.Al-imran Roton
 
A BA-based algorithm for parameter optimization of support vector machine
Aboul Ella Hassanien
 
ABC Algorithm.
N Vinayak
 
My Final Year B.Tech Research Project
Eeshan Srivastava
 
Bat algorithm
Priya Kaushal
 
2016 중국 BAT 투자현황 분석보고
Platum
 
Ad

Similar to Multiobjective Bat Algorithm (demo only) (20)

TXT
Firefly algorithm
Xin-She Yang
 
DOCX
function Bisectio1
Abebe Alemu
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
azulaycelill
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
sgvxzdwf492
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tullaomamiki
 
PDF
Differential evolution optimization technique
Siksha 'O' Anusandhan (Deemed to be University )
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
coiamadala
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
cooks2liepecr
 
DOCX
scientific computing
saurabhramteke7
 
PDF
Control Systems Using Matlab
Assignmentpedia
 
PDF
Essentials of MATLAB Programming 3rd Edition Chapman Solutions Manual
icidrvkswa704
 
PDF
3ml.pdf
MianAdnan27
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tullaomamiki
 
PDF
Bigger Data v Better Math
Brent Schneeman
 
PDF
Essentials of MATLAB Programming 3rd Edition Chapman Solutions Manual
bobiernobou
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tuadzadblh472
 
PDF
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
nyzamdagion57
 
PPTX
WEKA:Credibility Evaluating Whats Been Learned
weka Content
 
PPTX
WEKA: Credibility Evaluating Whats Been Learned
DataminingTools Inc
 
PDF
Methods of Optimization in Machine Learning
Knoldus Inc.
 
Firefly algorithm
Xin-She Yang
 
function Bisectio1
Abebe Alemu
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
azulaycelill
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
sgvxzdwf492
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tullaomamiki
 
Differential evolution optimization technique
Siksha 'O' Anusandhan (Deemed to be University )
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
coiamadala
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
cooks2liepecr
 
scientific computing
saurabhramteke7
 
Control Systems Using Matlab
Assignmentpedia
 
Essentials of MATLAB Programming 3rd Edition Chapman Solutions Manual
icidrvkswa704
 
3ml.pdf
MianAdnan27
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tullaomamiki
 
Bigger Data v Better Math
Brent Schneeman
 
Essentials of MATLAB Programming 3rd Edition Chapman Solutions Manual
bobiernobou
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
tuadzadblh472
 
Fundamentals of Communication Systems 1st Edition Proakis Solutions Manual
nyzamdagion57
 
WEKA:Credibility Evaluating Whats Been Learned
weka Content
 
WEKA: Credibility Evaluating Whats Been Learned
DataminingTools Inc
 
Methods of Optimization in Machine Learning
Knoldus Inc.
 
Ad

More from Xin-She Yang (20)

PDF
Cuckoo Search Algorithm: An Introduction
Xin-She Yang
 
PDF
Metaheuristic Algorithms: A Critical Analysis
Xin-She Yang
 
PDF
A Biologically Inspired Network Design Model
Xin-She Yang
 
TXT
Flower Pollination Algorithm (matlab code)
Xin-She Yang
 
PDF
Nature-Inspired Metaheuristic Algorithms
Xin-She Yang
 
PDF
Metaheuristics and Optimiztion in Civil Engineering
Xin-She Yang
 
PDF
A Biologically Inspired Network Design Model
Xin-She Yang
 
PDF
Introduction to Computational Mathematics (2nd Edition, 2015)
Xin-She Yang
 
PDF
Memetic Firefly algorithm for combinatorial optimization
Xin-She Yang
 
PDF
Two-Stage Eagle Strategy with Differential Evolution
Xin-She Yang
 
PDF
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Xin-She Yang
 
PDF
Bat Algorithm for Multi-objective Optimisation
Xin-She Yang
 
PDF
Are motorways rational from slime mould's point of view?
Xin-She Yang
 
PDF
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
Xin-She Yang
 
PDF
Test Problems in Optimization
Xin-She Yang
 
PDF
Engineering Optimisation by Cuckoo Search
Xin-She Yang
 
PDF
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
PDF
Eagle Strategy Using Levy Walk and Firefly Algorithms For Stochastic Optimiza...
Xin-She Yang
 
PDF
Fractals in Small-World Networks With Time Delay
Xin-She Yang
 
PDF
Chaos in Small-World Networks
Xin-She Yang
 
Cuckoo Search Algorithm: An Introduction
Xin-She Yang
 
Metaheuristic Algorithms: A Critical Analysis
Xin-She Yang
 
A Biologically Inspired Network Design Model
Xin-She Yang
 
Flower Pollination Algorithm (matlab code)
Xin-She Yang
 
Nature-Inspired Metaheuristic Algorithms
Xin-She Yang
 
Metaheuristics and Optimiztion in Civil Engineering
Xin-She Yang
 
A Biologically Inspired Network Design Model
Xin-She Yang
 
Introduction to Computational Mathematics (2nd Edition, 2015)
Xin-She Yang
 
Memetic Firefly algorithm for combinatorial optimization
Xin-She Yang
 
Two-Stage Eagle Strategy with Differential Evolution
Xin-She Yang
 
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Xin-She Yang
 
Bat Algorithm for Multi-objective Optimisation
Xin-She Yang
 
Are motorways rational from slime mould's point of view?
Xin-She Yang
 
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
Xin-She Yang
 
Test Problems in Optimization
Xin-She Yang
 
Engineering Optimisation by Cuckoo Search
Xin-She Yang
 
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
Eagle Strategy Using Levy Walk and Firefly Algorithms For Stochastic Optimiza...
Xin-She Yang
 
Fractals in Small-World Networks With Time Delay
Xin-She Yang
 
Chaos in Small-World Networks
Xin-She Yang
 

Recently uploaded (20)

PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PDF
B.Tech Data Science Program (Industry Integrated ) Syllabus
rvray078
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PPT
Ppt for engineering students application on field effect
lakshmi.ec
 
PDF
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
demidovs1
 
PDF
5 Influence line.pdf for structural engineers
Endalkazene
 
Introduction to Data Science: data science process
ShivarkarSandip
 
B.Tech Data Science Program (Industry Integrated ) Syllabus
rvray078
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
Ppt for engineering students application on field effect
lakshmi.ec
 
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
demidovs1
 
5 Influence line.pdf for structural engineers
Endalkazene
 

Multiobjective Bat Algorithm (demo only)

  • 1. % ============================================================ % % Files of the Matlab programs included in the book: % % Xin-She Yang, Nature-Inspired Metaheuristic Algorithms, % % Second Edition, Luniver Press, (2010). www.luniver.com % % ============================================================ % % ------------------------------------------------------------ % % Bat-inspired algorithm for continuous optimization (demo) % % Programmed by Xin-She Yang @Cambridge University 2010 % % For details, please see the following papers: % 1) Xin-She Yang, Bat algorithm for multi-objective optimization, % Int. J. Bio-Inspired Computation, Vol.3, No.5, 267-274 (2011). % 2) Xin-She Yang, Xingshi He, Bat Algorithm: Literature Review % and Applications, Int. J. Bio-Inspired Computation, % Vol. 5, No. 4, pp. 141-149 (2013). % ------------------------------------------------------------ % function Q=moba_demo(NPareto) if nargin<1, NPareto=40; % Number of points on the Pareto front end global w; for k=1:NPareto, % Generate a weighting coefficient:w so that w1=w, w2=1-w, w1+w2=1. % Observations suggest that systematically monotonic weights are % better than random weights. w=k/NPareto; [best,fmin]=bat_algorithm; [obj1,obj2]=Funobj(best); Q(k,:)=[obj1,obj2]; % Output/display disp(['Weight: ',num2str(w)]); disp(['Best Obj1=',num2str(obj1),' Obj2=',num2str(obj2)]); end % Display the Pareto front plot(Q(:,1),Q(:,2),'o'); xlabel('Obj_1'); ylabel('Obj_2'); % The main part of the Bat Algorithm % % Usage: bat_algorithm([20 0.25 0.5]); % function [best,fmin,N_iter]=bat_algorithm(para) % Default parameters if nargin<1, para=[10 0.25 0.5]; end n=para(1); % Population size, typically 10 to 25 A=para(2); % Loudness (constant or decreasing) r=para(3); % Pulse rate (constant or decreasing) % This frequency range determines the scalings Qmin=0; % Frequency minimum Qmax=2; % Frequency maximum % Iteration parameters %% In order to obtain better/more accurate results, N_iter %% should be increased to N_iter=2000 or more if necessary. N_iter=1000; % Total number of function evaluations % Dimension of the search variables d=3; % Initial arrays Q=zeros(n,1); % Frequency v=zeros(n,d); % Velocities % Initialize the population/solutions for i=1:n,
  • 2. Sol(i,:)=randn(1,d); Fitness(i)=Fun(Sol(i,:)); end % Find the current best [fmin,I]=min(Fitness); best=Sol(I,:); % ====================================================== % % Note: As this is a demo, here we did not implement the % % reduction of loudness and increase of emission rates. % % Interested readers can do some parametric studies % % and also implementation various changes of A and r etc % % ====================================================== % % Start the iterations -- Bat Algorithm for i_ter=1:N_iter, % Loop over all bats/solutions for i=1:n, Q(i)=Qmin+(Qmin-Qmax)*rand; v(i,:)=v(i,:)+(Sol(i,:)-best)*Q(i); S(i,:)=Sol(i,:)+v(i,:); % Pulse rate if rand>r S(i,:)=best+0.01*randn(1,d); end % Evaluate new solutions Fnew=Fun(S(i,:)); % If the solution improves or not too loudness if (Fnew<=Fitness(i)) & (rand<A) , Sol(i,:)=S(i,:); Fitness(i)=Fnew; end % Update the current best if Fnew<=fmin, best=S(i,:); fmin=Fnew; end end end % End of the main bat algorithm and output/display can be added here. % Put your objective functions here function z=Fun(u) global w; [obj1,obj2]=Funobj(u); z=obj1*w+(1-w)*obj2; % Two objectives function [obj1,obj2]=Funobj(u) % In the simplest 1D case, f1=x^2, f2=(x-2)^2. % In the d-dim case, the Pareto front extends from (0,4d) to (4d,0). obj1=sum(u.^2); obj2=sum((u-2).^2);