The genetic algorithm (GA) with simulated binary crossover and polynomial mutation to solve real optimization problems.
| Variables | Meaning |
|---|---|
| npop | population size |
| iter | iteration number |
| lb | lower bound |
| ub | upper bound |
| pc | crossover probability |
| eta_c | Spread factor distribution index |
| pm | mutation probability |
| eta_m | perturbance factor distribution index |
| dim | dimension |
| pop | population |
| objs | objectives |
| gbest | the global best |
| gbest_sol | the global best solution |
| iter_best | the global best of each iteration |
| con_iter | convergence iteration |
if __name__ == '__main__':
t_npop = 300
t_iter = 1500
t_lb = np.array([0, 0, 10, 10])
t_ub = np.array([99, 99, 200, 200])
print(main(t_npop, t_iter, t_lb, t_ub))The GA converges at its 1,331-th iteration, and the global best value is 8051.400862765215.
{
'gbest': 8051.400862765215,
'best solution': array([ 1.3005842 , 0.64288936, 67.38671732, 10. ]),
'convergence iteration': 1331
}
