├── Get_Functions_details.m ├── HHO brief.pdf ├── HHO.m ├── LATEX file of HHO.zip ├── LICENSE.txt ├── Matlab codes of HHO Harris Hawks Optimization Algorithm (Library).zip ├── README.md ├── initialization.m └── main.m /Get_Functions_details.m: -------------------------------------------------------------------------------- 1 | % Please refer to the main paper: 2 | 3 | % Ali Asghar Heidari, Seyedali Mirjalili, Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, Huiling Chen 4 | % Harris hawks optimization: Algorithm and applications 5 | % Future Generation Computer Systems, DOI: https://doi.org/10.1016/j.future.2019.02.028 6 | % _______ 7 | 8 | function [lb,ub,dim,fobj] = Get_Functions_details(F) 9 | 10 | 11 | switch F 12 | case 'F1' 13 | fobj = @F1; 14 | lb=-100; 15 | ub=100; 16 | dim=30; 17 | 18 | case 'F2' 19 | fobj = @F2; 20 | lb=-10; 21 | ub=10; 22 | dim=30; 23 | 24 | case 'F3' 25 | fobj = @F3; 26 | lb=-100; 27 | ub=100; 28 | dim=30; 29 | 30 | case 'F4' 31 | fobj = @F4; 32 | lb=-100; 33 | ub=100; 34 | dim=30; 35 | 36 | case 'F5' 37 | fobj = @F5; 38 | lb=-30; 39 | ub=30; 40 | dim=30; 41 | 42 | case 'F6' 43 | fobj = @F6; 44 | lb=-100; 45 | ub=100; 46 | dim=30; 47 | 48 | case 'F7' 49 | fobj = @F7; 50 | lb=-1.28; 51 | ub=1.28; 52 | dim=30; 53 | 54 | case 'F8' 55 | fobj = @F8; 56 | lb=-500; 57 | ub=500; 58 | dim=30; 59 | 60 | case 'F9' 61 | fobj = @F9; 62 | lb=-5.12; 63 | ub=5.12; 64 | dim=30; 65 | 66 | case 'F10' 67 | fobj = @F10; 68 | lb=-32; 69 | ub=32; 70 | % dim=30; 71 | dim=30; 72 | case 'F11' 73 | fobj = @F11; 74 | lb=-600; 75 | ub=600; 76 | dim=30; 77 | 78 | case 'F12' 79 | fobj = @F12; 80 | lb=-50; 81 | ub=50; 82 | dim=30; 83 | 84 | case 'F13' 85 | fobj = @F13; 86 | lb=-50; 87 | ub=50; 88 | dim=30; 89 | 90 | case 'F14' 91 | fobj = @F14; 92 | lb=-65.536; 93 | ub=65.536; 94 | dim=2; 95 | 96 | case 'F15' 97 | fobj = @F15; 98 | lb=-5; 99 | ub=5; 100 | dim=4; 101 | 102 | case 'F16' 103 | fobj = @F16; 104 | lb=-5; 105 | ub=5; 106 | dim=2; 107 | 108 | case 'F17' 109 | fobj = @F17; 110 | lb=[-5,0]; 111 | ub=[10,15]; 112 | dim=2; 113 | 114 | case 'F18' 115 | fobj = @F18; 116 | lb=-5; 117 | ub=5; 118 | dim=2; 119 | 120 | case 'F19' 121 | fobj = @F19; 122 | lb=0; 123 | ub=1; 124 | dim=3; 125 | 126 | case 'F20' 127 | fobj = @F20; 128 | lb=0; 129 | ub=1; 130 | dim=6; 131 | 132 | case 'F21' 133 | fobj = @F21; 134 | lb=0; 135 | ub=10; 136 | dim=4; 137 | % dim=4; 138 | case 'F22' 139 | fobj = @F22; 140 | lb=0; 141 | ub=10; 142 | dim=4; 143 | 144 | case 'F23' 145 | fobj = @F23; 146 | lb=0; 147 | ub=10; 148 | dim=4; 149 | end 150 | 151 | end 152 | 153 | % F1 154 | 155 | function o = F1(x) 156 | o=sum(x.^2); 157 | end 158 | 159 | % F2 160 | 161 | function o = F2(x) 162 | o=sum(abs(x))+prod(abs(x)); 163 | end 164 | 165 | % F3 166 | 167 | function o = F3(x) 168 | dim=size(x,2); 169 | o=0; 170 | for i=1:dim 171 | o=o+sum(x(1:i))^2; 172 | end 173 | end 174 | 175 | % F4 176 | 177 | function o = F4(x) 178 | o=max(abs(x)); 179 | end 180 | 181 | % F5 182 | 183 | function o = F5(x) 184 | dim=size(x,2); 185 | o=sum(100*(x(2:dim)-(x(1:dim-1).^2)).^2+(x(1:dim-1)-1).^2); 186 | end 187 | 188 | % F6 189 | 190 | function o = F6(x) 191 | o=sum(abs((x+.5)).^2); 192 | end 193 | 194 | % F7 195 | 196 | function o = F7(x) 197 | dim=size(x,2); 198 | o=sum([1:dim].*(x.^4))+rand; 199 | end 200 | 201 | % F8 202 | 203 | function o = F8(x) 204 | o=sum(-x.*sin(sqrt(abs(x)))); 205 | end 206 | 207 | % F9 208 | 209 | function o = F9(x) 210 | dim=size(x,2); 211 | o=sum(x.^2-10*cos(2*pi.*x))+10*dim; 212 | end 213 | 214 | % F10 215 | 216 | function o = F10(x) 217 | dim=size(x,2); 218 | o=-20*exp(-.2*sqrt(sum(x.^2)/dim))-exp(sum(cos(2*pi.*x))/dim)+20+exp(1); 219 | end 220 | 221 | % F11 222 | 223 | function o = F11(x) 224 | dim=size(x,2); 225 | o=sum(x.^2)/4000-prod(cos(x./sqrt([1:dim])))+1; 226 | end 227 | 228 | % F12 229 | 230 | function o = F12(x) 231 | dim=size(x,2); 232 | o=(pi/dim)*(10*((sin(pi*(1+(x(1)+1)/4)))^2)+sum((((x(1:dim-1)+1)./4).^2).*... 233 | (1+10.*((sin(pi.*(1+(x(2:dim)+1)./4)))).^2))+((x(dim)+1)/4)^2)+sum(Ufun(x,10,100,4)); 234 | end 235 | 236 | % F13 237 | 238 | function o = F13(x) 239 | dim=size(x,2); 240 | o=.1*((sin(3*pi*x(1)))^2+sum((x(1:dim-1)-1).^2.*(1+(sin(3.*pi.*x(2:dim))).^2))+... 241 | ((x(dim)-1)^2)*(1+(sin(2*pi*x(dim)))^2))+sum(Ufun(x,5,100,4)); 242 | end 243 | 244 | % F14 245 | 246 | function o = F14(x) 247 | aS=[-32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32;... 248 | -32 -32 -32 -32 -32 -16 -16 -16 -16 -16 0 0 0 0 0 16 16 16 16 16 32 32 32 32 32]; 249 | 250 | for j=1:25 251 | bS(j)=sum((x'-aS(:,j)).^6); 252 | end 253 | o=(1/500+sum(1./([1:25]+bS))).^(-1); 254 | end 255 | 256 | % F15 257 | 258 | function o = F15(x) 259 | aK=[.1957 .1947 .1735 .16 .0844 .0627 .0456 .0342 .0323 .0235 .0246]; 260 | bK=[.25 .5 1 2 4 6 8 10 12 14 16];bK=1./bK; 261 | o=sum((aK-((x(1).*(bK.^2+x(2).*bK))./(bK.^2+x(3).*bK+x(4)))).^2); 262 | end 263 | 264 | % F16 265 | 266 | function o = F16(x) 267 | o=4*(x(1)^2)-2.1*(x(1)^4)+(x(1)^6)/3+x(1)*x(2)-4*(x(2)^2)+4*(x(2)^4); 268 | end 269 | 270 | % F17 271 | 272 | function o = F17(x) 273 | o=(x(2)-(x(1)^2)*5.1/(4*(pi^2))+5/pi*x(1)-6)^2+10*(1-1/(8*pi))*cos(x(1))+10; 274 | end 275 | 276 | % F18 277 | 278 | function o = F18(x) 279 | o=(1+(x(1)+x(2)+1)^2*(19-14*x(1)+3*(x(1)^2)-14*x(2)+6*x(1)*x(2)+3*x(2)^2))*... 280 | (30+(2*x(1)-3*x(2))^2*(18-32*x(1)+12*(x(1)^2)+48*x(2)-36*x(1)*x(2)+27*(x(2)^2))); 281 | end 282 | 283 | % F19 284 | 285 | function o = F19(x) 286 | aH=[3 10 30;.1 10 35;3 10 30;.1 10 35];cH=[1 1.2 3 3.2]; 287 | pH=[.3689 .117 .2673;.4699 .4387 .747;.1091 .8732 .5547;.03815 .5743 .8828]; 288 | o=0; 289 | for i=1:4 290 | o=o-cH(i)*exp(-(sum(aH(i,:).*((x-pH(i,:)).^2)))); 291 | end 292 | end 293 | 294 | % F20 295 | 296 | function o = F20(x) 297 | aH=[10 3 17 3.5 1.7 8;.05 10 17 .1 8 14;3 3.5 1.7 10 17 8;17 8 .05 10 .1 14]; 298 | cH=[1 1.2 3 3.2]; 299 | pH=[.1312 .1696 .5569 .0124 .8283 .5886;.2329 .4135 .8307 .3736 .1004 .9991;... 300 | .2348 .1415 .3522 .2883 .3047 .6650;.4047 .8828 .8732 .5743 .1091 .0381]; 301 | o=0; 302 | for i=1:4 303 | o=o-cH(i)*exp(-(sum(aH(i,:).*((x-pH(i,:)).^2)))); 304 | end 305 | end 306 | 307 | % F21 308 | 309 | function o = F21(x) 310 | aSH=[4 4 4 4;1 1 1 1;8 8 8 8;6 6 6 6;3 7 3 7;2 9 2 9;5 5 3 3;8 1 8 1;6 2 6 2;7 3.6 7 3.6]; 311 | cSH=[.1 .2 .2 .4 .4 .6 .3 .7 .5 .5]; 312 | 313 | o=0; 314 | for i=1:5 315 | o=o-((x-aSH(i,:))*(x-aSH(i,:))'+cSH(i))^(-1); 316 | end 317 | end 318 | 319 | % F22 320 | 321 | function o = F22(x) 322 | aSH=[4 4 4 4;1 1 1 1;8 8 8 8;6 6 6 6;3 7 3 7;2 9 2 9;5 5 3 3;8 1 8 1;6 2 6 2;7 3.6 7 3.6]; 323 | cSH=[.1 .2 .2 .4 .4 .6 .3 .7 .5 .5]; 324 | 325 | o=0; 326 | for i=1:7 327 | o=o-((x-aSH(i,:))*(x-aSH(i,:))'+cSH(i))^(-1); 328 | end 329 | end 330 | 331 | % F23 332 | 333 | function o = F23(x) 334 | aSH=[4 4 4 4;1 1 1 1;8 8 8 8;6 6 6 6;3 7 3 7;2 9 2 9;5 5 3 3;8 1 8 1;6 2 6 2;7 3.6 7 3.6]; 335 | cSH=[.1 .2 .2 .4 .4 .6 .3 .7 .5 .5]; 336 | 337 | o=0; 338 | for i=1:10 339 | o=o-((x-aSH(i,:))*(x-aSH(i,:))'+cSH(i))^(-1); 340 | end 341 | end 342 | 343 | function o=Ufun(x,a,k,m) 344 | o=k.*((x-a).^m).*(x>a)+k.*((-x-a).^m).*(x<(-a)); 345 | end -------------------------------------------------------------------------------- /HHO brief.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliasgharheidaricom/Harris-Hawks-Optimization-Algorithm-and-Applications/e5d854f64e0af5207e33c25dc196629b00d00d25/HHO brief.pdf -------------------------------------------------------------------------------- /HHO.m: -------------------------------------------------------------------------------- 1 | % Developed in MATLAB R2013b 2 | % Source codes demo version 1.0 3 | % _____________________________________________________ 4 | 5 | % Main paper: 6 | % Harris hawks optimization: Algorithm and applications 7 | % Ali Asghar Heidari, Seyedali Mirjalili, Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, Huiling Chen 8 | % Future Generation Computer Systems, 9 | % DOI: https://doi.org/10.1016/j.future.2019.02.028 10 | % _____________________________________________________ 11 | 12 | % Author, inventor and programmer: Ali Asghar Heidari, 13 | % PhD research intern, Department of Computer Science, School of Computing, National University of Singapore, Singapore 14 | % Exceptionally Talented Ph. DC funded by Iran's National Elites Foundation (INEF), University of Tehran 15 | % 03-03-2019 16 | 17 | % Researchgate: https://www.researchgate.net/profile/Ali_Asghar_Heidari 18 | 19 | % e-Mail: as_heidari@ut.ac.ir, aliasghar68@gmail.com, 20 | % e-Mail (Singapore): aliasgha@comp.nus.edu.sg, t0917038@u.nus.edu 21 | % _____________________________________________________ 22 | 23 | % Co-authors: Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, and Hui-Ling Chen 24 | 25 | % Homepage: http://www.evo-ml.com/2019/03/02/hho/ 26 | % _____________________________________________________ 27 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 28 | 29 | % Harris's hawk optimizer: In this algorithm, Harris' hawks try to catch the rabbit. 30 | 31 | % T: maximum iterations, N: populatoin size, CNVG: Convergence curve 32 | % To run HHO: [Rabbit_Energy,Rabbit_Location,CNVG]=HHO(N,T,lb,ub,dim,fobj) 33 | 34 | function [Rabbit_Energy,Rabbit_Location,CNVG]=HHO(N,T,lb,ub,dim,fobj) 35 | 36 | disp('HHO is now tackling your problem') 37 | tic 38 | % initialize the location and Energy of the rabbit 39 | Rabbit_Location=zeros(1,dim); 40 | Rabbit_Energy=inf; 41 | 42 | %Initialize the locations of Harris' hawks 43 | X=initialization(N,dim,ub,lb); 44 | 45 | CNVG=zeros(1,T); 46 | 47 | t=0; % Loop counter 48 | 49 | while tub;FL=X(i,:)=1 69 | %% Exploration: 70 | % Harris' hawks perch randomly based on 2 strategy: 71 | 72 | q=rand(); 73 | rand_Hawk_index = floor(N*rand()+1); 74 | X_rand = X(rand_Hawk_index, :); 75 | if q<0.5 76 | % perch based on other family members 77 | X(i,:)=X_rand-rand()*abs(X_rand-2*rand()*X(i,:)); 78 | elseif q>=0.5 79 | % perch on a random tall tree (random site inside group's home range) 80 | X(i,:)=(Rabbit_Location(1,:)-mean(X))-rand()*((ub-lb)*rand+lb); 81 | end 82 | 83 | elseif abs(Escaping_Energy)<1 84 | %% Exploitation: 85 | % Attacking the rabbit using 4 strategies regarding the behavior of the rabbit 86 | 87 | %% phase 1: surprise pounce (seven kills) 88 | % surprise pounce (seven kills): multiple, short rapid dives by different hawks 89 | 90 | r=rand(); % probablity of each event 91 | 92 | if r>=0.5 && abs(Escaping_Energy)<0.5 % Hard besiege 93 | X(i,:)=(Rabbit_Location)-Escaping_Energy*abs(Rabbit_Location-X(i,:)); 94 | end 95 | 96 | if r>=0.5 && abs(Escaping_Energy)>=0.5 % Soft besiege 97 | Jump_strength=2*(1-rand()); % random jump strength of the rabbit 98 | X(i,:)=(Rabbit_Location-X(i,:))-Escaping_Energy*abs(Jump_strength*Rabbit_Location-X(i,:)); 99 | end 100 | 101 | %% phase 2: performing team rapid dives (leapfrog movements) 102 | if r<0.5 && abs(Escaping_Energy)>=0.5, % Soft besiege % rabbit try to escape by many zigzag deceptive motions 103 | 104 | Jump_strength=2*(1-rand()); 105 | X1=Rabbit_Location-Escaping_Energy*abs(Jump_strength*Rabbit_Location-X(i,:)); 106 | 107 | if fobj(X1) 18 | Harris Hawks Optimization 19 | 20 | 21 | ## 📚 **Abstract** 22 | In this paper, a novel population-based, nature-inspired optimization paradigm is proposed, which is called Harris Hawks Optimizer (HHO). The main inspiration of HHO is the cooperative behavior and chasing style of Harris’ hawks in nature called surprise pounce. In this intelligent strategy, several hawks cooperatively pounce a prey from different directions in an attempt to surprise it. Harris hawks can reveal a variety of chasing patterns based on the dynamic nature of scenarios and escaping patterns of the prey. This work mathematically mimics such dynamic patterns and behaviors to develop an optimization algorithm. The effectiveness of the proposed HHO optimizer is checked, through a comparison with other nature-inspired techniques, on 29 benchmark problems and several real-world engineering problems. The statistical results and comparisons show that the HHO algorithm provides very promising and occasionally competitive results compared to well-established metaheuristic techniques. 23 | 24 | 25 | 26 |

