Mathematical Modeling and Optimization Studies by Artificial Neural Network, Genetic Algorithm and Response Surface Methodology: A Case of Ferric Sulfate–Catalyzed Esterification of Neem (Azadirachta indica) Seed Oil

High free fatty acids (FFA) content in oils poses challenges such as soap formation and difficulty in the separation of by-products in direct transesterification of oil to biodiesel, which is of environmental concern and also increases the cost of production. Thus, in this study, the ferric sulfate-catalyzed esterification of neem seed oil (NSO) with an FFA of 5.84% was investigated to reduce it to the recommended level of ≤1%. The esterification process for the NSO was modeled using response surface methodology (RSM) and artificial neural network (ANN). The effect of the pertinent process input variables viz. methanol/NSO molar ratio (10:1–30:1), ferric sulfate dosage (2–6 wt%), and reaction time (30–90 min) and their interactions on the reduction of the FFA of the NSO, were examined using Box Behnken design. The optimal condition for the process for reducing the FFA content of the oil was established using RSM and ANN-genetic algorithm (ANN-GA). The results showed that the models developed described the process accurately with the coefficient of determination (R2) of 0.9656 and 0.9908 and the mean relative percent deviation (MRPD) of 6.5 and 2.9% for RSM and ANN, respectively. The ANN-GA established the optimum reduction of FFA of 0.58% with methanol/NSO molar ratio of 18.51, ferric sulfate dosage of 6 wt%, and reaction time of 62.8 min as against the corresponding values of 0.62% FFA, 23.5, 5.03, and 75 min established by the RSM. Based on the statistics considered in the study, ANN and GA outperformed RSM in modeling and optimization of the NSO esterification process.


