Sie sind auf Seite 1von 5

Cuckoo Search (CS) Algorithm - File Exchange - MATLAB Central

http://www.mathworks.in/matlabcentral/fileexchange/29809-cuckoo-sear...

Search:

File Exchange Create Account Log In

File Exchange

Answers

Newsgroup

Link Exchange

Blogs

Trendy

Cody

Contest

MathWorks.com

Cuckoo Search (CS) Algorithm


by Xin-She Yang 22 Dec 2010 (Updated 14 Feb 2013) A standard Cuckoo Search is implemented, which is very efficient. There are three versions now. Watch this File
3.5 | 4 ratings

Code covered by the BSD License

Rate this file

201 Downloads (last 30 days) File Size: 8.84 KB File ID: #29809

Highlights from

Cuckoo Search (CS) Algorithm


[bestnest,fmin]=cuckoo_search... [bestnest,fmin]=cuckoo_search... [bestsol,fval]=cuckoo_search_...

File Information View all files Description A new metaheuristic optimization algorithm, called Cuckoo Search (CS), is fully implemented, and the vectorized version is given here. This code demonstrates how CS works for unconstrained optimization, which can easily be extended to solve various global optimization problems efficiently. Three versions are provided: Cuckoo_search.m is for a given tolerance. Cuckoo_search_new.m is for a fixed number of iterations. Cuckoo_search_spring.m is constrained optimization for designing a spring. MATLAB release MATLAB 7 (R14)

Tags for This File Everyone's Tags control design, evolutionary algorithms, finance, hello sir, hello sir i need the matlab codes of multiobjective cuckoo searc(2), image processing, levy flights implementation in discrete optimization problem usi(2), mathematics, metaheuristic, modeling, natureinspired algorithms, neural computing, optimization(2), simulation Tags I've Applied Add New Tags Please login to tag files.

Comments and Ratings (32) 16 Jan 2013 SWETHA Hello sir, I need to implement face recognition based on cuckoo search algorithm for my academic purpose. So please can you help to implement. hello sir i need the multi-objective cuckoo search MOCS matlab codes for my thesies can you put these codes in internet? 06 Dec 2012 setareh hello sir can i use the cuckoo search algorithm for routing problem in computers network? 04 Nov 2012 hema hello, can this program be used to find min and max of an objective function hello sir, i want to know if this program works for constrained objective function. please help Has anyone tried to implement this algorithm into train function in neural network; eg. trainpso of particle swarm Hello sir, im actually trying to apply CS to design digital FIR filter. My objective function gives values in a 60*60 matrices. Ive changed value of n & nd to 60. but im still not sure how to attach my objective function to CS (in line 175) in order to get optimized result. as in your code it takes 1 row at a time and applies sum to get 1 value which is further compared with fitness. but in my problem how am i supposed to get just 1 value to return from fobj. as it doesnt contain sum or any else function. how can i get best value in 1 row to compare to fitness for the optimization of my 60*60 matrices according to CS.

10 Jan 2013

setareh

04 Nov 2012

hema

31 Oct 2012

Ken Kueh

30 Oct 2012

Lucky

1 of 5

2/19/2013 11:06 PM

Cuckoo Search (CS) Algorithm - File Exchange - MATLAB Central

http://www.mathworks.in/matlabcentral/fileexchange/29809-cuckoo-sear...

