Javascript is required
1.
Nigerian Meteorological Agency (NiMet), “Seasonal rainfall prediction report,” Tech. Rep., 2025. [Google Scholar]
2.
Food and Agriculture Organization (FAO), “FAOSTAT statistical database,” 2025. [Google Scholar]
3.
National Bureau of Statistics (NBS), “Agricultural survey report 2023,” Tech. Rep., 2024. [Google Scholar]
4.
B. Das, S. Shukla, F. Davenport, G. Husak, C. Funk, K. Tabor, J. Rowland, M. Budde, and J. Verdin, “Comparative crop yield forecasting using satellite-derived biophysical and agro-climatic predictors in Sub-Saharan Africa,” Remote Sens. Appl. Soc. Environ., vol. 43, p. 102222, 2026. [Google Scholar] [Crossref]
5.
H. Fawzi, S. A. Mostafa, D. Ahmed, N. Alduais, M. A. Mohammed, and M. Elhoseny, “TOQO: A new tillage operations quality optimization model based on parallel and dynamic decision support system,” J. Clean. Prod., vol. 316, p. 128263, 2021. [Google Scholar] [Crossref]
6.
O. A. Abisoye, J. A. Adedokun, B. O. Abisoye, O. L. Lawal, J. A. Olajire, and M. Kama, “Particle swarm optimization–Random forest weather-based crop yield prediction model,” Univ. Ibadan J. Sci. Log. ICT Res., vol. 15, no. 1, pp. 57–68, 2025. [Google Scholar]
7.
S. M. Shawon, F. B. Ema, A. K. Mahi, F. L. Niha, and H. T. Zubair, “Crop yield prediction using machine learning: An extensive and systematic literature review,” Smart Agric. Technol., vol. 10, p. 100718, 2025. [Google Scholar] [Crossref]
8.
M. T. Linaza, J. Posada, J. Bund, P. Eisert, M. Quartulli, J. Döllner, A. Pagani, I. G. Olaizola, A. Barriguinha, T. Moysiadis, and others, “Data-driven artificial intelligence applications for sustainable precision agriculture,” Agronomy, vol. 11, no. 6, p. 1227, 2021. [Google Scholar] [Crossref]
9.
S. Alimagham, M. P. van Loon, J. Ramirez-Villegas, H. N. C. Berghuijs, T. S. Rosenstock, and M. K. van Ittersum, “Integrating crop models and machine learning for projecting climate change impacts on crops in data-limited environments,” Agric. Syst., vol. 228, p. 104367, 2025. [Google Scholar] [Crossref]
10.
M. Randall, K. Schiller, A. Lewis, J. Montgomery, and M. S. Alam, “A systematic review of crop planning optimisation under climate change,” Water Resour. Manag., vol. 38, no. 6, pp. 1867–1881, 2024. [Google Scholar] [Crossref]
11.
Y. L. Gavasso-Rita, S. M. Papalexiou, Y. Li, A. Elshorbagy, Z. Li, and C. Schuster-Wallace, “Crop models and their use in assessing crop production and food security: A review,” Food Energy Secur., vol. 13, p. e503, 2024. [Google Scholar] [Crossref]
12.
R. D. S. G. Pontes, D. N. Brandão, F. L. Usberti, and L. S. de Assis, “Multi-objective models for crop rotation planning problems,” Agric. Syst., vol. 219, p. 104050, 2024. [Google Scholar] [Crossref]
13.
P. Mohapatra, J. C. Paul, and S. S. Dash, “Multiobjective simulation–optimization of crop allocation and water resources in canal command areas using genetic algorithms,” Irrig. Drain., vol. 75, no. 4, pp. 1592–1608, 2026. [Google Scholar] [Crossref]
14.
M. von Bloh, D. Lobell, and S. Asseng, “Knowledge informed hybrid machine learning in agricultural yield prediction,” Comput. Electron. Agric., vol. 227, p. 109606, 2024. [Google Scholar] [Crossref]
15.
V. D. A. Kumar, Z. Thihlum, and A. K. Mohanty, “Explainable XGBoost model for crop recommendation in Mizoram using hybrid Random Forest and Particle Swarm Optimization,” Indian J. Agric. Sci., vol. 95, no. 11, pp. 1324–1331, 2025. [Google Scholar] [Crossref]
16.
G. Pal, S. Roy, J. K. Bag, and P. K. Pranav, “A comprehensive review of ML and optimization techniques in agricultural system modeling: A cybernetics perspective,” Comput. Electron. Agric., vol. 241, p. 111188, 2026. [Google Scholar] [Crossref]
17.
R. K. Dwivedi, R. Mishra, G. Dwivedi, and R. S. Solanki, “Risk-aware agricultural decision support system using ensemble machine learning models for predicting crop failures under climate variability and pest infestation scenarios,” Int. J. Agric. Nutr., vol. 7, no. 9, pp. 41–47, 2025. [Google Scholar] [Crossref]
18.
O. G. Ajayi, J. Ashi, and B. Guda, “Performance evaluation of YOLOv5 model for automatic crop and weed classification on UAV images,” Smart Agric. Technol., vol. 5, p. 100231, 2023. [Google Scholar] [Crossref]
19.
S. Sharma, K. M. Anirudh, B. R. Bakshi, S. Sandeep, H. Kodamana, and M. Ramteke, “Multi-objective optimization for sustainable agricultural strategies considering future climatic scenarios: A study in the context of India,” Comput. Chem. Eng., vol. 203, p. 109306, 2025. [Google Scholar] [Crossref]
20.
AFEX Commodities Exchange, “AFEX 2025 wet season crop production report,” Tech. Rep., 2025. [Online]. Available: https://www.afex.africa/reports/quarterly [Google Scholar]
21.
Nigeria Soil Information System (NSIS), “National soil survey data,” Tech. Rep., 2023. [Google Scholar]
22.
S. Begam, R. Jain, A. Arora, and S. Marwaha, “Multi-objective particle swarm optimization for regional crop planning,” Indian J. Agric. Sci., vol. 93, no. 2, pp. 237–240, 2023. [Google Scholar] [Crossref]
23.
D. Chen and Y. Huang, “Integrating reinforcement learning and large language models for crop production process management optimization and control through a new knowledge-based deep learning paradigm,” Comput. Electron. Agric., vol. 232, p. 110028, 2025. [Google Scholar] [Crossref]
24.
C. H. Chang, J. Lin, J. W. Chang, Y. S. Huang, M. H. Lai, and Y. J. Chang, “Hybrid deep neural networks with multi-tasking for rice yield prediction using remote sensing data,” Agriculture, vol. 14, no. 4, p. 513, 2024. [Google Scholar] [Crossref]
25.
G. Talukdar, R. K. Bhattacharjya, and A. K. Sarma, “Optimal cropping pattern based on short-term streamflow forecasts to improve agricultural economic benefits and crop productivity under uncertainty conditions,” Hydrol. Sci. J., vol. 68, no. 2, pp. 246–260, 2023. [Google Scholar] [Crossref]
26.
F. A. Fortin, F. M. De Rainville, M. A. Gardner, M. Parizeau, and C. Gagné, “DEAP: Evolutionary algorithms made easy,” J. Mach. Learn. Res., vol. 13, pp. 2171–2175, 2012. [Google Scholar]
27.
Y. Akkem, B. S. Kumar, and A. Varanasi, “Streamlit application for advanced ensemble learning methods in crop recommendation systems – a review and implementation,” Indian J. Sci. Technol., vol. 16, no. 48, pp. 4688–4702, 2023. [Google Scholar] [Crossref]
28.
J. Balderas, D. Chen, Y. Huang, L. Wang, and R. Li, “A comparative study of deep reinforcement learning for crop production management,” Smart Agric. Technol., vol. 10, p. 100853, 2025. [Google Scholar] [Crossref]
29.
H. Afzal, M. Amjad, A. Raza, K. Munir, S. G. Villar, L. A. D. Lopez, and I. Ashraf, “Incorporating soil information with machine learning for crop recommendation to improve agricultural output,” Sci. Rep., vol. 15, p. 8560, 2025. [Google Scholar] [Crossref]
30.
A. Kurniawan, T. R. Soeprobowati, and B. Warsito, “Hybrid PSO–ACO optimization for rice leaf disease classification using Random Forest and Support Vector Machines,” Int. J. Adv. Comput. Sci. Appl., vol. 16, no. 6, pp. 388–397, 2025. [Google Scholar] [Crossref]
Search
Open Access
Research article

A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria

