Skip to content

Xavier-MaYiMing/Grey-Wolf-Optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Grey Wolf Optimizer

Reference: Mirjalili S, Mirjalili S M, Lewis A. Grey wolf optimizer[J]. Advances in Engineering Software, 2014, 69: 46-61.
Variables Meaning
pop The number of population
lb List, the lower bound of the i-th component is lb[i]
ub List, the upper bound of the i-th component is ub[i]
iter The maximum number of iterations
dim The dimension, dim = len(lb) = len(ub)
pos List, the position of each wolf
score List, the score of each wolf
iter_best List, the best so-far score of each iteration
alpha_pos List, the position of the alpha wolf
alpha_score The score of alpha wolf
beta_pos List, the position of the beta wolf
beta_score The score of the beta wolf
delta_pos List, the position of the delta wolf
delta_score The score of the delta wolf

Test problem: Pressure vessel design

$$ \begin{align} &\text{min}\ f(x)=0.6224x_1x_3x_4+1.7781x_2x_3^2+3.1661x_1^2x_4+19.84x_1^2x_3,\\ &\text{s.t.} \\ &-x_1+0.0193x_3\leq0,\\ &-x_3+0.0095x_3\leq0,\\ &-\pi x_3^2x_4-\frac{4}{3}\pi x_3^3+1296000\leq0,\\ &x_4-240\leq0,\\ &0\leq x_1\leq99,\\ &0\leq x_2 \leq99,\\ &10\leq x_3 \leq 200,\\ &10\leq x_4 \leq 200. \end{align} $$

Example

if __name__ == '__main__':
    pop = 200
    lb = [0, 0, 10, 10]
    ub = [99, 99, 200, 200]
    iter = 100
    print(main(pop, lb, ub, iter))
Output:

{
    'best solution': [1.3021065176429443, 0.6432278697383198, 67.39566614500494, 10.432203586211408], 
    'best score': 8087.875089101558
}

Releases

No releases published

Packages

No packages published

Languages