kindly help me, ill be highly obliged. Thank You. 05 Oct 2012 Xin-She Yang Thanks. Yes, of course, you can use any linear constraints. Strictly speaking, you can use both linear and nonlinear constraints in the lines where the nonlinear function is defined. Hi. Can i used this algorithm for linear equatiom or it only works with non linear equation? 24 Jul 2012 Luc I had an optimal control problem with 56 control parameters for an industrial applications. After trying PSO and other algorithms, I tried cuckoo search, and found that, among the 4 methods I tried, cuckoo search obtained the best results. Well done! Downloaded it, tried it, and its very efficient! Hi... Im want to ask about Cuckoo Search implementation in Discrete Optimization Problem... Im now trying to implement it in a TSP (Traveling Salesman Problem) Right now, im representing edge in TSP using a fuzzy matrices... Im using levy flights as random step for the probability change (but its too big), first i try to normalize it, but it makes the probability value has a chance to become zero, its caused by large difference from one value to other in the matrices produced, but if im not normalizing it then the itll stack in local optima and of course the value will bigger than 1... In converting from fuzzy matrices to a path, im using Max Number Method in fuzzy matrices... Beside that im a little afraid of wrong implementation in cuckoo search itself... Can you give me suggestion/idea about this ? im really confused about this... 05 Jul 2012 Xin-She Yang Thanks. Thats a good question. The demo implementation uses a given tolerance, but you can easily change it into a given number of iteration by replacing the line "while (fmin>Tol)" with the following two lines N_numEval=1000; for t=1:N_numEval, and remove the line "N_iter=N_iter+n" because it becomes irrelevant. Now the new stopping criterion should allow you to do things more flexibly. Of course, to get better accuracy, you need to increase N_numEval from 1000 to even 10000 or higher. 05 Jul 2012 Nur hi.. Im curious about something. Supposed the cuckoo search can be use as an optimization technique which means we can either find the maximum or the minimum. but after I tested it with several objective functions, i found that we have to know the tolerance in order to find the best solutions. which mean i have to know what gives the maximum or minimum value for the function. supposed the cuckoo search have to find what the max or min value isnt it.? but what i found, when I change the tolerance, the min value will be change which mean, the min value depends on the tolerance. so, that mean this cuckoo search didnt find the minimum value, instead we have to know what is the value of tolerance to give the minimum value. isnt it? can you explain about this? im really confuse about this matter. 18 Jun 2012 Xin-She Yang Thanks. Of course, cuckoo search can solve that sort of problem. In fact, it has been designed to solve nonlinear problems in higher dimensions (nd) where nd is the number of dimensions, which can be 1, 2, 100, 4000, several thousands or even higher. The search principle is the same. In this demo, nd=15. So problems with two variables are usually considered "easy". Thanks. hi again.. i would like to know either this cuckoo search can solve the objective function with multiple variable such as this one f(x,y) = y - x - 2x^2 - 2xy - y^2

05 Oct 2012

Nur

22 Jul 2012 05 Jul 2012

QQ Dedy Suwandi

18 Jun 2012

Nur

2 of 5

2/19/2013 11:06 PM

Cuckoo Search (CS) Algorithm - File Exchange - MATLAB Central

http://www.mathworks.in/matlabcentral/fileexchange/29809-cuckoo-sear...

11 May 2012

Nur

thank you for your response. Does it mean I cant test the function? I have tried change the function at the last line (line 175) with my function and also the dimension, but it gives me error at line 134. it says that the number of element in j is not equal to fnew. do I need to change anything?

10 May 2012

Xin-She Yang

Hi, Thanks. The function you mentioned is too simple. Anyway, if you want to test any function, just change the last line (Line 175), also changed line 51 (the number of dimensions). hi..can someone help me..I want to use this cuckoo search algorithm to test a function. It state that we can change the function with our own function. But I dont know how and which part should I change. I want to test this function : y=6x-x^2 can someone help me to get the value of x and y at maximum point.. thank you..

10 May 2012

Nur

14 Mar 2012 09 Jan 2012

mustafa arslan suman arora

nice Hi, Sir Can u tell me cuckoo search will apply on Eduction Data Mining ? The empty_nests function in its current form can take the solution beyond bounds. Add these lines to the end of the function to correct this problem: for i=1:n, new_nest(i,:)=simplebounds(new_nest(i,:),Lb,Ub); end

26 Oct 2011

Seif Fateen

25 Aug 2011

priya

Hi,I have read the paper in which it is shown that cuckoo search is better than particle swarm optimization technique.How can we use CS algo for test effort estimation? Hi, Ive had the same situation with Ennio. Would you like to clarify them? Thanks. If you can define an appropriate objective function that links with the parameters of SVM, it becomes an optimization problem, and thus should be solved efficiently by CS in this case. Hi Yang, currently I am focusing on selecting optimal set of features and model parameters (e.g. SVM). I wondering that is it possible to use CS for my case? Would you please provide me some suggestions? Thanks a lot!

