SlideShare a Scribd company logo
% --------------------------------------------------------------------%
% Flower pollenation algorithm (FPA), or flower algorithm %
% Programmed by Xin-She Yang @ May 2012 %
% --------------------------------------------------------------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Notes: This demo program contains the very basic components of %
% the flower pollination algorithm (FPA), or flower algorithm (FA), %
% for single objective optimization. It usually works well for %
% unconstrained functions only. For functions/problems with %
% limits/bounds and constraints, constraint-handling techniques %
% should be implemented to deal with constrained problems properly. %
% %
% Citation details: %
%1)Xin-She Yang, Flower pollination algorithm for global optimization,%
% Unconventional Computation and Natural Computation, %
% Lecture Notes in Computer Science, Vol. 7445, pp. 240-249 (2012). %
%2)X. S. Yang, M. Karamanoglu, X. S. He, Multi-objective flower %
% algorithm for optimization, Procedia in Computer Science, %
% vol. 18, pp. 861-868 (2013). %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [best,fmin,N_iter]=fpa_demo(para)
% Default parameters
if nargin<1,
para=[20 0.8];
end
n=para(1); % Population size, typically 10 to 25
p=para(2); % probabibility switch
% Iteration parameters
N_iter=2000; % Total number of iterations
% Dimension of the search variables
d=3;
Lb=-2*ones(1,d);
Ub=2*ones(1,d);
% Initialize the population/solutions
for i=1:n,
Sol(i,:)=Lb+(Ub-Lb).*rand(1,d);
Fitness(i)=Fun(Sol(i,:));
end
% Find the current best
[fmin,I]=min(Fitness);
best=Sol(I,:);
S=Sol;
% Start the iterations -- Flower Algorithm
for t=1:N_iter,
% Loop over all bats/solutions
for i=1:n,
% Pollens are carried by insects and thus can move in
% large scale, large distance.
% This L should replace by Levy flights
% Formula: x_i^{t+1}=x_i^t+ L (x_i^t-gbest)
if rand>p,
%% L=rand;
L=Levy(d);
dS=L.*(Sol(i,:)-best);
S(i,:)=Sol(i,:)+dS;
% Check if the simple limits/bounds are OK
S(i,:)=simplebounds(S(i,:),Lb,Ub);
% If not, then local pollenation of neighbor flowers
else
epsilon=rand;
% Find random flowers in the neighbourhood
JK=randperm(n);
% As they are random, the first two entries also random
% If the flower are the same or similar species, then
% they can be pollenated, otherwise, no action.
% Formula: x_i^{t+1}+epsilon*(x_j^t-x_k^t)
S(i,:)=S(i,:)+epsilon*(Sol(JK(1),:)-Sol(JK(2),:));
% Check if the simple limits/bounds are OK
S(i,:)=simplebounds(S(i,:),Lb,Ub);
end
% Evaluate new solutions
Fnew=Fun(S(i,:));
% If fitness improves (better solutions found), update then
if (Fnew<=Fitness(i)),
Sol(i,:)=S(i,:);
Fitness(i)=Fnew;
end
% Update the current global best
if Fnew<=fmin,
best=S(i,:) ;
fmin=Fnew ;
end
end
% Display results every 100 iterations
if round(t/100)==t/100,
best
fmin
end
end
% Output/display
disp(['Total number of evaluations: ',num2str(N_iter*n)]);
disp(['Best solution=',num2str(best),' fmin=',num2str(fmin)]);
% Application of simple constraints
function s=simplebounds(s,Lb,Ub)
% Apply the lower bound
ns_tmp=s;
I=ns_tmp<Lb;
ns_tmp(I)=Lb(I);
% Apply the upper bounds
J=ns_tmp>Ub;
ns_tmp(J)=Ub(J);
% Update this new move
s=ns_tmp;
% Draw n Levy flight sample
function L=Levy(d)
% Levy exponent and coefficient
% For details, see Chapter 11 of the following book:
% Xin-She Yang, Nature-Inspired Optimization Algorithms, Elsevier, (2014).
beta=3/2;
sigma=(gamma(1+beta)*sin(pi*beta/2)/(gamma((1+beta)/2)*beta*2^((beta-
1)/2)))^(1/beta);
u=randn(1,d)*sigma;
v=randn(1,d);
step=u./abs(v).^(1/beta);
L=0.01*step;
% Objective function and here we used Rosenbrock's 3D function
function z=Fun(u)
z=(1-u(1))^2+100*(u(2)-u(1)^2)^2+100*(u(3)-u(2)^2)^2;

