Exclusive and original! The sparrow optimization algorithm that combines northern goshawk and adaptive t distribution has excellent results! Highly recommended product! MATLAB code…

Statement: Resale and reselling of the author’s original code is prohibited, and violators will be prosecuted!

The sparrow search algorithm (SSA) was proposed in 2020 and has been widely used in many fields. The design of the Sparrow algorithm is inspired by the biological characteristics of birds. The mathematical model established based on the foraging behavior of sparrows can be classified as a finder-follower model, with an additional early warning mechanism. The SSA algorithm has attracted many researchers because of its ease of implementation and fast speed. However, the SSA algorithm still has problems such as difficulty in finding the optimal solution, the search relies on elite populations, and it is easy to fall into local optima due to its own characteristics.

First of all, a statement: The algorithm of this issue was improved by the author himself. The content and innovation are enough to support the writing of a paper! And the first publishing channel is the WeChat official account. The author has not published on any other platform before! In other words, this is first-hand information! Download it quickly if you need it! The method of obtaining the code is at the end of the article.

\ < /strong>

The new algorithm introduced in this issue is: Sparrow optimization algorithm integrating northern goshawk and adaptive t distribution (NTSSA). This abbreviation is just a temporary one made by the author to distinguish the original Sparrow algorithm. You can refer to it Modify this abbreviation to your own ideas.

The fusion of the Northern Goshawk algorithm was achieved by the author after careful consideration of the original Sparrow algorithm, multiple debuggings, and continuous research for a long time. It is not easy to organize the code, but it needs to be used and cherished. Without further ado, let’s talk about improvement strategies.

Detailed explanation of improvement strategies

Improvement point 1: Integrate northern goshawk exploration phase location strategy

In order to improve the adequacy of the finder model in the solution space search and the solving performance in the optimization problem, the position update formula of R2

The reason for this is that the initial phase of each iteration typically sees a single discoverer quickly converge on the global optimal solution, thereby gaining powerful development capabilities. However, obtaining the global optimal solution in this way often ignores the exploration of the nearby search space, resulting in a serious shortage of exploration space in the global development stage and tending to fall into the local optimal solution. Since the northern goshawk’s update strategy selects prey randomly in the search space, adopting this strategy can increase the exploration capability of the SSA algorithm.

The position update formula for the northern goshawk exploration phase is:

1e2c2cc0381a96db28aa02585c642bfc.png

1fe9b623f925f0ea79710d6ebe221e98.png

Improvement point 2: Adaptive t-distribution mutation strategy

Regarding the adaptive t distribution strategy, it has also been mentioned in previous articles. This strategy can greatly improve the convergence speed of the algorithm.

In the follower stage of the Sparrow algorithm, t-distribution disturbance mutation is performed with a certain probability, which not only does not change the original update principle formula of the Sparrow algorithm, but also enables the Sparrow algorithm to have better global development capabilities in the early iteration stage and good local development capabilities in the later iteration stage. Exploration capabilities, thereby accelerating the convergence speed of the Sparrow algorithm.

The specific location update method is as follows:

1877ddc629203763a476c0c22ed45b77.png

Among them, t(C_iter) has been modified.

Improvement point 3: AddBernoulliChaos mapping to increase sparrow diversity

Adding Bernoulli chaos mapping is mainly to increase the diversity of Sparrow initialization. Friends who want to replace it with other chaotic mappings can refer to this article: 10 Chaos Mapping Optimized Gray Wolf Algorithms, which can be switched with one click.

Bernoulli chaos map, the formula is as follows:

d6227126a3219aa54a664b96b06bb49b.png

The following two figures will appear when you run plotchaos.m.

6b8412a77fbcf1f969f2ef1d3dbc871f.png

8ddfe35ffaaf6afada83b02fda5e8bbc.png

Each of these three strategies has its own uses! And each strategy is complementary to each other, and one is indispensable!

Highlights of improvements

The program can be run with one click and automatically generate statistical tables.

Each algorithm is run 30 times. An excel table can be automatically generated in the current directory. In addition to statistics on the average value, best value, standard deviation, worst value, and median value of each algorithm, there is also another table. Specially statistics the results of rank sum test.