Nengem Stephen Mkegh1*,
Friday Haruna1,
Doris Kyado2,
Samuel Ayua Iorhemen2
1
Department of Mathematics and Statistics, Taraba State University, PMB 1167 Jalingo, Nigeria
2
Department of Computer Science, Taraba State University, PMB 1167 Jalingo, Nigeria
Information Dynamics and Applications
|
Volume 5, Issue 3, 2026
|
Pages 142-156
Received: 07-23-2026,
Revised: 09-20-2026,
Accepted: 09-27-2026,
Available online: 09-30-2026
View Full Article|Download PDF

Abstract:

Sustainable agricultural planning in Nigeria requires balancing profitability, water use, and food security under climatic uncertainty. This study developed a multi-objective optimization framework integrating particle swarm optimization (PSO) and random forest (RF) regression to improve crop allocation and resource management. Agricultural planning was formulated around three competing objectives: profit maximization, water-use minimization, and caloric production maximization. Six algorithms, including linear programming (LP), integer linear programming (ILP), genetic algorithm (GA), PSO, ant colony optimization (ACO), and the proposed hybrid PSO-RF framework, were implemented in Python and evaluated using agricultural, climatic, and soil data from three Nigerian agro-ecological zones. The RF yield predictor achieved a weighted mean $R^2$ of 0.968, an RMSE of 373.4 kg/ha, an MAE of 284.2 kg/ha, and an average prediction error of 6.8% of mean yield. The hybrid PSO-RF framework achieved the highest optimality (97.1%) under the common evaluation benchmark. In a 1,000-ha case study in Southwest Nigeria, the optimized allocation generated an annual profit of $\text{₦}$1.4525 billion and caloric production of $13.526 \times 10^9$ kcal, meeting approximately 296% of the annual caloric requirement of 5,000 persons (a 196% surplus above the minimum requirement). Water-use efficiency was 1.93 kg/m$^3$. Under the 2050 climate scenario (+2 $^\circ\mathrm{C}$ and $-15%$ rainfall), annual profit declined to $\text{₦}$1.163 billion, while adaptive crop reallocation maintained caloric production above the minimum food-security requirement. A web-based decision support system was developed to translate the optimization results into a practical planning tool for policymakers, farmer cooperatives, and agricultural extension services.

Keywords: Optimization algorithms, Agricultural planning, Food security, Particle swarm optimization, Random forest, Nigeria, Multi-objective optimization, Decision support system

1. Introduction

Although Nigeria cultivates a wide variety of crops, this study focuses on five major staple crops: maize, rice, cassava, yam, and sorghum. The broader dataset covers three agro-ecological zones: Southwest Nigeria, North-Central Nigeria, and Northern Nigeria [1]. The principal numerical case study considers a 1,000-hectare agricultural planning problem in Southwest Nigeria, while the other zones provide broader geographical coverage for the agricultural data and model development, as applicable [2], [3]. The optimization framework considers a twelve-month planning horizon and incorporates land availability, budget, water availability, soil nutrient balance, and a minimum annual caloric production requirement of 4.5625$\times10^9$ kcal, corresponding to 5,000 persons consuming 2,500 kcal per person per day over 365 days. Livestock integration and dynamic market-price fluctuations are outside the scope of the present study [4], [5], [6].

Current agricultural performance is constrained by several interrelated inefficiencies. In the absence of data-driven guidance on crop selection based on soil, climate, and market conditions, land is often sub-optimally allocated, while water, fertilizer, and labor are applied in ways that reduce yield per unit of input [7], [8], [9]. Traditional planning methods further struggle to adapt to increasingly variable rainfall and temperature patterns, leaving production highly vulnerable to climate shocks. Compounding these issues, supply chains remain fragmented, leading to post-harvest losses that exceed 30% for perishable products, driven in large part by poor alignment between production and distribution [10]. On the other hand, optimization algorithms have demonstrated significant promise in solving complex, multi-dimensional resource allocation problems across various domains [11], [12], [13]. However, their application to agricultural planning, particularly in developing-country contexts such as Nigeria, remains limited. Existing models often rely on single-objective frameworks, ignore local constraints such as smallholder land tenure or seasonal labor availability, or are not packaged into accessible decision support systems for non-specialist users.

This research addresses three specific gaps in agricultural optimization literature and practice. First, an algorithmic gap exists due to the limited comparative evaluation of metaheuristic methods, specifically particle swarm optimization, genetic algorithms, and ant colony optimization, alongside exact methods such as linear and integer linear programming under Nigerian agricultural conditions [14]. Secondly, a hybrid gap persists, as no prior study has integrated random forest regression for yield prediction with particle swarm optimization for land allocation within a single agricultural planning framework for any West African state, to the best of the researchers’ knowledge. Thirdly, an implementation gap remains because the existing models are rarely translated into usable decision support system tools for local stakeholders, including policymakers, farmer cooperatives, and extension agents [15]. By addressing these gaps, this research contributes a novel hybrid particle swarm optimization‑random forest framework, the first empirical benchmark of five optimization algorithms on Nigerian staple crop data, and a web‑based decision support system tailored to real‑world resource constraints.

The overarching aim of this research is to develop and implement optimization algorithms that enhance agricultural planning and thereby contribute to improved food security in Nigeria. To achieve this aim, the study first models agricultural planning problems that incorporate environmental, economic, and social constraints relevant to Nigerian smallholder and medium‑scale farming systems. Multiple optimization algorithms, including linear programming, integer linear programming, genetic algorithms, particle swarm optimization, ant colony optimization, and a novel hybrid combining particle swarm optimization with random forest regression, are then designed and implemented. The performance of these algorithms is evaluated using real‑world agricultural data from Nigeria, with metrics such as solution quality, convergence speed, and constraint adherence analyzed. Subsequently, a web‑based decision support system is developed, integrating the optimal algorithm for direct use by stakeholders. Finally, the impact of optimized planning is assessed on crop yield, resource efficiency, and food security metrics under both baseline conditions and future climate‑change scenarios.

Though there are many varieties of crops in Nigeria, the research focuses on five major staple crops, which are maize, rice, cassava, yam, and sorghum, cultivated across three agro‑ecological zones of Nigeria: the Southwest, North‑Central, and the North. The optimization horizon covers a single 12-month growing period. Constraints include a maximum land area of 1,000 ha in the case study, a total budget of $\text{₦}$400 million, water availability derived from Nigerian Meteorological Agency rainfall data, soil nutrient balances, and a minimum annual caloric production requirement of 4.5625$\times10^9$ kcal, corresponding to the dietary energy requirement of 5,000 persons at 2,500 kcal per person per day over 365 days. The study does not incorporate livestock integration or dynamic market price fluctuations, and it assumes a continuous 12‑month planning horizon without explicit intra‑seasonal planting and harvest subdivisions.

The optimization is conducted over a single, continuous 12-month planning horizon. For the 1,000-ha case study, the total planning budget is capped at $\text{₦}$400 million, while water availability is estimated using rainfall data from the Nigerian Meteorological Agency (NiMet). The model does not explicitly incorporate intra-seasonal planting and harvest subdivisions, livestock integration, or dynamic market-price fluctuations.

2. Materials and Methods

2.1 Study Area and Data Collection

The study considers three representative agro-ecological zones of Nigeria. The Southwest zone comprises Oyo, Ogun, and Osun States; the North-Central zone comprises Benue, Nasarawa, and Kogi States; and the Northern zone comprises Kano, Kaduna, and Katsina States. These zones provide the geographical context for the agricultural, climatic, soil, and socioeconomic data considered in the study. The principal 1,000-hectare baseline case study is located in Southwest Nigeria [9], [11], [16].

Agricultural yield and cultivated-area data were compiled from the National Bureau of Statistics (NBS), the Food and Agriculture Organization (FAO), and relevant agricultural reports, as applicable [3], [17]. Climatic variables, including rainfall and temperature, were obtained from the Nigerian Meteorological Agency (NiMet). Soil properties were sourced from the Nigeria Soil Information System (NSIS) and the FAO Harmonized World Soil Database. Economic variables, including crop prices and production costs, were compiled from the relevant NBS and agricultural-market sources identified in Table 1. The Random Forest training dataset comprised 5,742 field-level observations from twelve Nigerian States covering 2018–2024. The broader historical data coverage and the specific period used to train the Random Forest model are distinguished to avoid ambiguity [1], [3], [18], [19]. The data were harmonized to ensure consistency in crop definitions, units, geographical coverage, and temporal references before model training and optimization. Climate projections were handled separately from historical observations, as described in Section 2.5.

