esa / pagmo2

A C++ platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pagmo2/
GNU General Public License v3.0
829 stars 161 forks source link

Champion for stochastic optimization problems? #157

Closed CoolRunning closed 6 years ago

CoolRunning commented 6 years ago

Currently, a population of a stochastic optimization problem can be queried for its champion. This will give you a chromosome (not necessarily currently in the population) and a fitness value (usually computed at a previous state of the internal PRG). It is not possible to retrieve this previous state/seed, so it is unclear how this fitness came into existence. Moreover, it is debatable whether the notion of a champion even makes sense for a stochastic optimization problem? (i.e. the champion could be the worst individual according to the current state of the PRG).

darioizzo commented 6 years ago

Indeed. We never really thought through the champion concept for stochastic optimization cases. I would see some options: 1) Deactivate the champion as we do for multiobjective optimization, throwing if it is queried 2) Delegate to the UDAs the task of resetting the champion when the seed is changed

Maybe 2) should be the way to go?

Example: Change the Seed Recompute the champion fitness in the new seed and force the champion to have it Recompute all the population fitnesses in the new seed

darioizzo commented 6 years ago

The approach 2) above would require to implement a clear_champion method in population:

Change the Seed Store the champion X Clear the champion Recompute the fitness of X in the new seed Recompute all the population fitnesses in the new seed Set the champion to the best of all the above

CoolRunning commented 6 years ago

It puts a bit of an additional burden to the programmer of the algorithm. On the other hand: a user (who has no idea and just wants a problem to be optimized) might not need the champion or might have even false assumptions about the meaning of it.

darioizzo commented 6 years ago

As a temporary solution #161 activates a throw if the champion is requested in stochastic optimization problems

CoolRunning commented 6 years ago

This solution conflicts at the moment with the default print of islands, which wants to show you the champion. See:

isl = pg.island(algo = pg.sga(), prob = pg.inventory(), size=100)
print(isl)
ValueError                                Traceback (most recent call last)
<ipython-input-62-0fb3b4c0cefa> in <module>()
----> 1 print(isl)

ValueError: 
function: champion_x
where: C:\bld\pygmo_1523717981890\_b_env\Library\include\pagmo/population.hpp, 439
what: The Champion of a population can only be extracted for non stochastic problems
bluescarni commented 6 years ago

Fixed in #198.