Reference: Mirjalili S, Lewis A. The whale optimization algorithm[J]. Advances in Engineering Software, 2016, 95: 51-67.
| 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 |
| prey_score | The score of the prey (the best-so-far score) |
| prey_pos | List, the position of the prey |
| con_iter | The last iteration number when the prey_score is updated |
if __name__ == '__main__':
pop = 200
lb = [0, 0, 10, 10]
ub = [99, 99, 200, 200]
iter = 100
print(main(pop, lb, ub, iter)){
'best solution': [1.3042606802575338, 0.6485023104593771, 67.38602116115652, 10.0],
'best score': 8111.232881473693,
'convergence iteration': 9907
}