②The complexity of the improved algorithm remains unchanged

The algorithm introduced in this issue does not call the fitness function multiple times in the loop, and does not add so-called greedy strategies, reverse learning and other means to increase complexity.

③Comparative experiments with various intelligent algorithms

In this issue, the algorithm was compared with four more efficient or popular intelligent algorithms. Including: Original Sparrow Algorithm (SSA), Dung Beetle Algorithm (DBO), Gray Wolf Optimization Algorithm (GWO), and Northern Goshawk Optimization Algorithm (NGO).

Result display

Tested in CEC2005: Each algorithm is run 500 times, and the population is set to 30.

1d12c73074dadf8a4867a442c3c4fb48.png

95134e0a93ad1d4130532afa83e95732.png

d269a6ca6b3787f8b87a46f6a21c061e.png

e041bb551a65a2efc479ab63f7695f2c.png

596bf9bc15631dab09bb464bdf83bba0.png

cd0c79c767980a652bb10fed058e9f3b.png

d41784f83087740001eb50929948db9f.png

868b7928b55206d19e34f26d6b6ca9d7.png

Here are some screenshots, and you can see that the test results of the CEC2005 function are very good.

Each algorithm is iterated 500 times, the number of populations is set to 30, and each function is run 30 times. Five indicators, including optimal value, standard deviation, average value, worst value, and median, are found as follows. Rank sum test As a result, the box plot, etc. are shown below.