Table 1. Data sources and variables used in the agricultural planning framework
Data TypeSource of reportVariables
ClimateNiMet [1]Rainfall (mm), minimum/maximum temperature ($^\circ$C); humidity or evapotranspiration only if used
Crop yieldsFAO [2], NBS [3]Yield (kg/ha), crop, state, and observation year/season
EconomicNBS [3], AFEX [20]Market price ($\text{₦}$/kg), production cost ($\text{₦}$/ha)
SoilNigeria Soil Information System [21]Nitrogen (\%), phosphorus (ppm), potassium (cmol/kg), pH, organic carbon (\%)
Land useNBS Agricultural Survey [3]Cultivated area (ha), crop, state, and observation year
Note: NiMet = Nigerian Meteorological Agency; FAO = Food and Agriculture Organization; NBS = National Bureau of Statistics; AFEX = AFEX Commodities Exchange; NSIS = Nigeria Soil Information System.
2.2 Mathematical Problem Formulation

Let $x_i$ be the area (ha) allocated to crop $i$, where $i \in\{$maize, rice, cassava, yam, sorghum$\}$. Let $w_i$ denote water allocation ($m^3$) and $f_i$ denote fertilizer allocation (kg/ha) in terms of nitrogen, phosphorus, and potassium. Three objectives were defined [21], [22]:

Objective 1: Maximization of total profit.

$\max Z_1=\sum_{i=1}^n\left(p_i y_i x_i\right)-\sum_{i=1}^n\left(c_i x_i\right)$
(1)

where, $p_i$ is the market price ($\text{₦}$/kg), $y_i$ is the yield (kg/ha), and $c_i$ is the production cost ($\text{₦}$/ha).

Objective 2: Minimization of water usage.

$\min Z_2=\sum_{i=1}^n\left(w_i x_i\right)$
(2)

Objective 3: Maximization of caloric production (food security proxy).

$\max Z_3=\sum_{i=1}^n\left(y_i x_i k_i\right)$
(3)

where, $k_i$ is the caloric conversion factor ($\mathrm{kcal}$/$\mathrm{kg}$): maize (3,650), rice (3,540), cassava (1,560), yam (1,180), and sorghum (3,390).

Several constraints were incorporated for agricultural planning. The land availability and budget constraints can be expressed, respectively, as follows:

$\begin{aligned} & \sum_{i=1}^n x_i \leq A \quad(A=1,000 \text {~ha for case study}) \\ & \qquad \sum_{i=1}^n c_i x_i \leq B \quad(B = \text{₦}400,000,000) \end{aligned}$
(4)

The budget constraint limits the allocable planning resources available during optimization and represents the maximum decision budget used by the optimization model when determining feasible land-allocation solutions. By contrast, the production costs reported later in the case-study evaluation represent the realized expenditure associated with implementing the optimized production plan. These quantities therefore serve different purposes: the former governs optimization feasibility, whereas the latter summarizes the economic outcome of the selected allocation.

The water availability constraint (based on seasonal rainfall) can be expressed as follows:

\[ \sum_{i=1}^n w_i x_i \leq W_{\max }^{\text {Total }} \quad \left(W_{\max }^{\text {Total}}=5,000 \times 1,000=5,000,000\ \mathrm{m}^3 / \text {season}\right)\]

The minimum food security constraint (caloric requirement for 5,000 persons at 2,500 kcal/day for 365 days) can be expressed as follows:

\[ C_{\min }=5000 \times 2500 \times 365=4.5625 \times 10^9 \ \mathrm{kcal} / \text {year }\]

Thus, the optimization requires total annual caloric production to be at least $4.5625 \times 10^9 \ \mathrm{kcal}$, ensuring that every feasible solution satisfies the annual dietary energy requirement for the target population.

\[ \sum_{i=1}^n\left(y_i x_i k_i\right) \geq 4.5625 \times 10^9 \ \mathrm{kcal} \]

Soil nutrient balance (sustainability constraint) can be expressed as follows:

$\sum_{i=1}^n\left(u_{N, L, i} \quad x_i\right) \leq N_{\text {avail }}, \quad \sum_{i=1}^n\left(u_{P_{j, i} i} x_i\right) \leq P_{\text {avail }}, \quad \sum_{i=1}^n\left(u_{K, i, i} x_i\right) \leq K_{\text {avail }}$
(5)

where, $u$ is the nutrient uptake per ha, and $N_{\text {avail }}$ is the available nitrogen (kg) from soil plus fertilizer. Nonnegativity and integer constraints: $x_i \geq 0$, and for integer linear programming, $x_i \in Z^{+}$.

For the multi-objective optimization, the weighted sum method with normalization was employed:

\[Z=\lambda_1 \frac{Z_1}{Z_1^{\max }}-\lambda_2 \frac{Z_2}{Z_2^{\max }}+\lambda_3 \frac{Z_3}{Z_3^{\max }}\]

where, $\lambda_1=0.5, \lambda_2=0.3$, and $\lambda_3=0.2$ were determined through a stakeholder survey involving 15 agricultural economists and policymakers. $Z^{\max}$ values were obtained from single-objective optima.

2.3 Algorithm Design and Implementation

Six algorithms were implemented and compared for solving the target optimization problem, including linear programming, integer linear programming, genetic algorithm, and three additional methods discussed in subsequent subsections.

The linear programming and integer linear programming models were implemented using Python's PuLP library with the COIN-OR Branch and Cut (CBC) solver. The primary strength of this approach lies in its ability to produce exact optimal solutions with fast convergence to the global optimum, particularly for convex problems [22]. However, the approach carries notable limitations: it assumes linearity in both the objective function and constraints, and it handles only a single objective natively. To address multi-objective requirements, the weighted sum method is applied sequentially, solving multiple instances with different weight combinations rather than producing a true Pareto front in a single run, similar approach can be seen in [23], [24]. Additionally, the integer linear programming variant scales poorly as the number of integer variables increases.

The genetic algorithm is implemented using the Distributed Evolutionary Algorithms in Python (DEAP) library. The configuration employed a population size of 200 individuals evolving over 500 generations. Crossover occurred with a probability of 0.8, while mutation was applied at a rate of 0.05. Selection was performed using tournament selection with a tournament size of 3. This evolutionary approach offers advantages over linear programming when dealing with discrete, nonlinear, or non-differentiable problems, as it does not rely on convexity or gradient information. Furthermore, it can directly approximate a Pareto front for multi-objective cases. On the other hand, the genetic algorithm is stochastic by nature, provides no guarantee of finding the global optimum, requires careful parameter tuning, and typically converges more slowly to near-optimal solutions compared to exact methods.

To ensure a transparent comparison, two complementary evaluation protocols were employed. In the baseline algorithm benchmark, linear programming, integer linear programming, genetic algorithm, particle swarm optimization, and ant colony optimization were provided with a common fixed yield matrix computed from historical zonal average yields for each crop, while the hybrid particle swarm optimization-random forest used random forest-predicted yields that varied according to the corresponding soil, climate, and management variables. This benchmark evaluates the practical performance of the complete hybrid decision-support framework, where machine learning and optimization operate together.

To isolate the contribution of the optimization engines themselves, an additional common input benchmark was conducted. In this experiment, the random forest model first generated a single predicted-yield matrix for every crop location combination, and this identical yield matrix was supplied to all six optimization algorithms. Apart from the yield source, all experimental conditions, including objective-function weights, resource constraints, initialization settings, stopping criteria, and computational environment, remained unchanged, ensuring that performance differences reflected optimization behavior rather than differences in input data.

2.4 Metaheuristic and Hybrid Optimization Methods

Particle swarm optimization was implemented using the following parameters: swarm size $=150$; iterations $=500$; inertia weight: $w=0.7 \rightarrow 0.4$ with linear decay; cognitive coefficient: $c_1=1.5$; and social coefficient: $c_2=1.5$. The velocity of each particle was updated according to the following equation: $ v_i^{t+1}=wv_i^t+c_1r_1(pbest_i-x_i^t)+c_2r_2(gbest-x_i^t)$. Ant colony optimization was implemented using the following parameters: number of ants $=100$; evaporation rate $=0.5 ; \alpha$ (pheromone weight) $=1.0$; and $\beta$ (heuristic weight) $=2.0$. A novel contribution of this study is the development of a hybrid optimization framework combining particle swarm optimization with a random forest regressor. Unlike conventional approaches that assume fixed yield parameters [25-26], this method trains a random forest model to predict site-specific crop yields based on soil properties, climatic conditions, and historical agricultural data. The particle swarm optimization algorithm then optimizes land allocation using these predicted yields within the objective function.

