Optimization problems are common across various fields, and one effective solution is the swarm intelligence algorithm.It is essential for the algorithm to deliver high-quality solutions for problems with varying characteristics. However, most existing swarm intelligence rely on fixed and monotonic search strategies, which limits their ability to handle the diverse and complex situations encountered when solving real-world optimization problems with unknown fitness landscapes. To extend the applicability of swarm intelligence and thus offer users an efficient black-box optimizer for various applications, a novel self-learning mechanism is proposed and applied to the Salp Swarm Algorithm (SSA) to develop the self-learning salp swarm algorithm (SLSSA) in this paper. In SLSSA, four distinct search strategies, including a novel multiple food sources search strategy, are adopted to strengthen the search agents’ abilities to conquer various difficulties in the search space. To improve the efficiency of the search process, the self-learning strategy dynamically determines the execution probability of each search strategy according to the quality of solutions it produced previously. Moreover, a parameter setting method is proposed in this paper, which eliminates the need for a trial-and-error approach and allows for straightforward configuration of the parameters that optimize the performance of SLSSA. In comparison with several highly regarded state-of-the-art peer algorithms, the performance of SLSSA in solving the CEC2014 benchmark functions was thoroughly examined. Subsequently, SLSSA was applied to train multi-layer perceptron classifiers and test on the UCI machine-learning datasets. The experimental results and analysis on benchmark functions and multi-layer perceptron classifier training problems demonstrate that SLSSA outperforms the competing algorithms in terms of solution accuracy, stability, and overall convergence speed. Moreover, computational time comparisons reveal that SLSSA achieves significant performance improvement with only a marginal increase in time cost compared to the original SSA.