Key Features

27 |
    28 |
  • 🦅 Nature-Inspired: Mimics the cooperative hunting behavior of hawks.
  • 29 |
  • Efficient: Excellent at finding global optima in high-dimensional spaces.
  • 30 |
  • 💡 Versatile: Applicable to continuous, combinatorial, and multi-objective optimization.
  • 31 |
  • 🔄 Dynamic Exploration & Exploitation: Balances exploration and exploitation for robust performance.
  • 32 |
33 | 34 | --- 35 | 36 | ## 📊 **Algorithm Workflow** 37 | 38 | The algorithm operates in three distinct phases that simulate the hawk’s hunting strategy: 39 | 40 | | **Phase** | **Description** | **Purpose** | 41 | |--------------------|----------------------------------------------------------------------------------------------------|--------------------------------------------------| 42 | | 🦅 **Exploration** | Hawks search broadly across the space. | Discover new regions of the solution space. | 43 | | 🔄 **Transition** | Hawks adjust between exploration and exploitation based on prey's energy (problem difficulty). | Dynamically balance exploration and exploitation. | 44 | | 💡 **Exploitation** | Hawks refine solutions near the best-known position. | Converge towards the optimal solution. | 45 | 46 | --- 47 | 48 | ## 📝 **Algorithm Steps** 49 | 50 | 1. **Initialization**: Randomly initialize hawks (candidate solutions) across the search space. 51 | 2. **Fitness Evaluation**: Evaluate each hawk’s fitness based on a domain-specific function. 52 | 3. **Best Solution Tracking**: Track the "rabbit" (best solution) found so far. 53 | 4. **Exploration vs Exploitation**: Hawks decide whether to explore or exploit based on prey’s energy. 54 | 5. **Dynamic Position Updates**: Hawks update their positions using encircling, sudden dives, or random jumps. 55 | 6. **Stopping Criterion**: Continue until a stopping condition is met (e.g., max iterations, target fitness). 56 | 7. **Output**: Return the best solution found as the final result. 57 | 58 | --- 59 | 60 | ## 🦅 **Phase Breakdown** 61 | 62 | ### 🔍 **Exploration Phase** 63 | 64 | - **Objective**: Explore the search space broadly to find promising regions. 65 | - **Mechanism**: Hawks move randomly across the search space, promoting diversity and preventing early convergence. 66 | 67 | **Key Strategies**: 68 | - Random movement across unexplored regions. 69 | - Ensures diverse candidate solutions. 70 | 71 | --- 72 | 73 | ### 🔄 **Transition Phase** 74 | 75 | - **Objective**: Adapt hawk behavior based on the problem’s difficulty. 76 | - **Mechanism**: Hawks assess the energy state of the prey and switch between exploration and exploitation. 77 | 78 | **Key Strategies**: 79 | - Dynamic switching between global search and local refinement. 80 | - Balances the two strategies for optimal performance. 81 | 82 | --- 83 | 84 | ### 💡 **Exploitation Phase** 85 | 86 | - **Objective**: Refine solutions near the best-known solution. 87 | - **Mechanism**: Hawks focus their search near the best solution using various fine-tuning techniques. 88 | 89 | **Key Strategies**: 90 | 1. **Gradual Encircling**: Hawks gradually close in on the prey (optimal solution). 91 | 2. **Sudden Dives**: Hawks make abrupt moves to test nearby solutions. 92 | 3. **Direct Attack**: Hawks converge aggressively if prey is weak (suboptimal solution). 93 | 94 | --- 95 | 96 | ## Pseudo-Code 97 | 98 | Below is a pseudo-code representation of the HHO algorithm for better understanding: 99 | 100 | ```plaintext 101 | 1. Initialize hawk positions randomly in the search space. 102 | 2. Evaluate the fitness of each hawk. 103 | 3. Identify the best solution (rabbit). 104 | 4. Repeat until stopping criterion is met: 105 | a. Update the energy of the prey. 106 | b. Adjust hawk positions based on exploration or exploitation: 107 | i. Random jumps for exploration. 108 | ii. Gradual encircling or dives for exploitation. 109 | c. Evaluate fitness and update the best solution if needed. 110 | 5. Return the best solution found. 111 | ``` 112 | ### 🖋️ **Author, Inventor, and Programmer** 113 | 114 | **Ali Asghar Heidari** 115 | PhD Research Intern, Department of Computer Science, School of Computing, National University of Singapore, Singapore 116 | Exceptionally Talented Ph.D. funded by Iran's National Elites Foundation (INEF), University of Tehran 117 | 118 | 119 | **Email**: 120 | - aliasghar68@gmail.com 121 | - as_heidari@ut.ac.ir 122 | 123 | ### 📄 **How to Cite** 124 | 125 | If you use this algorithm in your research, please cite our paper as follows: 126 | 127 | ```bibtex 128 | @article{Heidari2019HHO, 129 | title={Harris hawks optimization: Algorithm and applications}, 130 | author={Ali Asghar Heidari and Seyedali Mirjalili and Hossam Faris and Ibrahim Aljarah and Majdi Mafarja and Huiling Chen}, 131 | journal={Future Generation Computer Systems}, 132 | volume={97}, 133 | pages={849--872}, 134 | year={2019}, 135 | publisher={Elsevier}, 136 | doi={10.1016/j.future.2019.02.028}, 137 | } 138 | ``` 139 | ### 📬 **Contact Information** 140 | 141 | For further inquiries or collaborations, feel free to reach out to the author or contributors via their emails listed above. You can also follow Ali Asghar Heidari’s work on his [ResearchGate](https://www.researchgate.net/profile/Ali_Asghar_Heidari) page. 142 | 143 | -------------------------------------------------------------------------------- /initialization.m: -------------------------------------------------------------------------------- 1 | % Main paper: 2 | % Harris hawks optimization: Algorithm and applications 3 | % Ali Asghar Heidari, Seyedali Mirjalili, Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, Huiling Chen 4 | % Future Generation Computer Systems, 5 | % DOI: https://doi.org/10.1016/j.future.2019.02.028 6 | % _____________________________________________________ 7 | 8 | function [X]=initialization(N,dim,up,down) 9 | 10 | if size(up,1)==1 11 | X=rand(N,dim).*(up-down)+down; 12 | end 13 | if size(up,1)>1 14 | for i=1:dim 15 | high=up(i);low=down(i); 16 | X(:,i)=rand(1,N).*(high-low)+low; 17 | end 18 | end 19 | end -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | % Developed in MATLAB R2013b 2 | % Source codes demo version 1.0 3 | % _____________________________________________________ 4 | 5 | % Author, inventor and programmer: Ali Asghar Heidari, 6 | % PhD research intern, Department of Computer Science, School of Computing, National University of Singapore, Singapore 7 | % Exceptionally Talented Ph. DC funded by Iran's National Elites Foundation (INEF), University of Tehran 8 | % 03-03-2019 9 | 10 | % Researchgate: https://www.researchgate.net/profile/Ali_Asghar_Heidari 11 | 12 | % e-Mail: as_heidari@ut.ac.ir, aliasghar68@gmail.com, 13 | % e-Mail (Singapore): aliasgha@comp.nus.edu.sg, t0917038@u.nus.edu 14 | % _____________________________________________________ 15 | 16 | % Co-authors: Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, and Hui-Ling Chen 17 | 18 | % Homepage: http://www.evo-ml.com/2019/03/02/hho/ 19 | % _____________________________________________________ 20 | 21 | % Please refer to the main paper: 22 | % Ali Asghar Heidari, Seyedali Mirjalili, Hossam Faris, Ibrahim Aljarah, Majdi Mafarja, Huiling Chen 23 | % Harris hawks optimization: Algorithm and applications 24 | % Future Generation Computer Systems, DOI: https://doi.org/10.1016/j.future.2019.02.028 25 | % _____________________________________________________ 26 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 27 | 28 | clear all %#ok 29 | close all 30 | clc 31 | 32 | N=30; % Number of search agents 33 | 34 | Function_name='F1'; % Name of the test function 35 | 36 | T=500; % Maximum number of iterations 37 | 38 | % Load details of the selected benchmark function 39 | [lb,ub,dim,fobj]=Get_Functions_details(Function_name); 40 | 41 | [Rabbit_Energy,Rabbit_Location,CNVG]=HHO(N,T,lb,ub,dim,fobj); 42 | 43 | 44 | %Draw objective space 45 | figure, 46 | hold on 47 | semilogy(CNVG,'Color','b','LineWidth',4); 48 | title('Convergence curve') 49 | xlabel('Iteration'); 50 | ylabel('Best fitness obtained so far'); 51 | axis tight 52 | grid off 53 | box on 54 | legend('HHO') 55 | 56 | display(['The best location of HHO is: ', num2str(Rabbit_Location)]); 57 | display(['The best fitness of HHO is: ', num2str(Rabbit_Energy)]); 58 | 59 | 60 | 61 | 62 | 63 | --------------------------------------------------------------------------------