feat: Add White Shark Optimizer (WSO) with critical bug fix logic #253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements the White Shark Optimizer (WSO) for MEALPY. The implementation constitutes a Strict Port of the original MATLAB source code (Braik et al., 2022), ensuring mathematical exactness while fixing a critical logic bug found in the official source.
Critical Bug Fix from Original Source
During the detailed analysis of the original MATLAB code (
WSO.m), a logic bug was identified in the Global Best update mechanism.indexvariable (initialized once) instead of the current loop indexiwhen updating the global best position.Original MATLAB Code (Buggy):
Fixed Python Implementation: This implementation correctly updates the Global Best using the successful agent's memory (local_solution).
Verification Results (CEC-2017)$(Fitness - Optimum)$ , consistent with the paper's reporting method.
To validate this fix, I ran the benchmark following the paper's exact experimental setup (51 independent runs, D=30, MaxFEs=300,000). The results below are reported as Error Values
Analysis: The significant improvement in the complex Hybrid Function F20 confirms that the fix correctly guides the swarm, preventing the premature convergence observed in the original source.
Implementation Notes
Strict Port: Frequency (f) calculation matches the MATLAB source constant (~0.899) exactly (using division /, not multiplication * rand).
Safety: Boundary handling uses np.where for type safety (avoiding unsafe bitwise operations on integers).
Sequential Logic: The schooling phase correctly implements the sequential chain effect where agent i depends on the updated position of i-1.
Checklist
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have added the algorithm to the README.md table and added the BibTeX reference.
[x] I have verified the implementation against the original paper's results.