Algorithms serve as the backbone of computer science, permeating diverse fields with their indispensable applications. The Knapsack Problems (KP), an optimization puzzle, revolves around the judicious selection of items characterized by their values and weights to maximize utility within the constraints of a limited-capacity container. This study introduces a pioneering mathematical optimization approach inspired by the nuanced behaviors of natural gazelles. Delving deep into the intricate hierarchical and social dynamics inherent in gazelle behavior, the Binary Mountain Gazelle Optimizer (BinMGO) emerges as a standout. Empowered by six diverse transfer functions, spanning from S-shaped to X-shaped varieties, BinMGO is finely tuned to address 0–1 KP. After evaluating six BinMGO variants, the most effective one is identified. Acknowledging the limitations posed by transfer functions, BinMGO undergoes additional refinement, resulting in the developing of the Enhanced Binary Mountain Gazelle Optimizer (EBinMGO), employing multiple mutation techniques tailored specifically for addressing 0–1 KP.
Thorough experimentation conducted on 0–1 KP datasets highlights EBinMGO's superiority over renowned swarm intelligence algorithms such as Ali Baba and the Forty Thieves (AFT), Prairie Dog Optimization Algorithm (PDO), Pelican Optimization Algorithm (POA), and Snake Optimizer (SO). The consistent proficiency demonstrated by EBinMGO in delivering superior outcomes across all experimental results positions EBinMGO as a promising solution for binary optimization challenges. Furthermore, this study provides valuable insights into mutation-based optimization algorithms, offering potential avenues for addressing complex problems inspired by nature's intricacies.