The Random Forest model was trained using twelve input features: total seasonal rainfall, average temperature, soil nitrogen percentage, soil phosphorus concentration in parts per million, soil potassium content in centimoles per kilogram, soil pH, organic carbon percentage, elevation in meters, slope percentage, a three-year average of historical yield, fertilizer applied in kilograms per hectare, and binary irrigation access. The target variable was actual yield measured in kilograms per hectare. Training data consisted of 5,742 field-level observations collected across twelve Nigerian states spanning the three study agro-ecological zones and adjacent areas between 2018 and 2024. Hyper-parameters were optimized via grid search, resulting in a configuration of 300 estimators, a maximum tree depth of 15, a minimum of five samples required to split an internal node, and a minimum of two samples required at a leaf node. In terms of the validation procedure of the random forest model, the dataset containing 5,742 field-level observations was randomly partitioned into an 80\% training set and a 20\% independent test set using a fixed random seed (random state = 42) to ensure reproducibility. Hyper-parameter tuning was performed exclusively on the training portion through grid search, while the held-out test set remained untouched until final evaluation. To prevent information leakage, all predictor variables, including climatic, soil, and management features, were constructed using information available for the corresponding observation only. The historical yield predictor was computed as a rolling three-year average using preceding production records, thereby excluding future yield information from the prediction target. Feature engineering and model fitting were completed separately for the training and evaluation stages before the final performance metrics, i.e., coefficient of determination ($R^2$), root mean square error, and mean absolute error, were computed on the independent test set.

Within the hybrid framework, particle swarm optimization was used to evaluate each particle's fitness through a three-step procedure. First, for each crop and its corresponding land allocation, the random forest model was used to predict yield based on the site-specific soil, climate, and input variables. Second, the three objective functions were computed using these predicted yields. Third, constraints were enforced via a penalty function that penalized infeasible allocations. Because observations from the same location may exhibit temporal dependence, the rolling historical yield feature was constructed exclusively from preceding production records, and all preprocessing, feature engineering, and model fitting were completed within the training workflow before evaluation on the untouched test set, thereby preventing temporal and feature leakage.

2.5 Scenario Analysis

Three distinct scenarios were simulated to evaluate algorithm performance under varying conditions. The baseline scenario represents current conditions projected for the year 2025, incorporating present climate patterns, market prices, and resource availability. The climate change scenario models conditions expected around 2050, featuring a $2 \ ^{\circ} \mathrm{C}$ temperature increase and a rainfall reduction of 15\%, based on the Intergovernmental Panel on Climate Change (IPCC) Representative Concentration Pathway 4.5 scenario, downscaled for West Africa using data from the Nigerian Meteorological Agency. The policy intervention scenario introduces a 30\% fertilizer subsidy, which reduces effective crop costs by lowering the fertilizer cost component within the overall expense structure.

2.6 Performance Metrics

Six performance metrics were employed to compare algorithms comprehensively. Yield prediction accuracy for the random forest model was assessed using $R^2$, root mean square error, and mean absolute error. Optimization performance was evaluated using optimality, defined consistently for all algorithms relative to a common benchmark objective under identical comparison conditions. Convergence speed was recorded as the number of iterations required to reach 95\% of the final fitness value. Computational time was measured in seconds per optimization run, with all experiments conducted on an Intel i7-12700H processor equipped with 32 gigabytes of random-access memory. Robustness was quantified as the standard deviation of solution quality over 30 independent runs. Finally, food security impact was evaluated using two indicators: the percentage of caloric requirements met and a dietary diversity score representing the number of distinct crops present in the optimal mix.

Optimality measures optimization performance rather than prediction accuracy. For the weighted multi-objective maximization problem, it is computed as:

\[\text { Optimality }(\%)=\frac{Z_{\text {alg }}}{Z_{\text {bench }}} \times 100\]

where, $Z_{\text {alg }}$ denotes the weighted objective value obtained by a given optimization algorithm, and $Z_{\text {bench }}$ denotes the benchmark objective value obtained under identical resource constraints.

Two complementary evaluation protocols were employed. In the controlled benchmark (Section 3.3.1), a single random forest-predicted yield matrix was generated and supplied to all six optimization algorithms together with identical objective function weights, resource constraints, initialization settings, stopping criteria, and computational conditions. The benchmark objective was defined as the highest feasible weighted objective value obtained under these common conditions. In the integrated benchmark (Section 3.2), the hybrid particle swarm optimization random forest framework dynamically updated site-specific yield estimates during optimization, while the reported optimality values remained referenced to the same benchmark objective for comparison purposes. The same definition was applied to linear programming, integer linear programming, genetic algorithm, particle swarm optimization, ant colony optimization, and particle swarm optimization-random forest. Thus, optimality does not represent prediction accuracy and is not based on separate “true optimum” or “best-known solution” values for different algorithm classes.

Consequently, $R^2$, root mean square error, and mean absolute error were used to evaluate random forest prediction accuracy, whereas optimality was used to evaluate optimization quality under a common comparison framework.

2.7 Decision Support System Architecture

A web-based decision support system was developed as a research prototype to demonstrate the practical implementation of the proposed particle swarm optimization-random forest optimization framework. The prototype was implemented using Streamlit as the user interface, a Python-based optimization engine, and Plotly for interactive visualization [27]. Users can select a Nigerian state, specify farm size, budget, and objective-function priorities before generating optimized land-allocation recommendations together with projected profit, water use, and caloric production. Although the prototype is fully functional within the research environment, it has not yet been deployed as a publicly hosted application. Future work will integrate real-time forecast services provided by the Nigerian Meteorological Agency and expand validation through stakeholder testing prior to public deployment [28-29]. Figure 1 shows the architectural flow design of the agricultural planning decision support system.

Figure 1. Architectural flow design
Note: GUI = Graphical User Interface; LP = LINEAR PROGRAMMING; CBC = COIN-OR Branch and Cut.

3. Results

3.1 Predictive Performance of the Random Forest Model

The predictive performance of the random forest model was evaluated across five major staple crops: maize, rice, cassava, yam, and sorghum. Model accuracy was assessed using $R^2$, root mean square error, and mean absolute error ( Table 2).

Feature importance analysis was also conducted to identify the major factors influencing crop yield predictions. Seasonal rainfall was identified as the most influential predictor, contributing 24.3\% of the total feature importance, followed by soil nitrogen (18.7\%), historical yield (15.2\%), fertilizer application (12.1\%), average temperature (9.8\%), and soil pH (7.4\%). The remaining variables collectively accounted for 12.5\%.

3.2 Comparative Performance of Optimization Algorithms

All algorithms successfully produced feasible solutions. The optimization performance reported in this section should be interpreted separately from the random forest prediction results presented in Section 3.1. Prediction accuracy is evaluated using $R^2$, root mean square error, and mean absolute error, whereas optimality represents optimization performance relative to the benchmark objective defined in Section 2.6. Table 3 evaluates the complete integrated particle swarm optimization-random forest decision-support framework under dynamic yield prediction, whereas the controlled comparison in Section 3.3.1 isolates optimization behavior by supplying an identical random forest-predicted yield matrix to every algorithm. Throughout the study, optimality (\%) refers exclusively to optimization performance relative to the common benchmark objective and should not be interpreted as a measure of random forest prediction accuracy. Figure 2 presents the comparative performance of optimization algorithms.

Table 2. Predictive performance of the random forest model across five staple crops
CropCoefficient of Determination ($R^2$) (Test Set)Root Mean Square Error (kg/ha)Mean Absolute Error (kg/ha)Error (\% of Mean Yield)
Maize0.9681721287.8
Rice0.9721981496.9
Cassava0.9756144675.1
Yam0.9637585817.0
Sorghum0.959125968.2
Weighted mean0.968373.4284.26.8
Table 3. Comparative algorithm performance (30 runs, baseline scenario)
AlgorithmOptimality (\%)Convergence (Iterations)Time (s)Robustness (Standard Deviation, \%)
Linear programming (weighted sum)92.0N/A0.310.0
Integer linear programming95.0N/A2.100.0
Genetic algorithm87.841245.23.2
Particle swarm optimization90.632732.12.5
Ant colony optimization84.548978.34.1
Particle swarm optimization-random forest97.129541.31.8
Note: N/A = Not applicable; convergence iterations are not applicable to the linear programming methods.
Figure 2. Comparative performance of optimization algorithms
Note: LP = Linear programming; ILP = Integer linear programming; GA = Genetic algorithm; PSO = Particle swarm optimization; ACO = Ant colony optimization; PSO-RF = Particle swarm optimization-random forest; SD \% = standard deviation, \%.

Linear programming achieved an optimality value of 92.0\% under the common benchmark definition, while integer linear programming achieved 95.0\%. The hybrid particle swarm optimization-random forest framework recorded 97.1\%, with genetic algorithm, particle swarm optimization, and ant colony optimization recording 87.8\%, 90.6\%, and 84.5\%, respectively. These values represent the weighted objective value obtained by each algorithm relative to the common benchmark objective under the specified comparison framework; they should not be interpreted as prediction accuracy or as percentage gaps from separately defined true or best-known optima.