More Related Content

What's hot

Eece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transformEece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transform
Sandilya Sridhara
 
Sliding Mode Controller
Sliding Mode Controller Sliding Mode Controller
Sliding Mode Controller
Ramaiahsubasri
 
Gunn Diode
Gunn Diode Gunn Diode
Gunn Diode
Homework Guru
 
Advanced control foundation tools and techniques
Advanced control foundation   tools and techniquesAdvanced control foundation   tools and techniques
Advanced control foundation tools and techniques
Emerson Exchange
 
Power semi conductor devices
Power semi conductor devicesPower semi conductor devices
Power semi conductor devices
Dr.KARTHIKEYAN J
 
FET Biasing
FET BiasingFET Biasing
FET Biasing
PRAVEENA N G
 
Chapter-4 FET (1).ppt
Chapter-4 FET (1).pptChapter-4 FET (1).ppt
Chapter-4 FET (1).ppt
JeelBhanderi4
 
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEWSUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
VIT VELLORE
 
digital control Chapter1 slide
digital control Chapter1 slidedigital control Chapter1 slide
digital control Chapter1 slide
asyrafjpk
 
High Electron Mobility Transistor
High Electron Mobility TransistorHigh Electron Mobility Transistor
High Electron Mobility Transistor
RCC Institute of Information Technology
 
Directional couplers 22
Directional couplers 22Directional couplers 22
Directional couplers 22
HIMANSHU DIWAKAR
 
Solved problems to_chapter_09
Solved problems to_chapter_09Solved problems to_chapter_09
Solved problems to_chapter_09
Shah Zaib
 
S parameters
S parametersS parameters
S parameters
Amit Rastogi
 
Topic 2 - Switch Realization.pptx
Topic 2 - Switch Realization.pptxTopic 2 - Switch Realization.pptx
Topic 2 - Switch Realization.pptx
VanJasperCastillo
 
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
Amr E. Mohamed
 
HEMT
HEMTHEMT
P, PI AND PID CONTROLLER
P, PI AND PID CONTROLLERP, PI AND PID CONTROLLER
P, PI AND PID CONTROLLER
karan sati
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
AbhayDhupar
 
Passive and active devices
Passive and active devicesPassive and active devices
Passive and active devices
srirenga
 

What's hot (20)

Eece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transformEece 301 note set 14 fourier transform
Eece 301 note set 14 fourier transform
 
Sliding Mode Controller
Sliding Mode Controller Sliding Mode Controller
Sliding Mode Controller
 
Gunn Diode
Gunn Diode Gunn Diode
Gunn Diode
 
Advanced control foundation tools and techniques
Advanced control foundation   tools and techniquesAdvanced control foundation   tools and techniques
Advanced control foundation tools and techniques
 
Power semi conductor devices
Power semi conductor devicesPower semi conductor devices
Power semi conductor devices
 
FET Biasing
FET BiasingFET Biasing
FET Biasing
 
Chapter-4 FET (1).ppt
Chapter-4 FET (1).pptChapter-4 FET (1).ppt
Chapter-4 FET (1).ppt
 
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEWSUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
SUBSTRATE INTEGRATED WAVEGUIDE BASED ANTENNA AND ARRAY ----REVIEW
 
digital control Chapter1 slide
digital control Chapter1 slidedigital control Chapter1 slide
digital control Chapter1 slide
 
High Electron Mobility Transistor
High Electron Mobility TransistorHigh Electron Mobility Transistor
High Electron Mobility Transistor
 
Directional couplers 22
Directional couplers 22Directional couplers 22
Directional couplers 22
 
Solved problems to_chapter_09
Solved problems to_chapter_09Solved problems to_chapter_09
Solved problems to_chapter_09
 
S parameters
S parametersS parameters
S parameters
 
Topic 2 - Switch Realization.pptx
Topic 2 - Switch Realization.pptxTopic 2 - Switch Realization.pptx
Topic 2 - Switch Realization.pptx
 
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
Modern Control - Lec 03 - Feedback Control Systems Performance and Characteri...
 
HEMT
HEMTHEMT
HEMT
 
P, PI AND PID CONTROLLER
P, PI AND PID CONTROLLERP, PI AND PID CONTROLLER
P, PI AND PID CONTROLLER
 