F1 function calculation results:
NTSSA: Optimal value: 0 Standard deviation: 0 Mean value: 2.4487e-264 Median value: 6.0217e-297 Worst value: 7.346e-263
DBO: Optimal value: 4.7633e-166 Standard deviation: 3.1542e-97 Mean value: 5.7588e-98 Median value: 6.9473e-135 Worst value: 1.7276e-96
NGO: Best value: 5.738e-90 Standard deviation: 4.1173e-87 Mean value: 1.8453e-87 Median value: 4.3969e-88 Worst value: 2.1893e-86
SSA: Best value: 0 Standard deviation: 1.0921e-54 Mean value: 1.9951e-55 Median value: 3.371e-81 Worst value: 5.9819e-54
GWO: Optimal value: 2.9248e-29 Standard deviation: 8.1727e-28 Mean value: 7.8522e-28 Median value: 5.5404e-28 Worst value: 3.2544e-27
F2 function calculation results:
NTSSA: Optimal value: 2.218e-172 Standard deviation: 1.3489e-135 Mean value: 2.4887e-136 Median value: 1.3881e-150 Worst value: 7.3908e-135
DBO: Optimal value: 1.5703e-81 Standard deviation: 1.5102e-53 Mean value: 2.7573e-54 Median value: 1.2293e-70 Worst value: 8.272e-53
NGO: Best value: 7.021e-47 Standard deviation: 2.0815e-45 Mean value: 1.4974e-45 Median value: 6.3103e-46 Worst value: 8.5487e-45
SSA: Optimal value: 0 Standard deviation: 2.1123e-27 Mean value: 3.9018e-28 Median value: 6.8423e-37 Worst value: 1.1573e-26
GWO: Optimal value: 2.1974e-17 Standard deviation: 5.8398e-17 Mean value: 7.7607e-17 Median value: 5.1817e-17 Worst value: 2.5636e-16
F3 function calculation results:
NTSSA: Best value: 6.6952e-299 Standard deviation: 0 Mean: 1.2167e-225 Median value: 8.0736e-262 Worst value: 3.5719e-224
DBO: Optimal value: 5.1011e-146 Standard deviation: 2.4802e-49 Mean value: 4.5282e-50 Median value: 3.0561e-112 Worst value: 1.3585e-48
NGO: Optimal value: 7.3707e-31 Standard deviation: 6.6499e-21 Mean value: 1.3306e-21 Median value: 8.8755e-24 Worst value: 3.6519e-20
SSA: Best value: 2.3399e-93 Standard deviation: 1.4579e-23 Mean value: 2.6618e-24 Median value: 4.756e-36 Worst value: 7.9853e-23
GWO: Optimal value: 4.104e-08 Standard deviation: 4.4844e-05 Mean value: 1.4637e-05 Median value: 1.012e-06 Worst value: 0.00024052
F4 function calculation results:
NTSSA: Best value: 8.6675e-162 Standard deviation: 1.7667e-113 Mean value: 3.2255e-114 Median value: 2.8467e-142 Worst value: 9.6764e-113
DBO: Optimal value: 1.3239e-82 Standard deviation: 9.0445e-50 Mean value: 1.6774e-50 Median value: 1.4166e-67 Worst value: 4.9559e-49
NGO: Optimal value: 1.4133e-38 Standard deviation: 1.9392e-37 Mean value: 1.8641e-37 Median value: 1.3118e-37 Worst value: 8.6041e-37
SSA: Best value: 1.0861e-114 Standard deviation: 3.2725e-27 Mean value: 5.9844e-28 Median value: 6.3272e-44 Worst value: 1.7925e-26
GWO: Optimal value: 1.7578e-07 Standard deviation: 2.4345e-06 Mean value: 9.9418e-07 Median value: 4.1139e-07 Worst value: 1.3664e-05
F5 function calculation result:
NTSSA: Optimal value: 1.5737e-19 Standard deviation: 1.1117e-06 Mean value: 5.0902e-07 Median value: 7.9894e-11 Worst value: 4.317e-06
DBO: Optimal value: 25.1597 Standard deviation: 0.24236 Mean value: 25.769 Median value: 25.7883 Worst value: 26.2928
NGO: Optimal value: 25.0399 Standard deviation: 0.38697 Mean value: 25.8058 Median value: 25.8261 Worst value: 26.7666
SSA: Best value: 2.1946e-09 Standard deviation: 0.00011449 Mean value: 3.6999e-05 Median value: 9.6678e-07 Worst value: 0.00059907
GWO: Optimal value: 25.9708 Standard deviation: 0.71277 Mean value: 27.0682 Median value: 27.0909 Worst value: 28.5502
F6 function calculation results:
NTSSA: Best value: 2.3842e-24 Standard deviation: 3.8056e-13 Mean value: 7.0955e-14 Median value: 4.4563e-19 Worst value: 2.0857e-12
DBO: Optimal value: 5.9127e-06 Standard deviation: 0.041085 Mean value: 0.0078301 Median value: 0.00014741 Worst value: 0.22535
NGO: Best value: 9.2805e-07 Standard deviation: 0.00049172 Mean value: 0.00027211 Median value: 1.6357e-05 Worst value: 0.0018643
SSA: Optimal value: 2.2624e-16 Standard deviation: 1.9703e-11 Mean value: 8.3951e-12 Median value: 1.3183e-12 Worst value: 1.0598e-10
GWO: Optimal value: 0.24885 Standard deviation: 0.29782 Mean value: 0.78479 Median value: 0.75158 Worst value: 1.5066
F7 function calculation results:
NTSSA: Best value: 9.1441e-05 Standard deviation: 0.00064115 Mean value: 0.00072213 Median value: 0.00047314 Worst value: 0.0024197
DBO: Optimal value: 9.4393e-05 Standard deviation: 0.00091153 Mean value: 0.0011641 Median value: 0.001081 Worst value: 0.0045568
NGO: Optimal value: 0.00012218 Standard deviation: 0.00035454 Mean value: 0.00069541 Median value: 0.00058364 Worst value: 0.001531
SSA: Optimal value: 3.218e-05 Standard deviation: 0.0010267 Mean value: 0.0017187 Median value: 0.0016299 Worst value: 0.0043961
GWO: Optimal value: 0.00058692 Standard deviation: 0.00097913 Mean value: 0.0020562 Median value: 0.0020771 Worst value: 0.0047868
F8 function calculation results:
NTSSA: Optimal value: -12569.4866 Standard deviation: 1678.515 Mean value: -10451.1684 Median value: -9819.5086 Worst value: -8208.4829
DBO: Optimal value: -12222.1301 Standard deviation: 1972.8794 Mean value: -8315.7348 Median value: -7494.4121 Worst value: -6071.1764
NGO: Optimal value: -8194.1607 Standard deviation: 474.0859 Mean value: -7437.0833 Median value: -7534.9128 Worst value: -6427.7209
SSA: Optimal value: -9760.3177 Standard deviation: 600.3155 Mean value: -8598.3574 Median value: -8622.1659 Worst value: -7266.9474
GWO: Optimal value: -7320.4867 Standard deviation: 600.1397 Mean value: -6087.7259 Median value: -6162.8539 Worst value: -5100.9283
F9 function calculation results:
NTSSA: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
DBO: Optimal value: 0 Standard deviation: 0.72662 Mean value: 0.13266 Median value: 0 Worst value: 3.9798
NGO: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
SSA: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
GWO: Optimal value: 0 Standard deviation: 3.2819 Mean value: 2.0311 Median value: 2.558e-13 Worst value: 9.6945
F10 function calculation results:
NTSSA: Best value: 4.4409e-16 Standard deviation: 0 Mean: 4.4409e-16 Median value: 4.4409e-16 Worst value: 4.4409e-16
DBO: Optimal value: 4.4409e-16 Standard deviation: 0 Mean: 4.4409e-16 Median value: 4.4409e-16 Worst value: 4.4409e-16
NGO: Optimal value: 3.9968e-15 Standard deviation: 1.7702e-15 Mean value: 5.4179e-15 Median value: 3.9968e-15 Worst value: 7.5495e-15
SSA: Best value: 4.4409e-16 Standard deviation: 0 Mean: 4.4409e-16 Median value: 4.4409e-16 Worst value: 4.4409e-16
GWO: Optimal value: 7.5051e-14 Standard deviation: 1.5404e-14 Mean value: 1.0134e-13 Median value: 9.992e-14 Worst value: 1.3545e-13
F11 function calculation results:
NTSSA: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
DBO: Optimal value: 0 Standard deviation: 0.003148 Mean value: 0.00057475 Median value: 0 Worst value: 0.017242
NGO: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
SSA: Optimal value: 0 Standard deviation: 0 Mean value: 0 Median value: 0 Worst value: 0
GWO: Optimal value: 0 Standard deviation: 0.0034541 Mean value: 0.00090182 Median value: 0 Worst value: 0.015013
F12 function calculation results:
NTSSA: Best value: 1.8932e-32 Standard deviation: 1.269e-16 Mean value: 2.3613e-17 Median value: 2.1048e-22 Worst value: 6.9541e-16
DBO: Optimal value: 1.5266e-07 Standard deviation: 0.0015418 Mean value: 0.00034054 Median value: 2.9786e-06 Worst value: 0.0084239
NGO: Best value: 1.9257e-07 Standard deviation: 0.001198 Mean value: 0.00024015 Median value: 2.4687e-06 Worst value: 0.0065767
SSA: Best value: 2.3003e-16 Standard deviation: 4.2474e-11 Mean value: 8.6696e-12 Median value: 3.461e-13 Worst value: 2.3343e-10
GWO: Optimal value: 0.019073 Standard deviation: 0.021546 Mean value: 0.04447 Median value: 0.040303 Worst value: 0.10467
F13 function calculation results:
NTSSA: Best value: 1.1546e-29 Standard deviation: 1.274e-14 Mean value: 2.3842e-15 Median value: 1.1823e-21 Worst value: 6.9829e-14
DBO: Optimal value: 5.5406e-05 Standard deviation: 0.47286 Mean value: 0.55624 Median value: 0.37375 Worst value: 1.5904
NGO: Optimal value: 0.0094832 Standard deviation: 0.17502 Mean value: 0.24457 Median value: 0.19172 Worst value: 0.64407
SSA: Best value: 3.8888e-15 Standard deviation: 1.1059e-10 Mean value: 3.8039e-11 Median value: 2.5836e-12 Worst value: 5.7651e-10
GWO: Optimal value: 0.18385 Standard deviation: 0.27035 Mean value: 0.57197 Median value: 0.53991 Worst value: 1.0552
F14 function calculation results:
NTSSA: Optimal value: 0.998 Standard deviation: 0.60541 Mean value: 1.1964 Median value: 0.998 Worst value: 2.9821
DBO: Optimal value: 0.998 Standard deviation: 1.8098 Mean value: 1.4559 Median value: 0.998 Worst value: 10.7632
NGO: Optimal value: 0.998 Standard deviation: 0 Mean: 0.998 Median value: 0.998 Worst value: 0.998
SSA: Optimal value: 0.998 Standard deviation: 4.7056 Mean value: 3.859 Median value: 0.998 Worst value: 12.6705
GWO: Optimal value: 0.998 Standard deviation: 3.8605 Mean value: 4.365 Median value: 2.9821 Worst value: 12.6705
F15 function calculation results:
NTSSA: Best value: 0.00030749 Standard deviation: 0.00019233 Mean value: 0.00040628 Median value: 0.00030749 Worst value: 0.0012232
DBO: Optimal value: 0.00030749 Standard deviation: 0.00040232 Mean value: 0.00077246 Median value: 0.00073137 Worst value: 0.0022368
NGO: Optimal value: 0.00030749 Standard deviation: 6.0974e-06 Mean value: 0.00030875 Median value: 0.00030749 Worst value: 0.00034097
SSA: Best value: 0.00030749 Standard deviation: 3.4e-08 Mean value: 0.00030749 Median value: 0.00030749 Worst value: 0.00030767
GWO: Optimal value: 0.00030751 Standard deviation: 0.0095675 Mean value: 0.0070606 Median value: 0.00044344 Worst value: 0.020363
F16 function calculation results:
NTSSA: Optimal value: -1.0316 Standard deviation: 5.0499e-16 Mean value: -1.0316 Median value: -1.0316 Worst value: -1.0316
DBO: Optimal value: -1.0316 Standard deviation: 6.2532e-16 Mean value: -1.0316 Median value: -1.0316 Worst value: -1.0316
NGO: Optimal value: -1.0316 Standard deviation: 6.4539e-16 Mean value: -1.0316 Median value: -1.0316 Worst value: -1.0316
SSA: Optimal value: -1.0316 Standard deviation: 5.0499e-16 Mean value: -1.0316 Median value: -1.0316 Worst value: -1.0316
GWO: Optimal value: -1.0316 Standard deviation: 1.889e-08 Mean value: -1.0316 Median value: -1.0316 Worst value: -1.0316
F17 function calculation results:
NTSSA: Optimal value: 0.39789 Standard deviation: 0 Mean: 0.39789 Median value: 0.39789 Worst value: 0.39789
DBO: Optimal value: 0.39789 Standard deviation: 0 Mean: 0.39789 Median value: 0.39789 Worst value: 0.39789
NGO: Optimal value: 0.39789 Standard deviation: 0 Mean value: 0.39789 Median value: 0.39789 Worst value: 0.39789
SSA: Best value: 0.39789 Standard deviation: 0 Mean: 0.39789 Median value: 0.39789 Worst value: 0.39789
GWO: Optimal value: 0.39789 Standard deviation: 5.0589e-06 Mean value: 0.39789 Median value: 0.39789 Worst value: 0.3979
F18 function calculation results:
NTSSA: Optimal value: 3 Standard deviation: 8.2385 Mean value: 5.7 Median value: 3 Worst value: 30
DBO: Optimal value: 3 Standard deviation: 3.2246e-15 Mean value: 3 Median value: 3 Worst value: 3
NGO: Optimal value: 3 Standard deviation: 1.01e-15 Mean value: 3 Median value: 3 Worst value: 3
SSA: Optimal value: 3 Standard deviation: 4.9295 Mean value: 3.9 Median value: 3 Worst value: 30
GWO: Optimal value: 3 Standard deviation: 14.7885 Mean value: 5.7 Median value: 3 Worst value: 84.0001
F19 function calculation results:
NTSSA: Optimal value: -3.8628 Standard deviation: 2.2554e-15 Mean value: -3.8628 Median value: -3.8628 Worst value: -3.8628
DBO: Optimal value: -3.8628 Standard deviation: 0.0029875 Mean value: -3.8615 Median value: -3.8628 Worst value: -3.8549
NGO: Optimal value: -3.8628 Standard deviation: 2.6823e-15 Mean value: -3.8628 Median value: -3.8628 Worst value: -3.8628
SSA: Optimal value: -3.8628 Standard deviation: 2.2704e-15 Mean value: -3.8628 Median value: -3.8628 Worst value: -3.8628
GWO: Optimal value: -3.8628 Standard deviation: 0.0028267 Mean value: -3.8612 Median value: -3.8627 Worst value: -3.8549
F20 function calculation results:
NTSSA: Optimal value: -3.322 Standard deviation: 0.051146 Mean value: -3.2943 Median value: -3.322 Worst value: -3.2031
DBO: Optimal value: -3.322 Standard deviation: 0.14086 Mean value: -3.2255 Median value: -3.2625 Worst value: -2.6381
NGO: Optimal value: -3.322 Standard deviation: 9.4743e-11 Mean value: -3.322 Median value: -3.322 Worst value: -3.322
SSA: Optimal value: -3.322 Standard deviation: 0.060328 Mean value: -3.2665 Median value: -3.322 Worst value: -3.2031
GWO: Optimal value: -3.322 Standard deviation: 0.076006 Mean value: -3.2587 Median value: -3.322 Worst value: -3.1333
F21 function calculation results:
NTSSA: Optimal value: -10.1532 Standard deviation: 5.4999e-15 Mean value: -10.1532 Median value: -10.1532 Worst value: -10.1532
DBO: Optimal value: -10.1532 Standard deviation: 2.5512 Mean value: -7.2766 Median value: -5.1008 Worst value: -5.0552
NGO: Optimal value: -10.1532 Standard deviation: 6.113e-06 Mean value: -10.1532 Median value: -10.1532 Worst value: -10.1532
SSA: Optimal value: -10.1532 Standard deviation: 2.1907 Mean value: -8.9591 Median value: -10.1532 Worst value: -5.0552
GWO: Optimal value: -10.1531 Standard deviation: 2.179 Mean value: -8.9695 Median value: -10.1511 Worst value: -5.0552
F22 function calculation results:
NTSSA: Optimal value: -10.4029 Standard deviation: 8.0799e-16 Mean value: -10.4029 Median value: -10.4029 Worst value: -10.4029
DBO: Optimal value: -10.4029 Standard deviation: 2.7911 Mean value: -8.027 Median value: -10.3948 Worst value: -2.7659
NGO: Optimal value: -10.4029 Standard deviation: 7.413e-09 Mean value: -10.4029 Median value: -10.4029 Worst value: -10.4029
SSA: Optimal value: -10.4029 Standard deviation: 2.2865 Mean value: -9.1627 Median value: -10.4029 Worst value: -5.0877
GWO: Optimal value: -10.4027 Standard deviation: 1.8889 Mean value: -9.793 Median value: -10.4008 Worst value: -2.7515
F23 function calculation results:
NTSSA: Optimal value: -10.5364 Standard deviation: 1.616e-15 Mean value: -10.5364 Median value: -10.5364 Worst value: -10.5364
DBO: Optimal value: -10.5364 Standard deviation: 2.8156 Mean value: -8.7632 Median value: -10.5364 Worst value: -1.8595
NGO: Optimal value: -10.5364 Standard deviation: 1.6201e-06 Mean value: -10.5364 Median value: -10.5364 Worst value: -10.5364
SSA: Optimal value: -10.5364 Standard deviation: 2.3264 Mean value: -9.2746 Median value: -10.5364 Worst value: -5.1285
GWO: Optimal value: -10.5362 Standard deviation: 1.7469 Mean value: -10.0856 Median value: -10.5349 Worst value: -2.4216

