**Background:** Forages are essential for economical and physiologically sound ruminant nutrition. Accurate estimation of fermentation parameters is critical for predicting digestibility, energy content, and dry matter intake. Nonlinear models can provide more detailed information on feed degradability than linear models. Particle swarm optimization (PSO) is a collective intelligence algorithm inspired by bird flocking behavior that iteratively adjusts candidate solutions toward optimal fits. This study aimed to determine whether PSO could effectively fit fermentation curves for legume forages and identify which mathematical model best described the data.
**Methods:** The study used previously published in vitro gas production data (Palangi and Macit, 2019) for alfalfa (Medicago polymorpha), vetch (Vicia villosa), and white clover (Trifolium repens). Gas volume was measured at 3, 6, 12, 24, 48, 72, and 96 hours of incubation. Four mathematical models were fitted using PSO in MATLAB: Model I (first-order kinetic without lag phase), Model II (first-order kinetic with lag phase), Model III (Gompertz model), and Model IV (generalized Mitscherlich model). PSO parameters included a population size of 500 particles, maximum 100 iterations, C1 = 1.5, C2 = 2, and inertial weight damping ratio = 1. The fitness function aimed to minimize the sum of squared errors. Model performance was evaluated using R², adjusted R², sum of squared errors (SSE), and root mean square error (RMSE). Biological plausibility of estimated parameters (e.g., negative values for fermentable fractions) was also assessed.
**Key Results:** All four models achieved R² > 0.98 for alfalfa, vetch, and clover, indicating excellent fit. However, Models III and IV produced negative parameter estimates for some forages that were deemed biologically unacceptable. For alfalfa, Model IV achieved the best fit: R² = 0.9973, adjusted R² = 0.9918, SSE = 6.5756, RMSE = 1.8132, with parameters a = 28.66, b = 47.71, c = 0.01097, L = 5.73, d = 0.3819. For vetch, Model I performed well: R² = 0.9851, adjusted R² = 0.9777, SSE = 27.2274, RMSE = 2.6090, with a = 5.017, b = 52.97, c = 0.07508. For clover, Model I also performed well: R² = 0.9881, adjusted R² = 0.9822, SSE = 33.0409, RMSE = 2.8741, with a = 8.191, b = 63.5, c = 0.06554. Models I and II (first-order kinetics) successfully converged for all forages with R² > 0.98. Model III produced negative 'a' values across all forages (alfalfa: −211.6, vetch: −174.1, clover: −234.7), which are not biologically acceptable. Model IV produced negative 'c' values for vetch (−0.0105) and clover (−0.009137), also biologically unacceptable. The slowly fermentable fraction (b) was highest in clover (63.5), followed by alfalfa (59.61) and vetch (52.97). The lag time (L) was similar across forages: alfalfa 0.3169, vetch 0.305, clover 0.3244 for Model II. The PSO algorithm achieved convergence with relatively few iterations, enhancing model validity.
**Clinical Implications:** This study demonstrates that PSO is a reliable and efficient method for fitting ruminal fermentation curves, achieving high R² values with relatively few iterations. The approach is adaptable to various mathematical models by modifying the fitness function and parameter values. For practical application, Models I and II (first-order kinetics) are recommended for vetch and white clover due to biological plausibility, while Model IV (generalized Mitscherlich) is preferred for alfalfa due to superior fit. The high slowly fermentable fraction (b) in clover suggests higher rumen undegradable protein content, which may influence feeding strategies. Animal nutritionists can use PSO-fitted fermentation curves to more accurately determine ruminant nutritional requirements and compare different feed materials. The method's ability to intelligently estimate parameters and optimize curve fitting with minimal iterations makes it a practical tool for feed evaluation. However, biological plausibility of estimated parameters must always be considered alongside statistical fit when selecting models.