Successive Approximation ADC
Successive Approximation ADC Successive Approximation ADC
Successive Approximation ADC
 
DCS
DCSDCS
DCS
 
Passive and active devices
Passive and active devicesPassive and active devices
Passive and active devices
 

Viewers also liked

Flower pollination
Flower pollinationFlower pollination
Flower pollination
Ahmed Fouad Ali
 
Whale optimizatio algorithm
Whale optimizatio algorithmWhale optimizatio algorithm
Whale optimizatio algorithm
Ahmed Fouad Ali
 
Flower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
Flower Pollination Algorithm: A Novel Approach for Multiobjective OptimizationFlower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
Flower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
Xin-She Yang
 
Recent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination AlgorithmRecent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination Algorithm
Editor IJCATR
 
Multi-objective Flower Algorithm for Optimization
Multi-objective Flower Algorithm for OptimizationMulti-objective Flower Algorithm for Optimization
Multi-objective Flower Algorithm for Optimization
Xin-She Yang
 
Cuckoo search algorithm
Cuckoo search algorithmCuckoo search algorithm
Cuckoo search algorithm
Ahmed Fouad Ali
 
Flower Pollination Algorithm for Global Optimization
Flower Pollination Algorithm for Global OptimizationFlower Pollination Algorithm for Global Optimization
Flower Pollination Algorithm for Global Optimization
Xin-She Yang
 
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
Editor IJCATR
 
Backtraking optimziation algorithm
Backtraking optimziation algorithmBacktraking optimziation algorithm
Backtraking optimziation algorithm
Ahmed Fouad Ali
 
Spider Monkey Optimization Algorithm
Spider Monkey Optimization AlgorithmSpider Monkey Optimization Algorithm
Spider Monkey Optimization Algorithm
Ahmed Fouad Ali
 
Tabu search
Tabu searchTabu search
Tabu search
Ahmed Fouad Ali
 
Social spider optimization
Social spider optimizationSocial spider optimization
Social spider optimization
Ahmed Fouad Ali
 
Grey wolf optimizer
Grey wolf optimizerGrey wolf optimizer
Grey wolf optimizer
Ahmed Fouad Ali
 
Hiroshi sugimoto
Hiroshi sugimotoHiroshi sugimoto
Hiroshi sugimoto
Pâm Fonseca
 
L010225762
L010225762L010225762
L010225762
IOSR Journals
 
Multiobjective Firefly Algorithm for Continuous Optimization
Multiobjective Firefly Algorithm for Continuous Optimization Multiobjective Firefly Algorithm for Continuous Optimization
Multiobjective Firefly Algorithm for Continuous Optimization
Xin-She Yang
 
Bat algorithm
Bat algorithmBat algorithm
Bat algorithm
Priya Kaushal
 
Particle Swarm Optimization Matlab code Using 50, 5000 Swarms
Particle Swarm Optimization Matlab code Using 50, 5000 SwarmsParticle Swarm Optimization Matlab code Using 50, 5000 Swarms
Particle Swarm Optimization Matlab code Using 50, 5000 Swarms
Raza Shamsi
 
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 Firefly Algorithm, Stochastic Test Functions and Design Optimisation Firefly Algorithm, Stochastic Test Functions and Design Optimisation
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
Xin-She Yang
 

Viewers also liked (20)

Flower pollination
Flower pollinationFlower pollination
Flower pollination
 
Whale optimizatio algorithm
Whale optimizatio algorithmWhale optimizatio algorithm
Whale optimizatio algorithm
 
Flower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
Flower Pollination Algorithm: A Novel Approach for Multiobjective OptimizationFlower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
Flower Pollination Algorithm: A Novel Approach for Multiobjective Optimization
 
Recent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination AlgorithmRecent Advances in Flower Pollination Algorithm
Recent Advances in Flower Pollination Algorithm
 
Multi-objective Flower Algorithm for Optimization
Multi-objective Flower Algorithm for OptimizationMulti-objective Flower Algorithm for Optimization
Multi-objective Flower Algorithm for Optimization
 
Cuckoo search algorithm
Cuckoo search algorithmCuckoo search algorithm
Cuckoo search algorithm
 
Flower Pollination Algorithm for Global Optimization
Flower Pollination Algorithm for Global OptimizationFlower Pollination Algorithm for Global Optimization
Flower Pollination Algorithm for Global Optimization
 
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
A Comparison between FPPSO and B&B Algorithm for Solving Integer Programming ...
 
