pymoo
pymoo copied to clipboard
Pymoo crashes when sequential runs have different n_obj
When running several optimizations in series, Output objects are reused. This leads to incorrect values of certain indicators and in case of a different number of objectives, to a crash with the following error.
N[..., neither_nan] = (X[..., neither_nan] - xl[neither_nan]) / (xu[neither_nan] - xl[neither_nan])
IndexError: boolean index did not match indexed array along dimension 1; dimension is 3 but corresponding boolean dimension is 1
For an example, see here.
As mentoined by @blankjul on Discord, this can be fixed by explicitly instantiating a new Output object when setting up the algorithm.
from pymoo.util.display.multi import MultiObjectiveOutput
algorithm_1.setup(
problem_1, termination=setup_termination(n_max_gen_1),
seed=seed_1, verbose=True, save_history=False,
output=MultiObjectiveOutput()
)
Thank you for documenting the issue here!