INTRODUCTION
In the past decade, considerable attention has been focused on renewable and sustainable alternative fuel by various governments and the scientific community because of the finite nature of fossil-based fuels, insecurity of supply, and attendant environmental concerns (Rashid et al., 2011;Merlin et al., 2015). Biodiesel is a potential alternative fuel considered as a credible replacement or supplement to fossil-based fuels in transportation and internal combustion engines (Sani et al., 2013). It is non-toxic, biodegradable, produces less combustion emission, and its usage in internal combustion engines does not require engine modifications (Niu et al., 2018;Ofoefule et al., 2019). Transesterification of triacylglycerides (from plant oils or animal fats or lipids from microalgae) and low molecular weight alcohol (methanol or ethanol) in the presence of a catalyst is the most commonly employed technology for biodiesel production (Gardy et al., 2017;Shan et al., 2018). Traditionally, most biodiesel production processes use refined vegetable oils as feedstock, which are expensive, often push up production cost (Marchetti, 2013;Karmee et al., 2015), and lead to food-energy competition (Betiku and Adepoju, 2013). Since the cost of feedstock accounts for 75-80% of the total operating cost of biodiesel production (Lisboa et al., 2014), lots of research efforts are focusing on the exploration of cheaper, non-edible feedstock alternatives (Rincón et al., 2014).
Previous studies have considered cheap alternatives such as waste cooking oil (Avinash and Murugesan, 2017), sorrel oil (Betiku and Ishola, 2020), rubber seed oil (Oladipo and Betiku, 2020), neem seed oil (NSO) (Merlin et al., 2015;Akhabue et al., 2020), African pear seed oil (Ofoefule et al., 2019), and Jatropha oil (Kamel et al., 2018). A key drawback of this feedstock, however, is their high free fatty acids (FFA) content that has to be reduced to ≤1% via acid-catalyzed esterification process (Gan et al., 2010). High FFA (>1%) favors soap formation (saponification) at the expense of transesterification, thereby leading to low biodiesel yield and difficult product separation (Betiku et al., 2016). Therefore, esterification of several nonedible plant oils with high FFA has been vigorously studied using homogeneous catalysts such as H 2 SO 4 (Kamel et al., 2018;Oladipo and Betiku, 2020). Although the reaction with homogeneous catalysts is fast and effective, the catalysts cannot be recycled (that is recovered and reused), which raises both environmental and high cost of biodiesel production concerns. To overcome this challenge, solid heterogeneous catalysts such as ferric sulfate (Gan et al., 2010;Betiku et al., 2017;Ighose et al., 2017;Ishola et al., 2017) and biomass-based materials such as Hura crepitans seed pod (Ogbu et al., 2018;Akhabue et al., 2020) have been proposed as possible replacements for homogeneous catalysts since they can be recovered and reused, making them environmentally benign and cost-effective in the production of biodiesel. Past reports have shown that the process input variables viz. alcohol/oil molar ratio, catalyst dosage, reaction time, and reaction temperature have significant effects on the reduction of FFA content of the oil through modeling of the esterification process (Betiku et al., 2015;Selvaraj et al., 2019).
Response surface methodology (RSM) is a statistical tool used for experimental design, modeling, and optimization of processes leading to acceptable results from a reduced number of experiments and cost . The tool analyzes all possible individual and interactive effects of the independent process factors (numeric or categoric) on the chosen response variable(s) and then develops a regression quadratic model to describe the process. Application of RSM in the design, modeling, and optimization of oil extraction, esterification, and transesterification processes are well documented (Jaliliannosrati et al., 2013;Halder et al., 2015;Ibrahim et al., 2019). Unlike RSM, artificial neural network (ANN) is a collection of biologically inspired (simplified model of human brains) mathematical techniques designed for machine learning, regression, and statistical analysis of often complex data (Shanmuganathan, 2016). It is a reliable alternative to RSM  with application in such areas as signal processing, pattern matching, image recognition, language processing, data mining, process modeling, and optimization (Abiodun et al., 2018). This computational tool consists of neuronal structure (neurons as processing elements and synaptic weights attached to the connections between neurons) to which a series of training and recall algorithms are attached. Feedforward and feedback neural network architectures are the more preferred network topology for reasons of processing speed, scalability, fault tolerance, and performance (Mozaffari et al., 2019). Its application to the modeling and optimization of biodiesel production has been investigated (Samuel and Okwu, 2019;Selvaraj et al., 2019).
Neem tree (Azadirachta indica) is a tropical evergreen tree that is native to Southeast Asia and is ubiquitous in the northern and western parts of Nigeria. Its seeds contain 25-45% non-edible oil, which has potential as a feedstock for biodiesel production via transesterification (Muthu et al., 2010;Oladipo et al., 2018). However, the presence of FFA >1% means that a pretreatment step via esterification is required (Akhabue et al., 2020). While some studies separately modeled the esterification and transesterification of NSO in a two-step biodiesel production process and then determined the optimum condition for maximum FFA reduction and biodiesel yield using either RSM or ANN for each step (Chhabra et al., 2020), others lumped the two processes together in their modeling and optimization studies (Oladipo et al., 2018) and simply determined the optimum biodiesel yield. There is a dearth of information in the literature on the comparison of modeling and optimization of the esterification process for neem oil with RSM, ANN, and genetic algorithm (GA), which is the aim of this current work.
Hence, this work focused solely on the ferric sulfate-catalyzed esterification of the oil from neem seeds, which had a high FFA as a pretreatment step. Also, the study evaluated the performance of RSM and ANN in the modeling of the esterification process. The effect of the pertinent individual process input variables (alcohol/oil molar ratio, catalyst dosage, and reaction time) and their interactions on the reduction of the FFA of the oil was investigated using a combination of Box Behnken design (BBD) and RSM. The bestoperating conditions for the minimization of the percent FFA were established using both RSM and GA.

Materials
The crude NSO used in this study was obtained from the National Research Institute for Chemical Technology in Zaria, Kaduna State, Nigeria. All chemicals and reagents used in this study are all analytical grade viz. methanol (99.8%), ethanol (99.7%), diethyl ether (99%), sulfuric acid (98%), ferric sulfate, Wij's solution, potassium hydroxide, and phenolphthalein manufactured by J.T. Baker (Phillipsburg, NJ, United States), BDH Chemicals., Poole England and GFS Chemicals, Inc., Columbus, OH, United States).