Backtraking optimziation algorithm
Backtraking optimziation algorithmBacktraking optimziation algorithm
Backtraking optimziation algorithm
 
Spider Monkey Optimization Algorithm
Spider Monkey Optimization AlgorithmSpider Monkey Optimization Algorithm
Spider Monkey Optimization Algorithm
 
Tabu search
Tabu searchTabu search
Tabu search
 
Social spider optimization
Social spider optimizationSocial spider optimization
Social spider optimization
 
Grey wolf optimizer
Grey wolf optimizerGrey wolf optimizer
Grey wolf optimizer
 
Hiroshi sugimoto
Hiroshi sugimotoHiroshi sugimoto
Hiroshi sugimoto
 
L010225762
L010225762L010225762
L010225762
 
Multiobjective Firefly Algorithm for Continuous Optimization
Multiobjective Firefly Algorithm for Continuous Optimization Multiobjective Firefly Algorithm for Continuous Optimization
Multiobjective Firefly Algorithm for Continuous Optimization
 
Firefly
FireflyFirefly
Firefly
 
Bat algorithm
Bat algorithmBat algorithm
Bat algorithm
 
Particle Swarm Optimization Matlab code Using 50, 5000 Swarms
Particle Swarm Optimization Matlab code Using 50, 5000 SwarmsParticle Swarm Optimization Matlab code Using 50, 5000 Swarms
Particle Swarm Optimization Matlab code Using 50, 5000 Swarms
 
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 Firefly Algorithm, Stochastic Test Functions and Design Optimisation Firefly Algorithm, Stochastic Test Functions and Design Optimisation
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 

More from Xin-She Yang

Cuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionCuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An Introduction
Xin-She Yang
 
Metaheuristic Algorithms: A Critical Analysis
Metaheuristic Algorithms: A Critical AnalysisMetaheuristic Algorithms: A Critical Analysis
Metaheuristic Algorithms: A Critical Analysis
Xin-She Yang
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms
Xin-She Yang
 
A Biologically Inspired Network Design Model
A Biologically Inspired Network Design ModelA Biologically Inspired Network Design Model
A Biologically Inspired Network Design Model
Xin-She Yang
 
Multiobjective Bat Algorithm (demo only)
Multiobjective Bat Algorithm (demo only)Multiobjective Bat Algorithm (demo only)
Multiobjective Bat Algorithm (demo only)
Xin-She Yang
 
Bat algorithm (demo)
Bat algorithm (demo)Bat algorithm (demo)
Bat algorithm (demo)
Xin-She Yang
 
Firefly algorithm
Firefly algorithmFirefly algorithm
Firefly algorithm
Xin-She Yang
 
Nature-Inspired Metaheuristic Algorithms
Nature-Inspired Metaheuristic AlgorithmsNature-Inspired Metaheuristic Algorithms
Nature-Inspired Metaheuristic Algorithms
Xin-She Yang
 
Metaheuristics and Optimiztion in Civil Engineering
Metaheuristics and Optimiztion in Civil EngineeringMetaheuristics and Optimiztion in Civil Engineering
Metaheuristics and Optimiztion in Civil Engineering
Xin-She Yang
 
A Biologically Inspired Network Design Model
A Biologically Inspired Network Design ModelA Biologically Inspired Network Design Model
A Biologically Inspired Network Design Model
Xin-She Yang
 
Introduction to Computational Mathematics (2nd Edition, 2015)
Introduction to Computational Mathematics (2nd Edition, 2015)Introduction to Computational Mathematics (2nd Edition, 2015)
Introduction to Computational Mathematics (2nd Edition, 2015)
Xin-She Yang
 
Memetic Firefly algorithm for combinatorial optimization
Memetic Firefly algorithm for combinatorial optimizationMemetic Firefly algorithm for combinatorial optimization
Memetic Firefly algorithm for combinatorial optimization
Xin-She Yang
 
Two-Stage Eagle Strategy with Differential Evolution
Two-Stage Eagle Strategy with Differential EvolutionTwo-Stage Eagle Strategy with Differential Evolution
Two-Stage Eagle Strategy with Differential Evolution
Xin-She Yang
 
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Xin-She Yang
 