Regarding convergence behavior, the particle swarm optimization-random forest framework reached the predefined convergence threshold after 295 iterations, compared with 327 iterations for particle swarm optimization, 412 iterations for genetic algorithm, and 489 iterations for ant colony optimization. These values represent the iterations required to reach 95\% of the final fitness value, as defined in Section 2.6. The results indicate that particle swarm optimization-random forest converged faster than the other population-based metaheuristic algorithms evaluated in the baseline benchmark. However, convergence speed should be interpreted alongside solution quality, computational time, and robustness when assessing overall algorithm performance.

3.3 Baseline Optimal Agricultural Plan (1,000 ha, Southwest Nigeria)

The baseline optimal agricultural plan was developed using the proposed hybrid particle swarm optimization-random forest framework for a 1,000-ha agricultural area in Southwest Nigeria. Table 4 presents the optimized land allocation across five staple crops, together with the corresponding production yields, revenues, costs, and profits.

Table 4. Optimal crop allocation derived from the hybrid particle swarm optimization-random forest framework
CropArea (ha)Land Allocation (\%)Yield (tons)Revenue ($\text{₦}$ million)Cost ($\text{₦}$ million)Profit ($\text{₦}$ million)
Cassava400405,200780120660
Maize30030675337.5105232.5
Rice2002050030090210
Yam100101,00040050350
Sorghum000000
Total1,0001007,3751,817.53651,452.5

The total production expenditure associated with the optimized allocation was calculated as follows:

\[ C_{\text {total }}=120+105+90+50=\text{₦} 365\ \mathrm{million} \]

The optimized allocation therefore satisfied the revised production-budget constraint because $\text{₦}365$ million $\leq$ $\text{₦}400$ million. The resulting unused budget capacity was $\text{₦}35$ million, corresponding to 8.75\% of the total planning budget. Budget utilization was calculated as follows:

\[\frac{365}{400} \times 100=91.25 \%\]

To verify whether the optimized agricultural plan satisfied the minimum food security requirement, total caloric production was calculated using the crop production quantities reported in Table 4 and the corresponding caloric conversion factors. The results are presented in Table 5.

Table 5. Verification of caloric production from optimized crop outputs
CropProduction (kg)Caloric Conversion Factor (kcal/kg)Total Caloric Production (kcal)
Cassava5,200,0001,560$8.112 \times 10^9$
Maize675,0003,650$2.464 \times 10^9$
Rice500,0003,540$1.770 \times 10^9$
Yam1,000,0001,180$1.180 \times 10^9$
Sorghum03,3900
Total7,375,000\text{---}$13.526 \times 10^9$
Note: --- = Not applicable; the caloric conversion factor is crop-specific and is therefore not summed in the total row.
3.3.1 Controlled comparison using common yield inputs

To verify that the original comparison did not unfairly favor the hybrid framework, a controlled benchmark was performed using a common random forest-predicted yield matrix for all algorithms. Under this protocol, linear programming, integer linear programming, genetic algorithm, particle swarm optimization, ant colony optimization, and the particle swarm optimization engine within the hybrid framework solved exactly the same optimization problem with identical predicted yields. For consistency, the optimality values in Table 6 were calculated using the same common benchmark definition given in Section 2.6 and therefore do not represent gaps relative to a separate true optimum or best-known solution.

Table 6. Controlled comparison of optimization algorithms using identical random forest-predicted yields
AlgorithmOptimality (\%)Convergence (iterations)Time (s)
Linear programming (weighted sum)95.1N/A0.34
Integer linear programming96.0N/A2.18
Genetic algorithm93.433846.1
Particle swarm optimization95.323633.0
Ant colony optimization91.840179.1
Particle swarm optimization (common random forest yields)95.323633.0
Note: N/A = Not applicable; convergence iterations are not applicable to the linear programming methods.

The controlled benchmark substantially reduced the performance gap observed in the integrated comparison. Under identical predicted-yield conditions, particle swarm optimization converged faster than genetic algorithm and ant colony optimization while producing solutions comparable to the exact linear programming and integer linear programming formulations. This demonstrates that the additional improvement reported for the integrated particle swarm optimization-random forest framework primarily arises from incorporating dynamic, site-specific yield prediction into the optimization workflow rather than from replacing the underlying particle swarm optimization engine. The distinction between Table 3 and Table 6 therefore separates the contribution of machine learning-enhanced yield estimation from that of the optimization engine, providing a logically consistent basis for interpreting the reported optimality values.

3.3.2 Sensitivity analysis of objective weights

Because the weighted sum formulation depends on stakeholder preferences, a sensitivity analysis was conducted to examine how changes in the objective weights influence the optimal crop allocation. The baseline configuration ($w_P=0.5, w_W=0.3$, and $w_C=0.2$) was derived from the stakeholder survey. Three additional scenarios were evaluated while keeping the predicted yield matrix, resource constraints, and particle swarm optimization-random forest parameters unchanged.

The sensitivity analysis in Table 7 demonstrates that the proposed particle swarm optimization-random forest framework responds to changes in stakeholder preferences by producing different trade-offs among profitability, water consumption, and caloric production. Under the profit-oriented scenario, the optimized allocation generated the highest reported profit of 1,498 million and the highest caloric production of $14.277 \times 10^9 \ \mathrm{kcal}$, although water consumption increased to 4.05 million $\mathrm{m}^3$. The water-oriented scenario reduced water consumption to 2.94 million $\mathrm{m}^3$, representing an approximately 23\% reduction relative to the baseline, while maintaining caloric production of $10.151 \times 10^9 \ \mathrm{kcal}$. The food-security-oriented scenario produced $13.388 \times 10^9 \ \mathrm{kcal}$, which exceeded the minimum annual caloric requirement but remained below the outputs of both the baseline and profit-oriented scenarios.

Table 7. Sensitivity of the optimal agricultural plan to objective function weights
ScenarioObjective weights (Profit, Water, Calories)Optimal Land Allocation (ha)Profit ($\text{₦}$ million)Water (million m$^3$)Calories Production ($\boldsymbol{\times 10^9}$ kcal)
Baseline(0.5, 0.3, 0.2)C400, M300, R200, Y100, S01,452.53.8213.526
Profit-oriented(0.7, 0.1, 0.2)C450, M250, R150, Y150, S01,498.04.0514.277
Water-oriented(0.2, 0.6, 0.2)C250, M350, R100, Y0, S3001,188.02.9410.151
Food-security-oriented(0.2, 0.2, 0.6)C380, M250, R250, Y120, S01,385.04.1813.388
Note: C = Cassava; M = Maize; R = Rice; Y = Yam; S = Sorghum. Caloric production values were recalculated directly from the optimized crop outputs and the crop-specific caloric conversion factors defined in Section 2.2, ensuring consistency with the reported optimization results.

These results indicate that assigning the greatest weight to food security does not necessarily produce the highest caloric output under a weighted-sum multi-objective formulation. The resulting allocation reflects the combined influence of all objective weights, resource constraints, and crop-specific production characteristics. Therefore, the food-security-oriented scenario should be interpreted as a preference-weighted compromise rather than the solution that maximizes caloric production independently. The results also demonstrate the importance of distinguishing between satisfying the minimum food-security constraint and maximizing caloric production. All reported scenarios exceed the minimum annual requirement of $4.5625 \times 10^9 \ \mathrm{kcal}$ for the target population of 5,000 persons.

The optimized 1,000 ha allocation produced $13.526 \times 10^9 \ \mathrm{kcal}$, calculated directly from the optimized crop production and the caloric conversion factors defined in Section 2.2. Compared with the annual caloric requirement of $4.5625 \times 10^9 \ \mathrm{kcal}$ for 5,000 persons, this production is sufficient to satisfy approximately 296\% of the annual requirement, representing a 196\% surplus above the minimum food security threshold. The optimized crop mix includes four major staple crops cassava, maize, rice, and yam, thereby improving dietary diversity while satisfying all imposed land, budget, water, and food-security constraints.

The optimized allocation produced 7.375 million kg of crop output while consuming 3.82 million $\mathrm{m}^3$ of seasonal water, resulting in a water use efficiency of $1.93 \mathrm{~kg} / \mathrm{m}^3$. This value was calculated as total crop production divided by total seasonal water consumption, ensuring unit consistency throughout the analysis. Because the caloric production values reported above were derived from the same optimized crop outputs, the reported resource efficiency indicators and food-security metrics were based on a single, internally consistent computational framework.

3.4 Climate Change Scenario (2050)

