mealpy icon indicating copy to clipboard operation
mealpy copied to clipboard

[BUG]: The n_workers parameter cannot be set for parallel computing.

Open moonlighthalfwindow opened this issue 6 months ago • 1 comments

Description of the bug

When I use parallel computing and set the n_workers parameter, the following error occurs:

AttributeError: ‘L_SHADE’ object has no attribute 'logging'

Steps To Reproduce

This issue can be identified in the following common situation.

optimizer = L_SHADE(epoch=500)
optimizer.solve(problem, mode='process', n_workers=4)

Additional Information

The problem is in line 177 of the \mealpy\optimizer.py file, the check_mode_and_workers method.

                self.logging.info(f"The parallel mode '{self.mode}' is selected with {self.n_workers} workers.")

logging should be logger

But the source code on github doesn't have this problem, the problem is with the pypi distribution

moonlighthalfwindow avatar Jun 12 '25 09:06 moonlighthalfwindow

@moonlighthalfwindow,

I am aware of this bug. There is a guy in community has fixed it and I merged his Pull Request into repo that is why you didn't see it. I am preparing a batch a new algorithms (2024 and 2025) for next version. So I can't release new version now. Please wait a little bit. I suggest you can change it in your editor and it will run just fine.

thieu1995 avatar Jun 13 '25 11:06 thieu1995