Neem Seed Oil Quality Characterization
The physicochemical and fuel properties of the NSO were determined using the AOAC protocols (AOAC, 1990). The acid value and %FFA were calculated for the crude and esterified NSO using Eqs. 1, 2, respectively in which V represents the volume of potassium hydroxide used during titration, and N is the normality of the same.

Description of the Esterification Process
Based on the experimental design, specific volume of the NSO was measured into a 500-ml three-necked glass flask which served as the reactor and was heated to a temperature of 100°C on a magnetic stirrer with a hot plate. Methanol was then added to the oil in the reactor and was allowed to mix for 5 min after ferric sulfate was added to the mixture. The temperature of the reaction was maintained at 65°C. At the end of the reaction, the product was transferred into a separating funnel, which was allowed to stand for 2 h. The surplus methanol left in the esterified NSO was removed via heating (Ishola et al., 2017).

Experimental Design, Model Development, and Optimization by Response Surface Methodology
In this study, the effects of process variables viz. methanol/NSO molar ratio, ferric sulfate dosage, and reaction time on the %FFA as the response variable, and mutual interactions, were examined by a three-level-three-factor BBD. Table 1 shows coded independent factors with their levels, which were used to produce 17 experimental conditions randomly executed in the laboratory. A second-order polynomial equation (Eq. 3) was regressed to develop the model for predicting the response variable (%FFA).
where, Y represents the predicted response (%FFA); α o is the intercept term; α 1 , α 2 , α 3 are the linear coefficients; α 12 , α 13 , α 23 are the interaction coefficients; α 11 , α 22 , α 33 are the quadratic coefficients; and X 1 , X 2 , X 3 are the coded independent variables. Equation 3 was subjected to multiple regressions to fit the coefficients to experimental data, the performance of the model was evaluated using the analysis of variance (ANOVA) and the test of significance. For the optimization, the desirability function approach was applied to solving the regressed quadratic equation to establish the optimum conditions to achieve the lowest %FFA. These conditions were then mimicked in the model validation experiments conducted in triplicates and the results were averaged and then compared with model-predicted %FFA as a way of assessing the predictive accuracy of the model. All procedures from experimental design, model development, and process optimization were carried out with the aid of the Statistica 10 software package (StatSoft, Inc., Tulsa, OK, United States).

Artificial Neural Network Model Development and Optimization
The modeling of the esterification process for the NSO by ANN was conducted using a feedforward, multilayer architecture, and a back-propagation, learning algorithm that was based on the Levenberg-Marquardt method. While Levenberg-Marquardt was used for data fitting and the number of hidden neurons was determined via iteration by testing several neural networks until the mean square error (MSE) value of the output was minimized, the neurons in the hidden layer are set up to sum up the weighted inputs and its associated bias. The hyperbolic tangent sigmoid (tansig) and pure linear (purelin) activation transfer function was respectively implemented for the hidden and output layers. Also, 70% of the experimental data was used for network training and 15% each for validation and testing to appraise the ability of the model to predict hidden data not used for training as well as its generalization capability (Ishola et al.,  2019; Betiku and Ishola, 2020). Furthermore, optimization of the process variables was carried out by coupling the ANN model with the GA. Details of the network configurations for the modeling and ANN-GA optimization are respectively shown in Tables 2, 3.

Sensitivity Analysis of Process Input Variables
For the RSM investigation, Eq. 4 was used to determine the influence of each input variable on the model based on the sum of squares (Ishola et al., 2019;Betiku and Ishola, 2020). While for ANN, the contribution level of each input variable was determined by Garson (1991) method as described by Eq. 5.

Contribution of input variable (%)
Sum of squares of variable Sum of squares for all variables (4) where, S j is the significance of the jth input variable on the output response. n h and n i are the number of hidden and input neurons, respectively. w represents the weight, while i, h, and o are the layers representing input, hidden, and output, respectively. k, m, and n represent input, hidden and output neurons, respectively.

Performance Assessment of Models
The two models obtained by RSM and ANN were subjected to statistical analysis to determine their effectiveness ( Table 4). Statistics such as the correlation coefficient (R), coefficient of determination (R 2 ), Adjusted R 2 , MSE, root MSE (RMSE), mean average error, standard error of prediction, mean relative percent deviation (MRPD). The details of the equations for determining the parameters have been described in our previous works (Betiku et al., 2016;Ishola et al., 2019).

