pygmo2 archipelago using simulated_annealing only evolves the initial champion

125 Views Asked by At

In using the pygmo2 simulated_annealing() algorithm in an archipelago, I found that only the initial champion seems to be evolved and all the other islands stay the same.

Consider the following test case:

archi=pg.archipelago(n=1,algo=pg.de(),pop_size=10,prob=pg.rosenbrock(10),seed=32)
archi[0].get_population().get_f()
array([[ 1444075.45],
   [  769751.435],
   [ 1539132.29],
   [  867545.07],
   [ 1139524.14],
   [ 1294374.29],
   [ 1313308.78],
   [ 1402739.85],
   [ 1734627.42],
   [ 1329435.20]])

archi.evolve(); archi.wait()
archi[0].get_population().get_f()
array([[ 1444075.45],
   [  754109.13],
   [  946288.71],
   [  409444.50],
   [ 1139524.14],
   [ 1216399.25],
   [ 1313308.78],
   [ 1402739.85],
   [  834097.30],
   [  173612.94]])

But if I run the same using algo=pg.simulated_annealing(), then an initial population_f of

array([[ 1408097.05],
   [ 1765715.34],
   [ 1547757.08],
   [ 1851529.02],
   [  440838.40],
   [ 1673630.76],
   [  867374.45],
   [ 2636693.48],
   [ 1809012.67],
   [  650619.19]])

becomes, after one call to evolve(),

array([[  1408097.05],
   [  1765715.34],
   [  1547757.08],
   [  1851529.02],
   [  2.15709202],
   [  1673630.76],
   [  867374.45],
   [  2636693.48],
   [  1809012.67],
   [  650619.19]])

Notice that only the island with the smallest fitness at the start is the only island to have been evolved. This happens with different problems, different algorithms, and different numbers of islands. Seems like a bug?

1

There are 1 best solutions below

0
On

Got this from the developers:

Nothing odd here. All is intended behavior.

There several problems with the use of the archipelago and the algorithm detailed above.

If you use the archipelago with pg.de and pop_size=1 the "error occurred" is to be expected as de is a population based algorithm and needs at least a population of size 4.

When an archipelago raises error in the islands, you can inspect those exceptions by calling the wait_check method. See https://esa.github.io/pagmo2/docs/python/tutorials/using_archipelago.html#managing-exceptions. If you do so you will see that the exeption is likely to be "de needs at least 4 individuals ...."

Simulated annealing is not population based and, as documented, only evolves one selected individual in the population. Which is what the code above shows.

"Notice that only the island with the smallest fitness" should be "Notice that only the chromosome with the smallest fitness" -> Which is what sa is supposed to do.

"most of the fitness vectors change using pg.de()" -> again thats intended behaviour of de. Since the user only evolves for one generation (use of default parameters)