YutaUme / CS

Cuckoo Search (CS) Source Code
14 stars 12 forks source link

There is a mistake in calculating sigma1 of levy flight #1

Closed sma11black closed 4 years ago

sma11black commented 5 years ago

The matlab code is sigma=(gamma(1+beta)*sin(pi*beta/2)/(gamma((1+beta)/2)*beta*2^((beta-1)/2)))^(1/beta);

Your code is sigma1 = np.power((math.gamma(1 + Lambda) * np.sin((np.pi * Lambda) / 2)) / math.gamma((1 + Lambda) / 2) * np.power(2, (Lambda - 1) / 2), 1 / Lambda)

It seems that your code is missing a Lambda.

sma11black commented 5 years ago

I checked the book Nature-inspired metaheuristic algorithms of the author. At the equation (2.23), Page 16 (chapter 2) of the book:

levy

I think the code should be sigma1 = np.power((np.gamma(1 + Lambda) * np.sin(np.pi * Lambda / 2)) / (np.gamma((1 + Lambda) / 2) * Lambda * np.power(2, (Lambda - 1) / 2)), 1 / Lambda)