Reference: Rao R. Jaya: A simple and new optimization algorithm for solving constrained and unconstrained optimization problems[J]. International Journal of Industrial Engineering Computations, 2016, 7(1): 19-34.
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) |
best_score | The best score of the iteration |
best_pos | The position of the best score of the iteration (list) |
worst_score | The worst score of the iteration |
worst_pos | The position of the worst score of the iteration (list) |
new_pos | The positions of newly updated candidates (list) |
new_score | The scores of newly updated candidates (list) |
iter_best | The global best score of each iteration (list) |
iter_con | The last iteration number when the "gbest" is updated |
if __name__ == '__main__':
# Parameter settings
pop = 50
iter = 1000
lb = [0, 0, 10, 10]
ub = [99, 99, 200, 200]
print(main(pop, iter, lb, ub))
The JAYA converges at its 587-th iteration, and the global best value is 8050.913534658795.
{
'best score': 8050.913534658795,
'best solution': [1.3005502034963052, 0.6428626394484327, 67.3860209065443, 10.0],
'convergence iteration': 587
}