-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximization doesn't work #328
Comments
Thanks @zStupan. Please check maximization for the other algorithms too. I remember we had several problems with GWO algorithm in the past years. |
Most Algorithms work fine for maximization. There are, however, some issues:
|
@zStupan thanks for pointing the algorithms which are not working properly. If we are unable to solve the problems with those algorithms I would suggest, we temporarily exclude them from release. Maybe leave them in a separate branch and fix them later? What do you think @firefly-cpp? |
@GregaVrbancic, I totally agree with you. We should put all immature implementations of algorithms in separate branches. We can fix them after the release of 2.0 version of NiaPy. |
@zStupan, I suggest that we include only one version of KrillHerd algorithm which is actually associated with original publication. |
Crowding DE should definitely be excluded. I figured out what's causing the warning in GSOv1: NiaPy/niapy/algorithms/basic/gso.py Lines 301 to 302 in cc77c26
The function value of the sphere function is always greater than 0, and maximization is the minimization of -f(x), so our function values will always be negative. That means luciferin will always be all zeros, which causes division by zero in the probabilities function, making some probabilities infinite. I solved this by adding epsilon to the denominator in the probabilities function. In ASO, I fixed it by changing: NiaPy/niapy/algorithms/other/aso.py Lines 418 to 421 in cc77c26
to: x_best, x_best_fitness = self.update_personal_best(population, task.optimization_type.value * population_fitness,
np.zeros((self.population_size, task.dimension)),
np.full(self.population_size, np.inf)) Basically flipping the inequality operator if the optimization type is maximization. I couldn't figure out KrillHerdV11 and CMAES. |
Awesome @zStupan. KH and CMAES should go to the separate branches. We will fix them when time allows us to do it. |
Steps to reproduce
Expected behavior
Should maximize the sphere function, i. e print solution full of ± 5.12 with a fitness of 262.144 or something very close to that.
Actual behavior
None and -inf get returned, which means the stopping condition evaluates to True on the first iteration.
I'm working on a fix, should be up in a few minutes.
The text was updated successfully, but these errors were encountered: