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

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
 

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

PPTX
Bat Algorithm_Basics
Designage Solutions
 
PDF
Bat Algorithm for Multi-objective Optimisation
Xin-She Yang
 
PDF
A Hybrid Bat Algorithm
Xin-She Yang
 
PDF
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
PPTX
batalgorithm-170406072944 (4).pptx
gopikahari7
 
PPTX
batalgorithm-170406072944 (4).pptx
gopikahari7
 
PPTX
batalgorithm-160501121237 (1).pptx
gopikahari7
 
PPTX
Bat algorithm
Rohit Gujar
 
PDF
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
PDF
Microstrip coupler design using bat
ijaia
 
PDF
1004.4170v1
forticket
 
PDF
Hybrid bat-ant colony optimization algorithm for rule-based feature selection...
IJECEIAES
 
PDF
Gy3312241229
IJERA Editor
 
PDF
Computational Intelligence Assisted Engineering Design Optimization (using MA...
AmirParnianifard1
 
PDF
Differential evolution optimization technique
Siksha 'O' Anusandhan (Deemed to be University )
 
PDF
PSOGlobalSearching
Shiyan (诗言) Wei (韦)
 
PPTX
DNA ppt for beginners , how dna works in out body
NishthaShah16
 
TXT
Firefly algorithm
Xin-She Yang
 
PDF
A Binary Bat Inspired Algorithm for the Classification of Breast Cancer Data
ijscai
 
PDF
Bat Algorithm: Literature Review and Applications
Xin-She Yang
 
Bat Algorithm_Basics
Designage Solutions
 
Bat Algorithm for Multi-objective Optimisation
Xin-She Yang
 
A Hybrid Bat Algorithm
Xin-She Yang
 
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
batalgorithm-170406072944 (4).pptx
gopikahari7
 
batalgorithm-170406072944 (4).pptx
gopikahari7
 
batalgorithm-160501121237 (1).pptx
gopikahari7
 
Bat algorithm
Rohit Gujar
 
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 
Microstrip coupler design using bat
ijaia
 
1004.4170v1
forticket
 
Hybrid bat-ant colony optimization algorithm for rule-based feature selection...
IJECEIAES
 
Gy3312241229
IJERA Editor
 
Computational Intelligence Assisted Engineering Design Optimization (using MA...
AmirParnianifard1
 
Differential evolution optimization technique
Siksha 'O' Anusandhan (Deemed to be University )
 
PSOGlobalSearching
Shiyan (诗言) Wei (韦)
 
DNA ppt for beginners , how dna works in out body
NishthaShah16
 
Firefly algorithm
Xin-She Yang
 
A Binary Bat Inspired Algorithm for the Classification of Breast Cancer Data
ijscai
 
Bat Algorithm: Literature Review and Applications
Xin-She Yang
 
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
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
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
 
PDF
Cellular Automata, PDEs and Pattern Formation
Xin-She Yang
 
PDF
Biology-Derived Algorithms in Engineering Optimization
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
 
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
 
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
 
Cellular Automata, PDEs and Pattern Formation
Xin-She Yang
 
Biology-Derived Algorithms in Engineering Optimization
Xin-She Yang
 
Ad

Recently uploaded (20)

PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
Hashing Introduction , hash functions and techniques
sailajam21
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 

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);