Bat Algorithm for Multi-objective Optimisation
Bat Algorithm for Multi-objective OptimisationBat Algorithm for Multi-objective Optimisation
Bat Algorithm for Multi-objective Optimisation
Xin-She Yang
 
Are motorways rational from slime mould's point of view?
Are motorways rational from slime mould's point of view?Are motorways rational from slime mould's point of view?
Are motorways rational from slime mould's point of view?
Xin-She Yang
 
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
Review of Metaheuristics and Generalized Evolutionary Walk AlgorithmReview of Metaheuristics and Generalized Evolutionary Walk Algorithm
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
Xin-She Yang
 
Test Problems in Optimization
Test Problems in OptimizationTest Problems in Optimization
Test Problems in Optimization
Xin-She Yang
 
Engineering Optimisation by Cuckoo Search
Engineering Optimisation by Cuckoo SearchEngineering Optimisation by Cuckoo Search
Engineering Optimisation by Cuckoo Search
Xin-She Yang
 
A New Metaheuristic Bat-Inspired Algorithm
A New Metaheuristic Bat-Inspired AlgorithmA New Metaheuristic Bat-Inspired Algorithm
A New Metaheuristic Bat-Inspired Algorithm
Xin-She Yang
 

More from Xin-She Yang (20)

Cuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An IntroductionCuckoo Search Algorithm: An Introduction
Cuckoo Search Algorithm: An Introduction
 
Metaheuristic Algorithms: A Critical Analysis
Metaheuristic Algorithms: A Critical AnalysisMetaheuristic Algorithms: A Critical Analysis
Metaheuristic Algorithms: A Critical Analysis
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms
 
A Biologically Inspired Network Design Model
A Biologically Inspired Network Design ModelA Biologically Inspired Network Design Model
A Biologically Inspired Network Design Model
 
Multiobjective Bat Algorithm (demo only)
Multiobjective Bat Algorithm (demo only)Multiobjective Bat Algorithm (demo only)
Multiobjective Bat Algorithm (demo only)
 
Bat algorithm (demo)
Bat algorithm (demo)Bat algorithm (demo)
Bat algorithm (demo)
 
Firefly algorithm
Firefly algorithmFirefly algorithm
Firefly algorithm
 
Nature-Inspired Metaheuristic Algorithms
Nature-Inspired Metaheuristic AlgorithmsNature-Inspired Metaheuristic Algorithms
Nature-Inspired Metaheuristic Algorithms
 
Metaheuristics and Optimiztion in Civil Engineering
Metaheuristics and Optimiztion in Civil EngineeringMetaheuristics and Optimiztion in Civil Engineering
Metaheuristics and Optimiztion in Civil Engineering
 
A Biologically Inspired Network Design Model
A Biologically Inspired Network Design ModelA Biologically Inspired Network Design Model
A Biologically Inspired Network Design Model
 
Introduction to Computational Mathematics (2nd Edition, 2015)
Introduction to Computational Mathematics (2nd Edition, 2015)Introduction to Computational Mathematics (2nd Edition, 2015)
Introduction to Computational Mathematics (2nd Edition, 2015)
 
Memetic Firefly algorithm for combinatorial optimization
Memetic Firefly algorithm for combinatorial optimizationMemetic Firefly algorithm for combinatorial optimization
Memetic Firefly algorithm for combinatorial optimization
 
Two-Stage Eagle Strategy with Differential Evolution
Two-Stage Eagle Strategy with Differential EvolutionTwo-Stage Eagle Strategy with Differential Evolution
Two-Stage Eagle Strategy with Differential Evolution
 
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
Accelerated Particle Swarm Optimization and Support Vector Machine for Busine...
 
Bat Algorithm for Multi-objective Optimisation
Bat Algorithm for Multi-objective OptimisationBat Algorithm for Multi-objective Optimisation
Bat Algorithm for Multi-objective Optimisation
 
Are motorways rational from slime mould's point of view?
Are motorways rational from slime mould's point of view?Are motorways rational from slime mould's point of view?
Are motorways rational from slime mould's point of view?
 
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
Review of Metaheuristics and Generalized Evolutionary Walk AlgorithmReview of Metaheuristics and Generalized Evolutionary Walk Algorithm
Review of Metaheuristics and Generalized Evolutionary Walk Algorithm
 
Test Problems in Optimization
Test Problems in OptimizationTest Problems in Optimization
Test Problems in Optimization
 
