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
808 stars 160 forks source link

Perturbation Vector in MBH is adjusted to the first problem it is called with #505

Closed mlooz closed 2 years ago

mlooz commented 2 years ago

When created with default arguments, Monotonic Basin Hopping sets the perturbation vector to have size one. When calling the evolve method with a population, the size of the perturbation vector is adjusted to fit the problem of the population. When calling the same algorithm object with a different population afterwards that has a different problem, it raises an error that the lengths of the perturbation vector does not fit the new problem. Thus, calling evolve affects the internal state of the algorithm object in an unexpected way.

An easy fix is to copy the perturbation vector in the evolve method and only adjust the size of the copy. Will do a PR for that in a couple of days.

bluescarni commented 2 years ago

@mlooz Cheers!

bluescarni commented 2 years ago

Fixed by #510 .