10 Aug 2011

chongya

10 Aug 2011

Xin-She Yang

09 Aug 2011

Wen

04 May 2011

Ennio Grasso

Hi again, I finally received (and read) your book. Im comparing the code in the book and the latest which is published here. I understand this one is supposed to be better and refined but Id like to ask some clarification nonetheless since some things dont add up to me. 1) the 1st thing I noticed is that get_cuckoo in the books algorithm (hence BA) cuckoos make random walks around the best so far, whereas in the latest algorithm (LA) they move from their own current position. chapter 12.2 of the book seems to explain these 2 strategies, but I wonder if indeed random walks from the current solution (not even around the better locally as in PSO) dont make intensification too sparse? 2) the 2nd issue has to do with the empty_nest. As I understand the objective here is apply "selection of the fittest". In BA indeed the worst nests are selected as candidates for replacement (again with random walk this time around the current position). In LA it seems the concept of "worst nests" is lost and a kind of Differential Evolution approach is taken, where a nest is moved (random uniform) toward one of the other nest. It seems to me that both approach are reasonable but they are rather different conceptually. I mean, in the principle of "survival of the fittest" shouldnt we have a selection (as in BA) of the worst nest as candidate for this mutation rather than all of them (provided rand<pa obviously). In other words, shouldnt we always pick the worst nest rather than in parallel all nests together? Thanks a lot for any help. Thanks a lot for your prompt reply. Indeed I ordered your book as googles version wont allow full access. In this paper http://www.google.com/url?sa=t&source=web& cd=1&ved=0CBwQFjAA&url=http%3A%2F

29 Mar 2011

Ennio Grasso

3 of 5

2/19/2013 11:06 PM

Cuckoo Search (CS) Algorithm - File Exchange - MATLAB Central

http://www.mathworks.in/matlabcentral/fileexchange/29809-cuckoo-sear...

%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1. 130.5359%26rep%3Drep1%26type%3Dpdf&rct=j& q=COMPARISON%20OF%20THREE%20ALGORITHMS%20FOR%20 L%C3%89VY%20NOISE&ei=Gb6RTcWeE83EswbxsLDQBg& usg=AFQjCNEQ4Xdw6mUnPesejAzxI4yjUcKP2w&cad=rja they compare 3 algs for levy distribution and they say McCullochs alg perform better than Mantegnas. Also, they provide a more complex Mantegnas implementation than yours (in matlab line 35-49) 35 invalpha = 1/alpha; 36 sigx = ((gamma(1+alpha)*sin(pi*alpha/2))/(gamma((1+alpha)/2)... 37 *alpha*2^((alpha-1)/2)))^invalpha; 38 v = sigx*randn(n,N)./abs(randn(n,N)).^invalpha; 39 kappa = (alpha*gamma((alpha+1)/(2*alpha)))/gamma(invalpha)... 40 *((alpha*gamma((alpha+1)/2))/(gamma(1+alpha)*sin(pi*alpha /2)))^invalpha; 41 p = [-17.7767 113.3855 -281.5879 337.5439 -193.5494 44.8754]; 42 c = polyval(p, alpha); 43 w = ((kappa-1)*exp(-abs(v)/c)+1).*v; 44 if(n>1) 45 z = (1/n^invalpha)*sum(w); 46 else 47 z = w; 48 end 49 z = c^invalpha*z; it seems your version is a simplified one that avoids step 39-49? BTW, all of my questioning is because Im trying to port your alg in Java and I need to understand all the nuances of all tidbits. Thanks a lot for any help. 29 Mar 2011 Xin-She Yang Thanks. Thats a good question. a) For the formula: s=s+stepsize.*randn(size(s)), the stepsize is a random number vector, but it is biased because if s<best (in the sense of component-wise comparison), then this stepsize is biased to one side, this leads to a biased random-walk. In order to explore the search space more efficiently, a symmetric random walk should be used. Thus, another factor randn. Here you might argue that the vector "stepsize" is already symmetric, but this is only true for step sizes, but not for s. Ideally, lets use 2D as an example, a random walk should consists of a step size and angle (0 to 360) in a circle on a 2D surface. The step size should be Gaussian (or Levy), but the angle should be uniformly distributed, otherwise, some regions cannot be reached. b) The factor 0.01 or 1/100 is mainly to limit the step size. Otherwise, Levy flights become too aggressive, and thus the new solutions generated will be even outside of the domain. For a more detail description of this factor, please see the formulas (4.14 to 4.17) on page 33 of the book "Nature-Inspired Metaheuristic Algoirthms", Second Edition, (Yang 2010), Luniver Press. Or at the link http://books.google.co.uk/books?id=iVB_ETlh4ogC& printsec=frontcover&dq=nature-inspired+metaheuristic&hl=en& ei=tLaRTbLyMo-0hAeukMybDw&sa=X&oi=book_result&ct=result& resnum=1&ved=0CCoQ6AEwAA#v=onepage&q&f=false 29 Mar 2011 Ennio Grasso Hi there, could you please clarify why you apply s=s+stepsize.*randn(size(s)); (line 123), isnt stepsize already in levy distribution? Why the need to multiply for a gaussian? Also, could you please explain what "the factor 0.01 comes from the fact that L/100 should the typical step size of walks/flights where L is the typical lenghtscale". Has it anything to do with the lower-upper bound limits of the problem? Thanks a lot. Thanks. I think you are right that K=rand(size(nest))<pa is consistent with the pseudocode. This only changes the values of the pa. However, this does not affect the performance of the CS. Again thanks :) 20 Mar 2011 Marielena Hi shouldnt it be K=rand(size(nest))<pa in line 147 of the code? otherwise a fraction of 75% would be replaced, wouldnt it?