Physicochemical Properties of Neem Seed Oil
The properties of the NSO used in this work are presented in Table 4. At room temperature, the NSO was a dark brownish colored liquid with a density of 947.9 kg/m 3 . The acid value (11.67 mg KOH/g oil) and FFA (5.94%) of the NSO differ from those reported in the literature (Akhabue et al., 2020;Chhabra et al., 2020). These may be due partly to the source of the seeds or the hydrolysis of the triglycerides. But the values are generally too high for one-step transesterification (Chhabra et al., 2020). These should be reduced to <2.0 mg KOH/g oil or ≤1% FFA to avoid soap formation and also ease the glycerine separation during biodiesel production . The saponification value of 186.53 mg KOH/g oil is high, indicating the tendency of NSO to form soap. The kinematic viscosity of 21.38 mm 2 /s suggests that the NSO is highly viscous and may tend to flow slowly due to this resistance to flow. The iodine value of 73.21 g I 2 /100 g points to a high level of unsaturation of fatty acids in the NSO. The acid value of 11.67 mg KOH/g oil of the NSO indicates that the oil requires s lots of alkali for its neutralization. The peroxide value of 1.53 meq/g oil suggests that the oil is not prone to rancidity, which means it has a long shelf life (Jisieike and Betiku, 2020). A value of 59.09 for cetane number indicates the aptness of NSO as a potential feedstock with good fuel quality.

Response Surface Methodology Model Description
Results from the ferric sulfate-catalyzed esterification of NSO as a pretreatment step in biodiesel production with the experimental conditions generated from the BBD are shown in Table 5. The NSO used and the esterified NSO together with the byproducts, that is, glycerol, excess methanol, and the catalyst, are displayed in Figure 2. Eq. 6 is the quadratic model equation developed via RSM to correlate the response variable (%FFA) to the independent variables in terms of the coded values. From Table 5, it can be seen that all the experimental conditions generated by the BBD and subsequently used to conduct experiments in the laboratory all led to significant reductions in the %FFA of the NSO.

