Reference: Mirjalili S. SCA: A Sine Cosine Algorithm for solving optimization problems[J]. Knowledge-Based Systems, 2016, 96.
Variables | Meaning |
---|---|
pop | The number of candidates |
iter | The number of iterations |
lb | The lower bound (list) |
ub | The upper bound (list) |
pos | The position of all candidates (list) |
score | The score of all candidates (list) |
dim | Dimension |
gbest | The score of the global best candidate |
gbest_pos | The position of the global best candidate (list) |
seed_pos | The position of the seeds of the ith candidate (list) |
seed_score | The score of the seeds of the ith candidate (list) |
iter_best | The global best score of each iteration (list) |
con_iter | The last iteration number when "gbest" is updated |
if __name__ == '__main__':
# Parameter settings
pop = 30
iter = 1000
lb = [0, 0, 10, 10]
ub = [99, 99, 200, 200]
print(main(pop, iter, lb, ub))
The SCA converges at its 957-th iteration, and the global best value is 9590.464425690781.
{
'best score': 9590.464425690781,
'best solution': [1.457576369166947, 0.6612071818606331, 68.48174413611495, 17.286314289498986],
'convergence iteration': 957
}