21 Mar 2011

Xin-She Yang

4 of 5

2/19/2013 11:06 PM

Cuckoo Search (CS) Algorithm - File Exchange - MATLAB Central

http://www.mathworks.in/matlabcentral/fileexchange/29809-cuckoo-sear...

Please login to add a comment or rating.

Updates 11 Feb 2013 11 Feb 2013 14 Feb 2013 There was a minor typo in the previous file, and a newer version is attached. Add a newer version. A version for constrained optimization with a spring design benchmark is now included. This version has three files.

Tag Activity for this File Tag mathematics optimization finance image processing modeling simulation control design optimization levy flights implementation in discrete optimization problem usi levy flights implementation in discrete optimization problem usi hello sir hello sir i need the matlab codes of multiobjective cuckoo searc natureinspired algorithms neural computing metaheuristic evolutionary algorithms hello sir i need the matlab codes of multiobjective cuckoo searc Applied By Xin-She Yang Xin-She Yang Xin-She Yang Xin-She Yang Xin-She Yang Xin-She Yang Xin-She Yang suman arora Dedy Suwandi sadik bala setareh setareh Xin-She Yang Xin-She Yang Xin-She Yang Xin-She Yang Kunal Date/Time 23 Dec 2010 08:10:56 23 Dec 2010 08:10:56 23 Dec 2010 08:10:56 23 Dec 2010 08:10:57 23 Dec 2010 08:10:57 23 Dec 2010 08:10:57 23 Dec 2010 08:10:57 09 Jan 2012 05:11:30 05 Jul 2012 19:44:48 13 Dec 2012 00:18:33 10 Jan 2013 15:12:54 10 Jan 2013 15:14:20 11 Feb 2013 19:33:43 11 Feb 2013 19:33:44 11 Feb 2013 19:33:44 11 Feb 2013 19:33:45 19 Feb 2013 16:10:01

Contact us

1994-2013 The MathWorks, Inc. Featured MathWorks.com Topics:

Site Help

Patents

Trademarks Support

Privacy Policy

Preventing Piracy Webinars

Terms of Use Newsletters MATLAB Trials Careers

New Products

Documentation

Training

5 of 5

2/19/2013 11:06 PM

Das könnte Ihnen auch gefallen