Fit Statistics for the Response Surface Methodology Model
The ANOVA results indicated that the quadratic mathematical model obtained in this work is significant at p-value < 0.05 ( Table 6). The goodness of fit of the regression model was assessed by calculating the R and R 2 . The value of R (0.9826) of the model shows good agreement between the predicted and experimental values, which was also confirmed by the parity plot in Figure 3. The R 2 of 0.9656 suggests that only 3.44% of the total variation in the response is not described by the model . The adjusted R 2 (0.9215) and the predicted R 2 (0.9656) obtained showed that the values are in reasonable agreement with each other with an acceptable difference of 0.0441 (the maximum allowable difference is 0.2), which also shows the capability of the model to predict the response adequately. The model F-value of 21.86 and the p-value of ˂0.0003 imply that the model was statistically significant at a 95% confidence level (p < 0.05).
The F-value of 9.70 and the p-value of ˂0.0262 imply the lack of fit is not significant relative to the pure error, which is desirable ( Table 6). Also, the individual model terms were also tested using ANOVA at a 95% confidence level (p < 0.05), based on both the p-value and F-value, all the terms were significant except X 1 X 2 (interaction between methanol/NSO molar ratio and ferric sulfate dosage), X 1 X 3 (interaction between methanol/NSO molar ratio and reaction time), X 2 X 3 (interaction between ferric sulfate dosage and reaction time), X 2 2 (quadratic of ferric sulfate dosage) and X 2 3 (quadratic of reaction time). Adequate precision is generally used to measure the signal to noise ratio and a ratio greater than 4 is desirable. The ratio of 14.057 indicates an adequate signal, which shows that the model can be used to navigate the design space. Figure 4 displays the Pareto chart with the level of significance of all the model terms on the % FFA reduction. The length of each bar indicates the significance level of the variable it represents, any bar behind the reference line (p 0.05) denotes insignificance (Ishola et al., 2017). The chart shows that five out the total of nine model terms were significant at p < 0.05.  The chart shows that the linear term of methanol/NSO molar ratio was the most significant model term followed by the linear term of ferric sulfate dosage, the quadratic of methanol/NSO molar ratio, reaction time, and the quadratic of ferric sulfate dosage. Conversely, all the interaction terms and the quadratic of the reaction time are all insignificant. This observation is supported by the test of significance presented in Table 6.
The interactions among the process variables were investigated by the contour (2-D) and response surface (3-D) plots using the Statistica 10 software package ( Figure 5). The effect of methanol/NSO molar ratio and ferric sulfate dosage on the FFA of the NSO is displayed in Figure 5A. As the methanol/ NSO molar ratio increases with increasing ferric sulfate dosage, the %FFA decreases significantly. The lowest %FFA was observed at ferric sulfate dosage of 5.5 wt% and methanol/NSO molar ratio of 28:1. Beyond this point, %FFA was observed to increase. While Figure 5B shows the interactive effect of ferric sulfate dosage and reaction time, the effect of reaction time and methanol/NSO  November 2020 | Volume 8 | Article 614621 7 molar ratio on %FFA is displayed in Figure 5C. Figure 5C shows that the interaction of the variables has a significant effect on the %FFA.
%FFA was observed to be <0.7 at methanol/NSO molar ratio of 28:1 and reaction time of 90 min. Further increase in methanol/ NSO molar ratio beyond 28:1 was observed to cause an increase in the %FFA. The nature of the curvature of the three plots demonstrates that the three process input variables have a significant influence on the FFA reduction. Esterification of oil with alcohol is a reversible reaction controlled by the equilibrium of the reaction (Pasias et al., 2006); thus, the alcohol/oil molar ratio should be greater than the stoichiometric requirement to have a high reduction of the FFA of the oil (Marchetti and Errazu, 2008). This is evident in Figures 5A,B since the %FFA decreases as the methanol/NSO molar ratio increases. This observation is corroborated by the reports on esterification of castor oil (Karmakar et al., 2018) and NSO . The influence of the ferric sulfate dosage on the reduction of % FFA followed a similar trend with the methanol/NSO molar ratio, but the reaction time had less effect ( Figure 5).

Artificial Neural Network Model Description
After several trials, the best network structure chosen for the ANN modeling of the NSO esterification process consisted of an input layer of three neurons (methanol/NSO molar ratio, ferric sulfate dosage, and reaction time), an output layer of one neuron (%FFA) and a hidden layer of 10 neurons ( Figure 6). The responses predicted from the ANN model are as presented in Table 5. The R values of 0.9996, 0.9978, 0.9921, and 0.9954, respectively obtained from the plots of predicted versus experimental values for the training, testing, validation, and whole data sets indicated that there is a good correlation between the experimental and predicted values (Figure 7).
Also, the high values confirmed good generalization and predictive capability of the ANN model since it was able to predict the outputs of validation and testing data that were not part of the training set used to develop the model (Sarve et al., 2015;Ishola et al., 2019). The developed ANN model was further evaluated using R 2 . The value of 0.9958 suggests that 99.58% of the variations in both the experimental and predicted values can be explained, indicating a good fit of the model . The maximum values of R and R 2 possible are 1.0 and the higher the value the better. A model is deemed acceptable if R 2 ≥ 0.8 (Myers et al., 2016). The observation made in this work is supported by the ANN modeling of esterification of palm kernel oil using H 2 SO 4 as a catalyst, where high values of R and R 2 were also reported (Betiku et al., 2016).

