feat: Add White Shark Optimizer (WSO) with critical bug fix logic#253
Open
pnarkz wants to merge 1 commit intothieu1995:masterfrom
Open
feat: Add White Shark Optimizer (WSO) with critical bug fix logic#253pnarkz wants to merge 1 commit intothieu1995:masterfrom
pnarkz wants to merge 1 commit intothieu1995:masterfrom
Conversation
Implement strict MATLAB port of White Shark Optimizer (Braik et al., 2022) with correction to Global Best update logic. Original source used static index causing premature convergence; fixed by updating from Local Best memory independently following sequential if-logic. - 8 configurable parameters (f_min, f_max, tau, a0, a1, a2) - Boundary handling: ub*a + lb*b (safe Boolean logic) - Frequency: constant calculation (~0.899) matching MATLAB - Sequential schooling with chain dependency preserved - Comprehensive docstring with Args and Examples - Bug fix: Global Best now copies from agent memory (local_solution) Ref: https://doi.org/10.1016/j.knosys.2022.109210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.