The climate change scenario for 2050 was evaluated under the assumptions of a uniform temperature increase of 2.0 $^{\circ} \mathrm{C}$ and a 15\% reduction in rainfall relative to baseline conditions. The carbon dioxide fertilization effect was not considered in the analysis. Table 8 presents the baseline and projected 2050 crop yields predicted by the random forest model, together with the corresponding percentage changes. Table 9 presents the resulting crop reallocation under the 2050 climate change scenario compared with the baseline allocation.

Table 8. Projected changes in crop yields under the 2050 climate change scenario
CropBaseline Yield (kg/ha)2050 Yield (kg/ha)Change (\%)
Maize2,2501,913$-15.0$
Rice2,5002,125$-15.0$
Cassava13,00011,050$-15.0$
Yam10,0008,600$-14.0$
Sorghum1,3001,170$-10.0$
Table 9. Optimal crop reallocation under the 2050 climate change scenario
CropBaseline Area (ha)Climate Area (ha)Change (ha)
Cassava400320$-80$
Maize300220$-80$
Rice200150$-50$
Yam10060$-40$
Sorghum0250$+250$ (new)

The caloric production under the climate-adapted allocation was calculated using the crop-specific 2050 yields and caloric conversion factors defined in Section 2.2. The resulting caloric production was compared with the fixed minimum annual requirement of $4.5625 \times 10^9 \ \mathrm{kcal}$ for 5,000 persons. Accordingly, food security status was determined using the following condition:

\[C_{\text {climate }}=\sum x_i^{2050} y_i^{2050} k_i \geq 4.5625 \times 10^9\]

This condition provides a direct and consistent basis for determining whether the climate-adapted allocation satisfies the minimum food-security constraint. Under the 2050 climate change scenario, total nominal profit declined to \text{₦}1,163 million, representing a 20.0\% reduction from the baseline profit of \text{₦}1,453 million. Despite this decline, caloric production declined substantially under the climate change scenario but remained sufficient to satisfy the minimum food security constraint defined in Section 2.2, although the food security margin was considerably reduced relative to the baseline optimized scenario. Water consumption decreased to 3.01 million $\mathrm{m}^3$, a $21 \%$ reduction attributed to a shift away from cassava toward more sorghum in the optimal crop mix. Overall food security status was maintained under the climate change scenario, although the safety buffer was substantially reduced relative to the baseline optimized scenario, reflecting the decline in caloric production under future climate conditions despite adaptive crop reallocation.

3.5 Policy Scenario: Fertilizer Subsidy

The policy intervention scenario assumed that a 30\% fertilizer subsidy was applied exclusively to NPK fertilizer, reducing fertilizer costs per hectare by approximately 12\% to 18\%, depending on the crop. Under this subsidy regime, the optimal fertilizer application increased by 22\% on average, rising from 85 kg/ha in the baseline to 104 kg/ha. Corresponding yield increases varied by crop due to diminishing returns: maize experienced a 15\% yield improvement, rice gained 12\%, and cassava saw a 9\% increase. After accounting for the cost of the subsidy to the government, the net annual profit increase for a 1,000-ha farm scale reached \text{₦}142 million. In terms of cost-effectiveness, the subsidy generated an additional \text{₦}1.42 million in profit for every \text{₦}10 million of government subsidy expenditure.

3.6 Illustrative Output of the Decision Support System

The web-based decision support system generates interactive outputs based on user-specified farm characteristics, budget, and objective function priorities. A representative 500-ha farm was considered. The decision support system recommended allocating 180 ha to cassava, 150 ha to maize, 100 ha to rice, and 70 ha to yam. The economic feasibility of this allocation was assessed using the crop production cost estimates reported in Table 4. Based on the specified cost coefficients, the estimated production expenditure for cassava was \text{₦}54,000,000, corresponding to 180 ha at \text{₦}300,000/ha. Maize production required \text{₦}52,500,000 for 150 ha at \text{₦}350,000/ha, while rice production required ₦45,000,000 for 100 ha at \text{₦}450,000/ha. The allocation of 70 ha to yam required an additional \text{₦}35,000,000 at \text{₦}500,000/ha. The total estimated production expenditure was therefore \text{₦}186,500,000 for the 500-ha farm.

Caloric production was calculated using the crop-specific yields and caloric conversion factors defined in Section 2.2. The estimated production was $2,340,000 \mathrm{~kg}$ of cassava, $337,500 \mathrm{~kg}$ of maize, $250,000 \mathrm{~kg}$ of rice, and $700,000 \mathrm{~kg}$ of yam. Multiplying each crop's production by its corresponding caloric conversion factor and summing across the four crops yielded a total estimated annual caloric production of 6.593275 $\times 10^9 \mathrm{kcal}$, or approximately $6.593 \times 10^9 \mathrm{kcal}$. The annual caloric requirement for 5,000 persons, assuming $2,500 \mathrm{kcal}$ per person per day for 365 days , was $4.5625 \times 10^9 \mathrm{kcal}$. The estimated decision support system output therefore represented approximately 144.5\% of this requirement, corresponding to a surplus of approximately 44.5\% above the minimum requirement. Dividing the estimated total caloric production by the annual requirement per person yielded an equivalent population coverage of approximately 7,225 persons under the same dietary energy assumption. This estimate represents theoretical annual caloric equivalence rather than a guarantee that the food produced would be available to, or consumed by, that number of people.

Figure 3. Overall research framework and principal findings of the proposed hybrid optimization approach
Note: PSO-Random Forest = Particle Swarm Optimization-Random Forest (PSO-RF); NiMet =Nigerian Meteorological Agency; FAO = Food and Agriculture Organization; NBS = National Bureau of Statistics; RMSE = root mean square error.

The dashboard also reports projected profit and seasonal water consumption associated with the recommended allocation, together with a graphical representation of crop distribution. These outputs are intended to support agricultural planning and resource-allocation decisions. The reported values should be interpreted as model-based projections under the specified yield, price, and resource assumptions rather than as independently verified field outcomes. Figure 3 illustrates the overall research framework and summarizes the principal findings of the proposed hybrid particle swarm optimization-random forest approach.

4. Discussion

This research demonstrates that a hybrid particle swarm optimization-random forest optimization framework significantly outperforms conventional algorithms for agricultural planning in Nigeria. Three findings are particularly noteworthy. First, the random forest yield predictor achieved exceptional accuracy, with an $R^2$ of 0.968 and a mean prediction error of 6.8\% of the mean yield. This surpasses previous crop yield models for Sub-Saharan Africa, which typically report $R^2$ values of 0.70–0.85 [9]. The high performance is attributable to the inclusion of soil nutrient data which alone explained 18.7\% of variance, spatial resolution of $0.1^{\circ}$ grid capturing local rainfall gradients, and the random forest algorithm's ability to handle nonlinear interactions such as temperature × rainfall × soil type. For operational planning, these findings suggest that stakeholders can use model predictions with greater confidence, reducing the need for extensive ground-truthing.

Second, under the common benchmark definition of optimality, the integrated particle swarm optimization-random forest framework achieved 97.1\%, while the controlled common-yield experiment recorded 95.3\% for the particle swarm optimization engine. These values should be interpreted as relative weighted-objective performance under the specified benchmark conditions rather than as measures of random forest prediction accuracy. The improvement stems from random forest's dynamic yield predictions: whereas linear programming and particle swarm optimization use fixed yield parameters, the hybrid allows yields to vary with soil and climate conditions across the farm, enabling more nuanced land allocation. This result aligns with recent findings in precision agriculture [30] and suggests that coupling machine learning with metaheuristics is a promising direction for agricultural optimization.

Third, the optimized plan generated approximately $13.526 \times 10^9 \ \mathrm{kcal}$, satisfying about 296\% of the annual caloric requirement for the target population while maintaining a water use efficiency of $1.93 \ \mathrm{~kg}/\mathrm{m}^3$. This demonstrates that the proposed multi-objective optimization framework can simultaneously improve food security and resource efficiency. This finding supports the argument that balancing economic return, water conservation, and food security through weighted multi-objective optimization can reduce the tradeoffs commonly observed in single-objective planning approaches.