Engineering Optimisation by Cuckoo Search
Engineering Optimisation by Cuckoo SearchEngineering Optimisation by Cuckoo Search
Engineering Optimisation by Cuckoo Search
 
A New Metaheuristic Bat-Inspired Algorithm
A New Metaheuristic Bat-Inspired AlgorithmA New Metaheuristic Bat-Inspired Algorithm
A New Metaheuristic Bat-Inspired Algorithm
 

Recently uploaded

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
benykoy2024
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
azkamurat
 

Recently uploaded (20)

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
 

Flower Pollination Algorithm (matlab code)

  • 1. % --------------------------------------------------------------------% % Flower pollenation algorithm (FPA), or flower algorithm % % Programmed by Xin-She Yang @ May 2012 % % --------------------------------------------------------------------% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Notes: This demo program contains the very basic components of % % the flower pollination algorithm (FPA), or flower algorithm (FA), % % for single objective optimization. It usually works well for % % unconstrained functions only. For functions/problems with % % limits/bounds and constraints, constraint-handling techniques % % should be implemented to deal with constrained problems properly. % % % % Citation details: % %1)Xin-She Yang, Flower pollination algorithm for global optimization,% % Unconventional Computation and Natural Computation, % % Lecture Notes in Computer Science, Vol. 7445, pp. 240-249 (2012). % %2)X. S. Yang, M. Karamanoglu, X. S. He, Multi-objective flower % % algorithm for optimization, Procedia in Computer Science, % % vol. 18, pp. 861-868 (2013). % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [best,fmin,N_iter]=fpa_demo(para) % Default parameters if nargin<1, para=[20 0.8]; end n=para(1); % Population size, typically 10 to 25 p=para(2); % probabibility switch % Iteration parameters N_iter=2000; % Total number of iterations % Dimension of the search variables d=3; Lb=-2*ones(1,d); Ub=2*ones(1,d); % Initialize the population/solutions for i=1:n, Sol(i,:)=Lb+(Ub-Lb).*rand(1,d); Fitness(i)=Fun(Sol(i,:)); end % Find the current best [fmin,I]=min(Fitness); best=Sol(I,:); S=Sol; % Start the iterations -- Flower Algorithm for t=1:N_iter, % Loop over all bats/solutions for i=1:n, % Pollens are carried by insects and thus can move in % large scale, large distance. % This L should replace by Levy flights % Formula: x_i^{t+1}=x_i^t+ L (x_i^t-gbest) if rand>p, %% L=rand; L=Levy(d); dS=L.*(Sol(i,:)-best); S(i,:)=Sol(i,:)+dS;
  • 2. % Check if the simple limits/bounds are OK S(i,:)=simplebounds(S(i,:),Lb,Ub); % If not, then local pollenation of neighbor flowers else epsilon=rand; % Find random flowers in the neighbourhood JK=randperm(n); % As they are random, the first two entries also random % If the flower are the same or similar species, then % they can be pollenated, otherwise, no action. % Formula: x_i^{t+1}+epsilon*(x_j^t-x_k^t) S(i,:)=S(i,:)+epsilon*(Sol(JK(1),:)-Sol(JK(2),:)); % Check if the simple limits/bounds are OK S(i,:)=simplebounds(S(i,:),Lb,Ub); end % Evaluate new solutions Fnew=Fun(S(i,:)); % If fitness improves (better solutions found), update then if (Fnew<=Fitness(i)), Sol(i,:)=S(i,:); Fitness(i)=Fnew; end % Update the current global best if Fnew<=fmin, best=S(i,:) ; fmin=Fnew ; end end % Display results every 100 iterations if round(t/100)==t/100, best fmin end end % Output/display disp(['Total number of evaluations: ',num2str(N_iter*n)]); disp(['Best solution=',num2str(best),' fmin=',num2str(fmin)]); % Application of simple constraints function s=simplebounds(s,Lb,Ub) % Apply the lower bound ns_tmp=s; I=ns_tmp<Lb; ns_tmp(I)=Lb(I); % Apply the upper bounds J=ns_tmp>Ub; ns_tmp(J)=Ub(J); % Update this new move s=ns_tmp; % Draw n Levy flight sample function L=Levy(d) % Levy exponent and coefficient % For details, see Chapter 11 of the following book: % Xin-She Yang, Nature-Inspired Optimization Algorithms, Elsevier, (2014). beta=3/2;