To solve the problem of crane anti-swing, fuzzy PID is a common method. However, the parameter configuration of fuzzy PID requires a lot of time and effort from professionals. Based on this, we introduce the LSO algorithm and add the stray operator, which effectively improves its global search performance. By combining SLSO and fuzzy PID and comparing them with other methods, this paper confirms that even without the targeted optimization by professionals, the optimization algorithm can find the appropriate parameter configuration for fuzzy PID which can be effectively used in the crane anti-swing problem.