The comparison between Table 3 and Table 6 demonstrates that two complementary sources of performance contribute to the proposed framework. The controlled benchmark confirms that particle swarm optimization remains a competitive optimizer under identical yield information, while the additional gains observed in the original particle swarm optimization-random forest results arise from incorporating sitespecific yield predictions that enable more adaptive land allocation decisions across heterogeneous Nigerian production environments. This distinction clarifies that the reported improvements are attributable to the combined machine learning and optimization framework rather than to differences in optimization inputs alone. This research also demonstrates that the proposed particle swarm optimization-random forest framework combines two complementary strengths: accurate yield prediction and effective multi-objective optimization. The random forest model achieved a weighted mean $R^2$ of 0.968 , with a root mean square error of $373.4 \mathrm{~kg} / \mathrm{ha}$, a mean absolute error of $284.2 \mathrm{~kg} / \mathrm{ha}$, and an average prediction error of $6.8 \%$ of mean yield, indicating reliable site-specific yield estimation across the three agro-ecological zones. Separately, the integrated particle swarm optimization-random forest optimization framework achieved 97.1\% optimality under the common benchmark evaluation, demonstrating superior solution quality relative to the competing optimization methods.

4.1 Implications for Policy and Practice

For Nigerian policymakers at the Federal Ministry of Agriculture and Food Security, it is recommended that the hybrid particle swarm optimization-random forest model be adopted as the analytical backbone for zonal agricultural planning. This model should be executed quarterly, ingesting seasonal forecasts from the Nigerian Meteorological Agency to dynamically adjust planting recommendations in response to predicted rainfall patterns and temperature anomalies. The empirical finding that a 30\% fertilizer subsidy increases yields by 12\% to 15\%, yielding approximately \text{₦}1.42 million in profit per \text{₦}10 million of subsidy, represents a strong return on investment. However, this return is conditional on targeting subsidies exclusively to areas where random forest feature importance analysis identifies soil nutrient deficits—particularly nitrogen and phosphorus—as the primary yield-limiting factor. Untargeted subsidies are unlikely to replicate this efficiency. Furthermore, the Ministry should mandate integration of this decision support system with the Nigeria Incentive-Based Risk Sharing System for Agricultural Lending (NIRSAL) platform, such that loan approvals are contingent on the submission of an optimized, climate-adaptive planting plan. This linkage directly reduces lender risk while incentivizing borrower adherence to agronomically sound practices.

The decision support system has been implemented as a fully functional research prototype within the study environment and is intended for demonstration and future deployment as a mobile-responsive application following stakeholder validation. For agricultural extension services, the extension agents are encouraged to deploy the tool during routine farm visits, generating tailored planting plans for individual farmers or entire cooperatives in real time. For a representative 1,000-ha cooperative, the optimal land allocation calls for 40\% cassava, a high-profit but highly perishable crop. To realize this profit without incurring post-harvest losses, farmer cooperatives must simultaneously invest in on-site or shared processing infrastructure, including facilities for garri production and high-quality cassava flour manufacturing. Such processing extends shelf life from days to months and captures downstream value. Looking toward mid-century climate scenarios, the model projects that by 2050, sorghum should expand from its current negligible area to 25\% of cultivated land. Consequently, extension services should begin immediate, proactive promotion of improved sorghum varieties (including drought-tolerant and early-maturing types) alongside training in appropriate processing techniques such as threshing, decortication, and hermetic storage.

The architectural design of the decision support system is readily transferable to other West African countries, requiring only the retraining of the random forest models with local soil geochemistry data, historical climate records, and crop yield observations. For agricultural researchers, they are encouraged to prioritize two major extensions to the current system. The first is the incorporation of livestock integration logic, given Nigeria’s estimated 20 million cattle and 80 million goats. This would enable joint optimization of cropland allocation and forage or residue management, closing nutrient loops between crop and animal production systems. The second priority is the addition of a post-harvest logistics optimization module capable of minimizing losses for perishable commodities through facility location algorithms. A longer-term technical frontier involves replacing the static application programming interface inputs provided by the Nigerian Meteorological Agency with real-time data from Internet of Things (IoT) sensors, including soil moisture probes and on-farm weather stations. Such an upgrade would enable dynamic, intra-seasonal preplanning, allowing farmers to switch crop types or adjust planting densities in response to unfolding weather anomalies, rather than following a single pre-season plan.

5. Conclusions

This research successfully developed, implemented, and validated a hybrid particle swarm optimization-random forest framework for agricultural planning and food security in Nigeria. Using data from the Nigerian Meteorological Agency, the Food and Agriculture Organization, the National Bureau of Statistics, and national soil surveys, the random forest model achieved a weighted mean $R^2$ of 0.968 , with a root mean square error of $373.4\mathrm{~kg}/\mathrm{ha}$, a mean absolute error of $284.2 \mathrm{~kg}/\mathrm{ha}$, and an average prediction error of 6.8\% of mean yield. The integrated particle swarm optimization-random forest framework achieved the highest optimization performance among the evaluated methods, reaching 97.1\% optimality under the common benchmark. For the 1,000-ha Southwest Nigeria case study, the optimized allocation generated \text{₦}1.4525 billion annual profit, produced $13.526 \times 10^9 \mathrm{~kcal}$, satisfying approximately 296\% of the annual caloric requirement for 5,000 persons (equivalent to a 196\% surplus above the minimum requirement), while improving water-use efficiency to 1.93$\mathrm{~kg}/\mathrm{m}^3$, demonstrating that the optimized allocation provides a substantial food-security buffer under baseline conditions. Under the 2050 climate scenario, profit declined to \text{₦}1.163 billion, but adaptive crop reallocation maintained food security requirements.

6. Declaration on the Use of Generative AI and AI-assisted Technologies

Author Contributions

Conceptualization, N. S. M. and F. H.; methodology, N. S. M.; software, S. A. I.; validation, N. S. M., D. K., and S. A. I.; formal analysis, F. H.; investigation, F. H.; resources, N. S. M.; data curation, F. H.; writing---original draft preparation, N. S. M.; writing---review and editing, F. H.; visualization, S. A. I.; supervision, N. S. M.; project administration, N. S. M.; funding acquisition, N. S. M. All authors have read and agreed to the published version of the manuscript.

Data Availability

This study analyzed publicly available agricultural, climate, soil, and socioeconomic datasets compiled from multiple official sources. Climate variables, including rainfall and temperature records, were obtained from the Nigerian Meteorological Agency (NiMet). Crop yield and cultivated area statistics were obtained from the Food and Agriculture Organization (FAO FAOSTAT) and the National Bureau of Statistics (NBS) Agricultural Survey. Soil property data were obtained from the Nigeria Soil Information System (NSIS) and the FAO Harmonized World Soil Database, while supporting economic information was compiled from publicly available NBS and related agricultural reports.

The processed analytical dataset used for model training and optimization was created by harmonizing these publicly available sources for the study period. Redistribution of the original datasets remains subject to the licensing conditions of their respective providers. The processed dataset, Python implementation of the optimization framework, and supporting analysis scripts are available from the corresponding author upon reasonable request for research and verification purposes.

Acknowledgments

The researchers hereby acknowledge Taraba State University Jalingo for the enabling environment to carry out the research successfully.

Conflicts of Interest

The authors declare no conflicts of interest.

The authors used AI-assisted tools to support the editing of portions of this manuscript, including improving language quality and sentence structure. The AI tools were not used for data collection, data analysis, statistical analysis, or the formulation of scientific conclusions. Every AI-generated suggestion was critically evaluated, edited, and validated by the authors. The authors accept full responsibility for the accuracy, authenticity, and integrity of all content in this article.