Five indicators can be converted into EXCEL tables with one click:

16d20def62dfb536a9579effda9e79df.png

Rank sum test results:

a04483d55eb7c1ad58dd9567a130afaf.png

Boxplot:

1e389ea6c5b7830311395878e6b4a838.png

It includes a drawing program (plotCEC2005_Main.m), a statistical indicator one-click program for generating excel and box plots (runsCEC2005_Main.m), and a program for drawing chaos maps (plotchaos.m).

After running, a table will be generated directly, in which result.xls is the optimal value, standard deviation, average, worst value, and median indicator statistical results, ranksumresult.xls strong> is the rank sum test result.

Part of the code display:

%%
clear
clc
close all
addpath(genpath(pwd));
number='F12'; %Select the optimization function and replace it yourself: F1~F23
[lower_bound,upper_bound,variables_no,fobj]=CEC2005(number); % [lb,ub,D,y]: lower bound, upper bound, dimension, objective function expression
pop_size=30; % population members
max_iter=1000; % maximum number of iteration
%%NTSSA
[NTSSA_Best_score,Best_pos,NTSSA_curve]=NTSSA(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj); % Calculating the solution of the given problem using NTSSA
display(['The best optimal value of the objective funciton found by NTSSA for ' [num2str(number)],' is : ', num2str(NTSSA_Best_score)]);
%%DBO
[DBO_Best_score,Best_pos,DBO_curve]=DBO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj); % Calculating the solution of the given problem using DBO
display(['The best optimal value of the objective funciton found by DBO for ' [num2str(number)],' is : ', num2str(DBO_Best_score)]);
%%NGO
[NGO_Best_score,~,NGO_curve]=NGO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by NGO for ' [num2str(number)],' is : ', num2str(NGO_Best_score)]);
%% SSA
[SSA_Best_score,~,SSA_curve]=SSA(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by SSA for ' [num2str(number)],' is : ', num2str(SSA_Best_score)]);
%% GWO
[GWO_Best_score,~,GWO_curve]=GWO(pop_size,max_iter,lower_bound,upper_bound,variables_no,fobj);
display(['The best optimal value of the objective funciton found by GWO for ' [num2str(number)],' is : ', num2str(GWO_Best_score)]);
%% Figure
figure1 = figure('Color',[1 1 1]);
G1=subplot(1,2,1,'Parent',figure1);
func_plot(number)
title(number)
xlabel('x')
ylabel('y')
zlabel('z')
subplot(1,2,2)
G2=subplot(1,2,2,'Parent',figure1);
CNT=20;
k=round(linspace(1,max_iter,CNT)); %randomly select CNT points
% Note: If there are very few points drawn on the convergence curve and the random points are very sparse, it means that there are fewer points. At this time, the number of points should be increased, 100, 200, 300, etc., gradually increase
% On the contrary, if the random points on the convergence curve are very dense, it means that too many points are taken. In this case, the number of points should be reduced.
iter=1:1:max_iter;
if ~strcmp(number,'F16') & amp; & amp;~strcmp(number,'F9') & amp; & amp;~strcmp(number,'F11') %This is because These functions converge too quickly and are not suitable for semilogy. Plot them directly.
    semilogy(iter(k),DBO_curve(k),'k-o','linewidth',1);
    hold on
    semilogy(iter(k),NGO_curve(k),'b-^','linewidth',1);
    hold on
    semilogy(iter(k),GWO_curve(k),'m-*','linewidth',1);
    hold on
    semilogy(iter(k),SSA_curve(k),'y-p','linewidth',1);
    hold on
    semilogy(iter(k),NTSSA_curve(k),'g-x','linewidth',1);
else
    plot(iter(k),DBO_curve(k),'k-o','linewidth',1);
    hold on
    plot(iter(k),NGO_curve(k),'b-^','linewidth',1);
    hold on
    plot(iter(k),GWO_curve(k),'m-*','linewidth',1);
    hold on
    plot(iter(k),SSA_curve(k),'y-p','linewidth',1);
    hold on
    plot(iter(k),NTSSA_curve(k),'g-x','linewidth',1);
end
grid on;
title('Convergence Curve')
xlabel('Number of iterations');
ylabel('Fitness value');
box on
legend('DBO','NGO','GWO','SSA','NTSSA')
set (gcf,'position', [300,300,800,330])
rmpath(genpath(pwd))

code acquisition

How to obtain the complete code: Reply keywords in the background, case-insensitive. Keywords:

NTSSA

Or click the jump link below to read the original text,

Or copy the link to jump: https://mbd.pub/o/bread/ZZaUmp5x

The knowledge points of the article match the official knowledge files, and you can further learn related knowledge. Algorithm skill tree Home page Overview 57526 people are learning the system

syntaxbug.com © 2021 All Rights Reserved.