Comparison of Performance of the Developed Models
The comparative performance of the models in terms of predictive accuracy for the esterification of NSO was evaluated using various fit statistics and the results obtained are presented in Table 7. The values of R, R 2 , and adjusted R 2 observed are very high for models obtained with RSM and ANN, indicating a good fit of the experimental data, though the ANN model had higher values than the RSM model. Also, MSE, root MSE, standard error of prediction, mean average error, and MRPD measure the error in the prediction of a model in comparison to the experimental data data Selvaraj et al., 2019). The ANN model had much lower error values compared to the RSM model. This observation is corroborated by the plots of the experimental against predicted values based on the R 2 of the models (Figure 8). The values predicted by the  To further visualize the performance of the developed models, the observed and predicted values were plotted against the experimental run numbers (Figure 9). The predicted values from the ANN model are very close to the experimental data better than the values predicted by the RSM model. Predictions by ANN models were superior to that of RSM models in the esterification of palm kernel oil (Betiku et al., 2016), transesterification of sorrel oil (Ishola et al., 2019), and transesterification of sesame oil (Sarve et al., 2015). Figure 10 shows the results of the sensitivity analysis for the models. The plot demonstrates the level of influence of each of the independent variables in the model. The results for both RSM and ANN followed the same trend. In both cases, the methanol/NSO molar ratio had the most influence on the %FFA, followed by ferric sulfate dosage and then the reaction time. The influence pattern in the ANN model is similar among the input variables compared to the RSM model. The order of influence exhibited in Figure 9 is supported by the F-values obtained for the variables. The F-values are 91.3767, 31.9443, and 22.7680 for methanol/NSO molar ratio, ferric sulfate dosage, and reaction time, respectively ( Table 6).

Establishment of Optimum Conditions and Model Validation
By solving the quadratic model equation (Eq. 6), the optimum values for the process input variables for the NSO esterification were determined by the RSM as methanol/NSO molar ratio of 23.5, reaction time of 75 min, and ferric sulfate dosage of 5.03 wt% with predicted %FFA of 0.63. The ANN-GA gave the condition as methanol/NSO molar ratio of 18.51, reaction time of 62.8 min, and ferric sulfate dosage of 6.0 wt.% with predicted %FFA of 0.53. To validate the developed models, the predicted values were used to carry out three independent experiments in the laboratory in each case, and the %FFA obtained were averaged, and the values obtained were reported ( Table 8). The reaction temperature was kept at 65°C in both cases for the laboratory experiments. The experimental %FFA obtained were 0.62 and 0.58 for RSM and ANN, respectively. The condition predicted by ANN-GA was better than the RSM predicted condition.  The superiority of ANN-GA over RSM has been demonstrated in the optimization of process input variables for palm kernel oil esterification (Betiku et al., 2016) and transesterification of sorrel oil (Ishola et al., 2019). Thus, these previous studies support the observation made in this present work. The optimal condition previously established for the esterification of NSO (with an initial acid value of 11.67 mg KOH/g oil) using RSM was the methanol/ NSO molar ratio of 2.19 (v/v), reaction time of 15 min, ferric sulfate dosage of 6 wt%, and temperature of 65°C with an acid value of 1.8 mg KOH/g oil which corresponds to %FFA of 0.90 . In another study with RSM, the optimum values established for the esterification of NSO (with an initial acid value of 10.18 mg KOH/g oil) was methanol/NSO molar ratio of 0.55 (v/ v), reaction time of 36 min, H 2 SO 4 dosage of 0.45%, and temperature of 60°C with an acid value of 1.22 mg KOH/g oil which corresponds to %FFA of 0.61 .

CONCLUSION
The comparative performance of RSM and ANN to predict the extent of FFA reduction during esterification of NSO, with methanol and ferric sulfate as a solid acid heterogeneous catalyst, was evaluated in this work. Based on the statistics considered, the ANN model with a higher R 2 (0.9909) and a significantly lower MRPD (2.9%) outperformed the RSM model with a lower R 2 (0.9657) and a higher MRPD (6.5%). For the optimization of the process input variables, the minimum FFA (0.53%) was predicted by ANN coupled with GA at a more desired optimal condition of methanol/NSO molar ratio of 18.51, ferric sulfate dosage of 6 wt.%, and reaction time of 62.8 min. The prediction by ANN-GA was better by a margin of 1% FFA of the esterified NSO, which suggests that it can be converted to biodiesel via transesterification without soap formation. Apart from validating the use of the ferric sulfate-catalyzed esterification of NSO as a viable pretreatment step, this work also demonstrated the higher predictive accuracy of the ANN model than the RSM model. Also, GA was shown to be better than RSM as an optimization tool.