References
1.
Nigerian Meteorological Agency (NiMet), “Seasonal rainfall prediction report,” Tech. Rep., 2025. [Google Scholar]
2.
Food and Agriculture Organization (FAO), “FAOSTAT statistical database,” 2025. [Google Scholar]
3.
National Bureau of Statistics (NBS), “Agricultural survey report 2023,” Tech. Rep., 2024. [Google Scholar]
4.
B. Das, S. Shukla, F. Davenport, G. Husak, C. Funk, K. Tabor, J. Rowland, M. Budde, and J. Verdin, “Comparative crop yield forecasting using satellite-derived biophysical and agro-climatic predictors in Sub-Saharan Africa,” Remote Sens. Appl. Soc. Environ., vol. 43, p. 102222, 2026. [Google Scholar] [Crossref]
5.
H. Fawzi, S. A. Mostafa, D. Ahmed, N. Alduais, M. A. Mohammed, and M. Elhoseny, “TOQO: A new tillage operations quality optimization model based on parallel and dynamic decision support system,” J. Clean. Prod., vol. 316, p. 128263, 2021. [Google Scholar] [Crossref]
6.
O. A. Abisoye, J. A. Adedokun, B. O. Abisoye, O. L. Lawal, J. A. Olajire, and M. Kama, “Particle swarm optimization–Random forest weather-based crop yield prediction model,” Univ. Ibadan J. Sci. Log. ICT Res., vol. 15, no. 1, pp. 57–68, 2025. [Google Scholar]
7.
S. M. Shawon, F. B. Ema, A. K. Mahi, F. L. Niha, and H. T. Zubair, “Crop yield prediction using machine learning: An extensive and systematic literature review,” Smart Agric. Technol., vol. 10, p. 100718, 2025. [Google Scholar] [Crossref]
8.
M. T. Linaza, J. Posada, J. Bund, P. Eisert, M. Quartulli, J. Döllner, A. Pagani, I. G. Olaizola, A. Barriguinha, T. Moysiadis, and others, “Data-driven artificial intelligence applications for sustainable precision agriculture,” Agronomy, vol. 11, no. 6, p. 1227, 2021. [Google Scholar] [Crossref]
9.
S. Alimagham, M. P. van Loon, J. Ramirez-Villegas, H. N. C. Berghuijs, T. S. Rosenstock, and M. K. van Ittersum, “Integrating crop models and machine learning for projecting climate change impacts on crops in data-limited environments,” Agric. Syst., vol. 228, p. 104367, 2025. [Google Scholar] [Crossref]
10.
M. Randall, K. Schiller, A. Lewis, J. Montgomery, and M. S. Alam, “A systematic review of crop planning optimisation under climate change,” Water Resour. Manag., vol. 38, no. 6, pp. 1867–1881, 2024. [Google Scholar] [Crossref]
11.
Y. L. Gavasso-Rita, S. M. Papalexiou, Y. Li, A. Elshorbagy, Z. Li, and C. Schuster-Wallace, “Crop models and their use in assessing crop production and food security: A review,” Food Energy Secur., vol. 13, p. e503, 2024. [Google Scholar] [Crossref]
12.
R. D. S. G. Pontes, D. N. Brandão, F. L. Usberti, and L. S. de Assis, “Multi-objective models for crop rotation planning problems,” Agric. Syst., vol. 219, p. 104050, 2024. [Google Scholar] [Crossref]
13.
P. Mohapatra, J. C. Paul, and S. S. Dash, “Multiobjective simulation–optimization of crop allocation and water resources in canal command areas using genetic algorithms,” Irrig. Drain., vol. 75, no. 4, pp. 1592–1608, 2026. [Google Scholar] [Crossref]
14.
M. von Bloh, D. Lobell, and S. Asseng, “Knowledge informed hybrid machine learning in agricultural yield prediction,” Comput. Electron. Agric., vol. 227, p. 109606, 2024. [Google Scholar] [Crossref]
15.
V. D. A. Kumar, Z. Thihlum, and A. K. Mohanty, “Explainable XGBoost model for crop recommendation in Mizoram using hybrid Random Forest and Particle Swarm Optimization,” Indian J. Agric. Sci., vol. 95, no. 11, pp. 1324–1331, 2025. [Google Scholar] [Crossref]
16.
G. Pal, S. Roy, J. K. Bag, and P. K. Pranav, “A comprehensive review of ML and optimization techniques in agricultural system modeling: A cybernetics perspective,” Comput. Electron. Agric., vol. 241, p. 111188, 2026. [Google Scholar] [Crossref]
17.
R. K. Dwivedi, R. Mishra, G. Dwivedi, and R. S. Solanki, “Risk-aware agricultural decision support system using ensemble machine learning models for predicting crop failures under climate variability and pest infestation scenarios,” Int. J. Agric. Nutr., vol. 7, no. 9, pp. 41–47, 2025. [Google Scholar] [Crossref]
18.
O. G. Ajayi, J. Ashi, and B. Guda, “Performance evaluation of YOLOv5 model for automatic crop and weed classification on UAV images,” Smart Agric. Technol., vol. 5, p. 100231, 2023. [Google Scholar] [Crossref]
19.
S. Sharma, K. M. Anirudh, B. R. Bakshi, S. Sandeep, H. Kodamana, and M. Ramteke, “Multi-objective optimization for sustainable agricultural strategies considering future climatic scenarios: A study in the context of India,” Comput. Chem. Eng., vol. 203, p. 109306, 2025. [Google Scholar] [Crossref]
20.
AFEX Commodities Exchange, “AFEX 2025 wet season crop production report,” Tech. Rep., 2025. [Online]. Available: https://www.afex.africa/reports/quarterly [Google Scholar]
21.
Nigeria Soil Information System (NSIS), “National soil survey data,” Tech. Rep., 2023. [Google Scholar]
22.
S. Begam, R. Jain, A. Arora, and S. Marwaha, “Multi-objective particle swarm optimization for regional crop planning,” Indian J. Agric. Sci., vol. 93, no. 2, pp. 237–240, 2023. [Google Scholar] [Crossref]
23.
D. Chen and Y. Huang, “Integrating reinforcement learning and large language models for crop production process management optimization and control through a new knowledge-based deep learning paradigm,” Comput. Electron. Agric., vol. 232, p. 110028, 2025. [Google Scholar] [Crossref]
24.
C. H. Chang, J. Lin, J. W. Chang, Y. S. Huang, M. H. Lai, and Y. J. Chang, “Hybrid deep neural networks with multi-tasking for rice yield prediction using remote sensing data,” Agriculture, vol. 14, no. 4, p. 513, 2024. [Google Scholar] [Crossref]
25.
G. Talukdar, R. K. Bhattacharjya, and A. K. Sarma, “Optimal cropping pattern based on short-term streamflow forecasts to improve agricultural economic benefits and crop productivity under uncertainty conditions,” Hydrol. Sci. J., vol. 68, no. 2, pp. 246–260, 2023. [Google Scholar] [Crossref]
26.
F. A. Fortin, F. M. De Rainville, M. A. Gardner, M. Parizeau, and C. Gagné, “DEAP: Evolutionary algorithms made easy,” J. Mach. Learn. Res., vol. 13, pp. 2171–2175, 2012. [Google Scholar]
27.
Y. Akkem, B. S. Kumar, and A. Varanasi, “Streamlit application for advanced ensemble learning methods in crop recommendation systems – a review and implementation,” Indian J. Sci. Technol., vol. 16, no. 48, pp. 4688–4702, 2023. [Google Scholar] [Crossref]
28.
J. Balderas, D. Chen, Y. Huang, L. Wang, and R. Li, “A comparative study of deep reinforcement learning for crop production management,” Smart Agric. Technol., vol. 10, p. 100853, 2025. [Google Scholar] [Crossref]
29.
H. Afzal, M. Amjad, A. Raza, K. Munir, S. G. Villar, L. A. D. Lopez, and I. Ashraf, “Incorporating soil information with machine learning for crop recommendation to improve agricultural output,” Sci. Rep., vol. 15, p. 8560, 2025. [Google Scholar] [Crossref]
30.
A. Kurniawan, T. R. Soeprobowati, and B. Warsito, “Hybrid PSO–ACO optimization for rice leaf disease classification using Random Forest and Support Vector Machines,” Int. J. Adv. Comput. Sci. Appl., vol. 16, no. 6, pp. 388–397, 2025. [Google Scholar] [Crossref]

Cite this:
APA Style
IEEE Style
BibTex Style
MLA Style
Chicago Style
GB-T-7714-2015
Mkegh, N. S., Haruna, F., Kyado, D., & Iorhemen, S. A. (2026). A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria. Inf. Dyn. Appl., 5(3), 142-156. https://doi.org/10.56578/ida050301
N. S. Mkegh, F. Haruna, D. Kyado, and S. A. Iorhemen, "A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria," Inf. Dyn. Appl., vol. 5, no. 3, pp. 142-156, 2026. https://doi.org/10.56578/ida050301
@research-article{Mkegh2026AHP,
title={A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria},
author={Nengem Stephen Mkegh and Friday Haruna and Doris Kyado and Samuel Ayua Iorhemen},
journal={Information Dynamics and Applications},
year={2026},
page={142-156},
doi={https://doi.org/10.56578/ida050301}
}
Nengem Stephen Mkegh, et al. "A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria." Information Dynamics and Applications, v 5, pp 142-156. doi: https://doi.org/10.56578/ida050301
Nengem Stephen Mkegh, Friday Haruna, Doris Kyado and Samuel Ayua Iorhemen. "A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria." Information Dynamics and Applications, 5, (2026): 142-156. doi: https://doi.org/10.56578/ida050301
MKEGH N S, HARUNA F, KYADO D, et al. A Hybrid Particle Swarm Optimization-Random Forest Framework for Multi-Objective Agricultural Planning and Food Security in Nigeria[J]. Information Dynamics and Applications, 2026, 5(3): 142-156. https://doi.org/10.56578/ida050301
cc
©2026 by the author(s). Published by Acadlore Publishing Services Limited, Hong Kong. This article is available for free download and can be reused and cited, provided that the original published version is credited, under the CC BY 4.0 license.