esa / pygmo2

A Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pygmo2/
Mozilla Public License 2.0
422 stars 57 forks source link

Verbosity not working in Notebooks #105

Closed matteoettam09 closed 1 year ago

matteoettam09 commented 1 year ago

Describe the bug

Setting verbosity to the algo doesn't not lead to print the convergence. I am working in Notebooks, not sure if that is the cause of it.

To Reproduce

Running the first optimizer in the docs here on a different fitness function. Adding print(something) inside the class prints, but algo.set_verbosity(1) doesn't do anything.

Expected behavior

Would be nice to be able to print.

Environment (please complete the following information):

bluescarni commented 1 year ago

@matteoettam09 this is the expected behaviour, as the algorithms' screen output happens at the C++ level. I.e., you should see the screen output appearing in the console from which you started jupyter.

There's no easy solution for this issue. I think at one point the jupyter developers added automatic redirection of console output into the notebook GUI, but in my experience that can lead to deadlocks and I would thus warn against making use of this feature.

matteoettam09 commented 1 year ago

Right, like GODOT! Makes sense, thank you.

Thanks for the quick feedback!