Application of ANNs, ANFIS and RSM to estimating and optimizing the parameters that affect the yield and cost of biodiesel production

Biodiesel can easily be used as an alternative fuel in diesel engines. It is environmentally friendly and can be produced from low-cost feedstocks such as waste cooking oil (WCO). WCO contains a significant amount of free fatty acid, which is extracted by a two-step process of converting the free fattyacidbyacidcatalysis(H 2 S0 4 )andconvertingthetriglyceridesusinganNaOHcatalyst.Currently, the major challenge for the industrial production of biodiesel is optimizing the yield while meeting American Society for Testing and Materials (ASTM) standards. In this study, experiments were per- formed to optimize the reaction conditions. The studied experimental parameters were the alcohol types (methanol, ethanol), the alcohol-to-oil molar ratio (AOMR; 3:1, 6:1, 9:1), the amount of catalyst (0.5, 1.0, 1.5 wt% of the oil), the temperature of the reaction (50, 60, 70, 80°C), the mixing intensity (300, 600, 900rpm), and the reaction time (30, 60, 90 min). The biodiesel production yield (BPY) was optimized based on the experimental data. The optimum value of the BPY based on methanol is 95.92%, which is obtained at 73.80°C, with a reaction time of 74.02 min, an AOMR of 6.58:1, a catalyst concentration of 1.13 and a mixing intensity of 824.45 rpm. In the case of ethanol, the optimum BPY is 95.53%. which is obtained at 64.96°C, with a reaction time of 88.02 min, an AOMR of 7.005:1, a cata- lyst concentration of 1.25 and a mixing intensity of 592.18 rpm. These results of biodiesel production were confirmed by the experimental data.


Introduction
The heavy dependence on fossil fuels, the high production volume of pollutants, the waste from and mismanagement of these pollutants, and the limited nature of their refinement have caused an environmental crisis (Bildirici & Gökmenoğlu, 2016;Franco, Mandla, & Rao, 2017). For example, using fossil fuels for different activities such as manufacturing and agricultural industries has led to greenhouse gas emissions being generated in almost every region in the world (Ben Jebli & Ben Youssef, 2015). Carbon dioxide (CO 2 ) is the most significant among all of the greenhouse gases emitted during the production of fossil-based energy (Li, Baležentis, Makutėnienė, Streimikiene, & Kriščiukaitienė, 2016). This CO 2 contributes to global warming as an emitted greenhouse gas -but using biodiesel in diesel engines reduces the CO 2 addition to the atmosphere (Datta & Mandal, 2017;Hasan & Rahman, 2017;Karavalakis et al., CONTACT Shahaboddin Shamshirband shahaboddin.shamshirband@tdt.edu.vn 2017). Burning fossil fuels in diesel engines has a negative impact on the environment and generates harmful pollutants (Singh et al., 2015;Yilmaz & Morton, 2011). On the other hand, biodiesel contains less harmful pollutants (Ghazanfari, Najafi, Faizollahzadeh Ardabili, & Shamshirband, 2017;Huang et al., 2015) and is a renewable fuel that can be generated from plant resources, produced through a reaction process that uses shortchain alcohols, vegetable oils or animal fats, and acidic or alkaline catalysts (Zhang et al., 2017). The fatty acid alkyl esters that make up biodiesel are obtained by producing chemical changes in triglycerides (El-Mashad, Zhang, & Avena-Bustillos, 2008). Based on previous studies, a two-stage procedure of acid esterification and alkaline transesterification is the best method for biodiesel production (Knothe, 2001;Meher, Vidyasagar, & Naik, 2006). The transesterification process contains three consecutive reactions. Figure 1 shows the hydrocarbon chains R 1 , R 2 , and R 3 . The required stoichiometric ratio in this reaction for the alcohol-to-oil molar ratio (AOMR) is 3:1. The esterification reaction is very slow in the normal mode without using a catalyst, and the end product is not desirable. Therefore, in order to accelerate the process it is necessary to increase the AOMR and apply an optimum value of a suitable catalyst at a certain temperature, as this has a significant impact on the biodiesel production yield (BPY; Seyyed Aram & Najafi, 2016).
Different studies show that the BPYs using methanol, ethanol, and butanol are 98.96%, 96%, and 96%, respectively (Schwab, Bagby, & Freedman, 1987), and they show that the best AOMR is 6:1 (Nye & Southwell, 1984). Using a temperature higher than the boiling point of alcohol results in a soapy solution and destroys the esters and the catalyst; therefore, selecting a temperature in the range of the boiling point of alcohol not only results in an increase in the BPY but is also safer (Feuge & Gros, 1949;Mahajan, Konar, & Boocock, 2007). The type and amount of catalyst used have a considerable impact on the development of the conversion reaction. As an example, using an NaOH catalyst by 0.8 wt% of oil with ethanol at a temperature of 50°C leads to a BPY of 95.8% (Ahn, Koncar, Mittelbach, & Marr, 1995;Boocock, Konar, Mao, Lee, & Buligan, 1998;Foglia, Nelson, & Marmer, 1998). To produce the desired product, there is a need to use an effective experimental design model (Muthukumaran et al., 2017). There are several modeling methods, the simplest of which is the mathematical approach, which is considered the classical system (Faizollahzadeh Ardabili, 2014;. Intelligent systems enable the user to perform very complex tasks with high accuracy, but without the need to devise the mathematical equations in the system (Faizollahzadeh Ardabili, Mahmoudi, & Mesri Gundoshmian, 2016;Najafi, Faizollahzadeh Ardabili, Mosavi, Shamshirband, & Rabczuk, 2018). These methods have been successfully employed in waste management (Nabavi-Pelesaraei, Bayat, Hosseinzadeh-Bandbafha, Afrasyabi, & Chau, 2017), groundwater modeling (Gholami, Chau, Fadaee, Torkaman, & Ghaffari, 2015), the assessment of river water quality (Wang, Xu, Chau, & Lei, 2014) and river stage forecasting (Chau, 2007). There are also several studies on modeling and optimizing biodiesel production from different sources. Mostafaei, Javadikia, and Naderloo (2016) evaluated and compared the results of a response surface methodology (RSM) and an adaptive neuro-fuzzy inference system (ANFIS) for modeling the transesterification yield achieved in an ultrasonic reactor, while Naderloo, Javadikia, and Mostafaei (2017) developed an ANFIS model to estimate the ratio of energy production from biodiesel production.
Conventionally, one of the main challenges of biodiesel production is obtaining the maximum BPY under optimum conditions, as the cost of energy and materials puts limitations on optimized production. The present study aims to determine the condition that produces the maximum BPY at the minimum production cost, and because modeling the production process remains a major challenge, modeling tools were used. Accordingly, this study presents an approach for modeling the process of biodiesel production (both methyl and ethyl esters) from waste cooking oil (WCO) and estimating the BPY using ANFIS, multilayered perceptron (MLP), and radial basis function (RBF) models. The presented models open up the pathway to process optimization. This study determines the optimal levels of the independent variables for obtaining the maximum BPY using RSM. The main aspect that distinguishes this study from similar research is its economic approach, wherein the presented production costs are based on the BPY. The work was carried out in five stages: (1) studying the biodiesel production from the WCO, (2) developing the BPY prediction models, (3) evaluating the developed models and choosing the best one, (4) optimizing the biodiesel production by employing the related independent variables, and (5) using the material and energy costs to obtain the final results.

Materials and method
In this study, WCO from the restaurant at the University of Mohaghegh Ardabili was used to produce biodiesel because of its reasonable price. Using WCO as a source of biodiesel production imposes greater complexity due to the presence of impurities such as free fatty acids and water. In this study, the effects of the reaction temperature (50, 60, 70, 80°C), the type of alcohol (methanol, ethanol), the AOMR (3:1, 6:1, 9:1), the wt% of the catalyst (0.5, 1.0, 1.5), the mixing intensity (300, 600, 900 rpm) and the reaction time (30, 60, 90 min) on BPY were investigated (as independent parameters), with BPY as the dependent parameter (Table 1). The experiments were performed in a completely randomized design with three replications. The WCO used in this study contained contaminants such as water, solid particles and free fatty acids. Water has a significant effect on the BPY (Najafi, Pirouzpanah, Najafi, Yusaf, & Ghobadian, 2007), so in the first step the water was extracted from the WCO using a vacuum evaporation method, and then filter paper was used to remove the solid particles. The fatty acids in the WCO were 0.9 wt%, which is higher than the allowed value of 0.5 wt%. A pre-treatment stage (esterification) was performed to reduce the free fatty acids in the WCO, during which the acids reacted with methanol (or ethanol) in the presence of a sulfuric acid catalyst and were converted to ester (or ethyl ester). The AOMR was 10:1 and the value of the sulfuric acid catalyst was 2.0 wt% of the WCO. The excess alcohol and the water produced were extracted using a vacuum evaporation method during this process.

Experimental method
After the esterification process and the extraction of the water, the solid particles and the free fatty acids, a 100cc sample of the WCO was poured into a 200-cc beaker and heated to 30°C. During the heating process, the sample was mixed using a mechanical mixer at 300 rpm. Simultaneously, methanol with an AOMR of 3:1 and an NaOH catalyst with a value of 0.5 wt% of the WCO was solved at 30°C (the temperature of the WCO) in a 100-cc beaker. Then, the oil and the produced methoxide were mixed together and the reaction time was recorded. After 20 min, the reaction temperature was reduced to room temperature using liquid nitrogen and the progress of the reaction was halted. Then, the final product was defused using hydrochloric acid. To fully break down the glycerin and salt deposits produced, a centrifuge with a rotational speed of 6000 rpm was used for 5 min. The upper phase of the residual fluid (yellow color) is biodiesel (or methyl ester) and the lower phase (brown color) is glycerine, and these phases were separated. After this, the biodiesel was passed through a filter to eliminate the waxy particulate matter. The biodiesel was then washed with a volume of distilled water equal to the volume of biodiesel at a temperature of 60°C in order to remove the soap that had been produced.
It is essential that the mixture of emulsion is mixed slowly after adding distilled water to the ester. To separate the emulsion phases, a centrifuge with a rotational speed of 6000 rpm was again used for a period of 5 min. During this stage three phases are completely separated, and the biodiesel -which is lighter than the other two phases -is collected from the top layer. Soap, which forms as a white foam, makes up the middle layer, and the residual solution of water and salt, which has a yellow color, forms the bottom layer. The biodiesel was separated and purified using a filter with a fine grid. The water and excess alcohol in the biodiesel were extracted using vacuum evaporation at a temperature lower than 100°C, because separating the water and alcohol from biodiesel at temperatures higher than 100°C forms a waxy ester and reduces the BPY. Leaching operations do not remove the monoglycerides and diglycerides from biodiesel, so this process was conducted by passing the biodiesel through a sorbent such as silica gel, as this results in the monoglycerides and diglycerides -which have a high polarity -being adsorbed onto the gel. Because of its high concentration, biodiesel cannot easily pass through a sorbent; therefore, a hexane solvent was used after removing the monoglycerides and diglycerides, and the hexane was extracted from the biodiesel using a distillation method. Absorbing operations were performed at room temperature. After the monoglyceride absorption, the purity of the biodiesel produced in accordance with the chromatography test was more than 98.5%. Finally, the wt% ratio of biodiesel to WCO was calculated. These operations were performed in three repetitions for each of the different conditions of reaction temperature: (1) alcohol type, (2) AOMR, and (3) catalyst quantity and mixing intensity.

Modeling process
The modeling process was performed for communication between the independent and dependent variables. The main purpose of using soft computing methods is to develop a black box model without the need to mathematical models. The data were separated into two categories according to the qualitative parameter of the type of alcohol: methanol and ethanol. Thus, for each type of alcohol, a separate predictive network was developed. The MATLAB software package was used to develop the models, and the modeling was performed in two stages: training and testing (Faizollahzadeh Ardabili, Mahmoudi, Mesri Gundoshmian, & Roshanianfard, 2016). The training stage is an important step in the formation of networks. After developing the target network (which is formed in the training process), the testing data is then applied to the network in order to obtain the results of the testing stage.

Artificial neural network (ANN) modeling
The artificial neural network (ANN) is one of the most popular modeling methods, and MLP is one of the most commonly applied ANN methods. The ANN Toolbox in MATLAB was used to design the MLP network. The input matrix was created using the independent variables, while the only dependent variable was the BPY. Initially, the network divided the data into training data (70%), test data (25%) and validation data (5%). Determining the optimal number of neurons in the hidden layer is the most important operation in the training process; therefore, at each training stage, the network was trained with different numbers of neurons in the hidden layer, and the value of the performance function was calculated for certain numbers.
The second stage was to develop an RBF model. This type of ANN is a feed-forward network with a nonlinear input and a linear output. Due to the characteristics of nonlinear approximations, RBF networks can model complex systems (Jiang, Dong, Wang, & Li, 2015). Contrary to the MLP network, increasing the number of neurons in the hidden layer increases the performance of RBF models until a threshold is reached, after which point no further significant benefit is obtained; therefore, the aim is to find the number of neurons closest to this threshold in order to obtain the maximum output accuracy using the minimum number of neurons. At each stage of the training process, 2 neurons were added to the number of neurons and the networks were retrained, and each time the training decreased the mean square error (MSE). As before, the independent variables were the reaction temperature, the AOMR, the wt% of the catalyst, the mixing intensity and the reaction time, and the only dependent variable was the BPY.

ANFIS modeling
ANFIS is a hybrid of neural networks and fuzzy systems that combines the advantages of both of its components (Wali, Al-Shamma'a, Hassan, & Cullen, 2012). The desired ANFIS model for predicting the BPY based on the reaction temperature, the AOMR, the wt% of the catalyst, the mixing intensity and the reaction time was developed using MATLAB . The training process was performed with gbell, gaussian, and trap membership functions in order to determine which is the most effective, and the performance parameters were separately calculated for each function.

Evaluation
In order to compare the accuracy and performance of the designed networks, three performance factors were used (Faizollahzadeh Ardabili, Najafi, Ghaebi, Shamshirband, & Mostafaeipour, 2017): the root mean square error (RMSE), the correlation coefficient R, and the mean absolute error (MAE). Calculation of the difference between the target and estimated values was performed using the RMSE, while the Pearson correlation coefficient was used for expressing a linear correlation between the target and estimated values. The equations are as follows: where P is the predicted value, A is the target value, and N is the number of data points.

Results
Several studies in the field of biodiesel production have been conducted on various materials under different conditions. In a study by Sinha, Agarwal, and Garg (2008), biodiesel was produced from rice bran with a BPY of 90.2% in the presence of 0.75 wt% of NaOH at 55°C with an AOMR of 9:1 and a reaction time of 60 min. Meng, Chen, and Wang (2008) produced biodiesel from WCO with a BPY of 89.9% in the presence of 1.00 wt% of NaOH at 50°C with a reaction time of 90 min. Leung and Guo (2006) used waste frying oil to produce biodiesel and achieved a BPY of 88.8% at 60°C with a reaction time of 20 min and an AOMR of 7:1. In the present study, the various conditions of biodiesel production were examined, and the initial results are divided into eight groups: (1) reaction time, (2) alcohol type, (3) AOMR, (4) reaction temperature, (5) catalyst value, (6) mixing intensity on BPY, (7) determination of biodiesel quality, and (8) optimization of BPY.

Effect of the reaction time on the BPY
Increasing the reaction time increases the BPY. The trend has a high slope at the beginning of the reaction then proceeds towards equilibrium over time. As expected, the highest BPY was obtained at 90 min after starting the reaction. In all tested cases, the difference in BPY between 60 and 90 min was less than 5% ( Figure 2). Based on the optimization results presented, the optimized durations are 74.02 min for methanol and 88.02 min for ethanol,   (2008), sunflower oil methyl esters were produced with a BPY of 97.1% in the presence of 1.00 wt% of NaOH at 60°C with an AOMR for methanol of of 6:1, a mixing intensity of 600 rpm and a reaction time of 120 min.

Effect of the alcohol type on the BPY
Methanol converts more oil into biodiesel than ethanol because the energy required for separating the OH − is lower for methanol than for ethanol; therefore, methanol has a higher affinity with the oil in the transesterification reaction ( Figure 1). The purity of the alcohol has a significant impact on the rate of the transesterification reaction; when the purity is high enough it eliminates the possibility of producing a waxy mixture while also increasing the BPY. However, as can be seen from Figure 2, both alcohol types have a similar effect on the BPY and similar trends of variation.

Effect of the AOMR on the BPY
The transesterification reaction is an equilibrium reaction. According to Le Chatelier's principle, increasing the molar ratio also increases the BPY. The results of the experiments prove this principle. As shown in Figure 2, increasing the AOMR from 3:1 to 6:1 increases the BPY, but increasing the AOMR higher than 6:1 increases the glycerin and excess alcohol in the separation stage, thus decreasing the purity and the BPY. Therefore, the best molar ratio for a high BPY is 6:1 for both methanol and ethanol. In a study by Roosta and Sabzpooshan (2016), the best molar ratio of an AOMR for methanol of 7:1, but these results have no significant impact on the results of the present study, for which the optimized value of an AOMR for methanol of 6.58:1.

Effect of the reaction temperature on the BPY
The transesterification process involves three successive endothermic or exothermic reactions. However, this process has positive activation energy and the reaction is endothermic. As a result, increasing the temperature to 70°C increases the BPY. However, at high temperatures (close to the boiling point of alcohol) the triglycerides in the WCO become soapy, thus reducing the purity of the biodiesel and accordingly reducing the BPY (Figure 2). It should also be noted that if the temperature is too high when the alcohol and the catalyst are added to the oil, a waxy solution forms and no biodiesel is produced.

Effect of the catalyst value on the BPY
Using an alkaline catalyst with a high percentage due to the presence of free fatty acids in the WCO leads to the formation of soap and thus increases the viscosity of the mixture, reducing the affectivity of the mixing the oil and ethanol and in turn reducing the BPY. Therefore, increasing the wt% of the catalyst (from 0.5 wt% to 1.5 wt%) initially increases the BPY and then reduces it.
In all experiments, the maximum BPY was obtained with 1.0 wt% of the catalyst (Figure 3).

Effect of the mixing intensity on the BPY
Due to the low solubility coefficient between them, oil and alcohol are practically insoluble with each other. As a result of this, the transesterification reaction proceeds slowly if the oil and alcohol are not sufficiently well mixed. As expected, increasing the mixing intensity increases the effective surface of the reaction and accordingly increases the BPY. In all experiments, the maximum BPY was obtained at 600 rpm when using ethanol and 800 rpm when using methanol (Figure 4).

Determination of the biodiesel quality
In order to determine the quality of the biodiesel that was produced, its physical and chemical properties  employed based on ASTM D6584 to determine the purity of the biodiesel and the composition of its constituents ( Figure 5, Table 2). The results of the analysis indicate that the biodiesel's purity was greater than 98%, which confirms that its quality meets the requirements and exceeds the standard values. The formula of C 20 H 39 O 2 was obtained by considering the percentage of the biodiesel's esters. As a result, the weight of one mole of biodiesel was determined to be 311 g (Table 3).

Optimization of the BPY
The optimization process was performed using the Design-Expert ® software package (Faizollahzadeh Ardabili et al., 2017). RSM was employed to fit a quadratic model in order to optimize the BPY (as the dependent variable) based on the values of the independent variables obtained from the experimental data. In all cases, the aim of the optimization was to maximize the BPY under optimal conditions for each independent variable. Figure 6 presents the results of the RSM optimization, which was performed separately for methanol (left-hand side) and ethanol (right-hand side). Each graph includes the predictions X1 and X2, whose values are optimized to the value of the BPY, where X1 relates to the horizontal axis and X2 to the vertical axis. In all cases, the vertical axis relates to the reaction temperature. The optimum value of the BPY when methanol is used is 95.92%, which is obtained at 73.8°C with a reaction time of 74.02 min, an AOMR of 6.58:1, a catalyst concentration of 1.13 wt% and a mixing intensity of 824.45 rpm (Figure 6(a)). In the case of ethanol, the optimum BPY is 95.53%, which is obtained at 64.96°C, with a reaction time of 88.02 min, an AOMR of 7.005:1, a catalyst concentration of 1.25 wt% and a mixing intensity of 592.18 rpm (Figure 6(b)). Table 4 displays a comparison of each independent parameter's effect on the BPY with the optimization results presented above; it can be seen that the optimization results are within the ranges obtained from studying the effects of the independent parameters.

Results of the modeling
The first stage of developing networks is the training process, after which the second stage tests each model and generates its results.

Results of the ANN modeling
Two MLP networks were developed separately for the two types of alcohol. Table 5 presents the results of the MLP network training process; the network with 8 neurons in the hidden layer was selected as the best MLP prediction model for both types of alcohol due to having the lowest  After the training process was completed, the testing of the developed models was undertaken. The testing data was imported into the selected models, and the output values were exported for each model separately. Figure 7 presents a scatter chart, which makes it easier to study the pattern of output values against target values. Based on Figure 7  a linearity of 84.67%. The results of the model testing are presented in the next section. Table 6 presents the results of the RBF network training process. It can be seen that the networks with 20 and 22 neurons in the hidden layer have similar results, which indicates that the training process is finished. Therefore, the network with 20 neurons in the hidden layer was selected as the best RBF prediction model for both types of alcohol due to having the lowest RMSE (3.21% for ethanol and 2.20% for methanol) and MAE (1.33% for ethanol and 1.18% for methanol) and the highest R (.93 for ethanol and .95 for methanol).
The output values were again exported by importing the testing data into each model after the training and selection process had been completed. Figure 8 shows the scatter chart of output values against target values for the RBF models. Based on Figure 8

Results of the ANFIS modeling
The trap membership function was selected as the type with the best performance, although no significant difference was found between the results of all the three membership functions tested. As can be seen from Table 7, the trap membership function was selected for the ANFIS method due to having the lowest RMSE (3.21 for ethanol and 2.02 for methanol) and MAE (1.33 for ethanol and 1.19 for methanol) and the highest R (.93 for ethanol and .95 for methanol).
The output values were again obtained by importing the testing data into each model. Figure 9 shows the scat-  Note: MAE = mean absolute error; RMSE = root mean square error. Italic font denotes the best prediction model selected for the testing stage. Note: ANFIS = adaptive neuro-fuzzy inference system; MAE = mean absolute error; MLP = multilayered perceptron; RBF = radial basis function; RMSE = root mean square error.
ter chart of output values against target values. Based on Figure 9(a) the target and output values of methanol have a linearity of 89.79%, and based on Figure 9(b) the target and output values of ethanol have a linearity of 85.72%. The results of the testing of all the models (MLP, RBF, ANFIS) are presented in Table 8, which shows that their performance is poorer than in the training process. The deviation is the sum error percentage between the predicted and target values based on the BPY. An increase in the deviation between the target and output values of the models results in an increase in BPY loss; therefore, this can decrease the precision of models.   Figure 10, it is clear that the MLP and ANFIS models have high deviations compared with the RBF model -therefore, the RBF model was selected as the best predictor of BPY identified in the present study.

Economic approach
In the present study, WCO was used to produce biodiesel in the presence of ethanol and methanol, with NaOH as the catalyst. In Iran, the price of WCO is 30 /kg, the price of ethanol and methanol is 30 /kg and the price of NaOH is about 10 $/kg (all stated currency values are United States dollars and cents). The experimental setup  included an electric heater and an electric mixer. The value of electricity consumption was measured and calculated based on the reaction temperatures (50, 60, 70, 80°C), the weight of the oil (1000 g), the weight of the alcohol (106.5, 213.0, 319.5 g), the reaction time (30, 60, 90 min) and the mixing intensity (300, 600, 900 rpm). The price of electricity in Iran is 3 /kWh (Statistical Center Of Iran, 2017). The results of the calculations of the special cost of producing 1 kg of biodiesel from WCO -defined as the biodiesel special cost (BSC) -are presented in Table 9. Based on the results, the highest BSC is 2.1 $/kg, which was obtained with a reaction temperature of 70°C, a reaction time of 30 min, an AOMR of 9:1, a mixing intensity of 600 rpm and 1.0 wt% of the catalyst, generating a BPY of 80%. The lowest BSC is 1.3 $/kg, which was obtained with a reaction temperature of 70°C, a reaction time of 90 min, an AOMR of 3:1, a mixing intensity of 600 rpm and 1.0 wt% of catalyst, generating a BPY of 64%. Comparing these two extremes, although the BSC is significantly decreased, so is the BPY, rendering the minimum condition insufficient due to the lower yield and the higher condition insufficient due to the cost-to-yield ratio. Figure 11 was extracted from Table 9 to display the dependency of the BSC and the BPY. Based on Table 9 and Figure 11, the highest BPY is 95.5% at a BSC of 1.31 $/kg, the highest BSC is 2.10 $/kg with a BPY of 80.0%, and the lowest BSC is 1.29 $/kg with a BPY of Figure 11. Results of the dependency of the production cost and the BPY.
64.0%. It can be seen that reaching the highest BPY compared to the lowest BSC of biodiesel production shows a difference of 2 /kg, which means that paying 2 /kg more for the BSC increases the BPY by 31.5%. Therefore, it can be seen that achieving the highest BPY is not equal to paying the highest BSC. Now, it should be considered that there is a decision tree with the aim of managing biodiesel production with a focus on the developed models. Accordingly, the maximum BPY from the experimental data was imported into the developed models with the aim of finding the maximum predicted BPY in each model. The results are presented in Table 10. Through simple calculations in relation to the BSC and the BPY according to Table 9, the

Conclusion
One of the main challenges in biodiesel production is obtaining the maximum BPY under optimum conditions -but the cost of energy and materials puts limits on the definition of optimized production. The present study was conducted to determine the condition that generates the maximum BPY at the minimum production cost. Modeling tools were used to simulate the production process, as modeling this process still remains a major challenge. Accordingly, this study presents an approach for modeling the process of producing biodiesel from WCO (using both methyl and ethyl esters) and estimating the BPY using ANFIS, MLP, and RBF models. Biodiesel was produced through the transesterification process, and the experimental parameters examined were the alcohol type (methanol, ethanol), the AOMR (3:1, 6:1, 9:1), the concentration of the catalyst (0.5, 1.0, 1.5 wt% of the oil), the temperature of the reaction (50, 60, 70, 80°C), the mixing intensity (300, 600, 900 rpm) and the reaction time (30, 60, 90 min) as the independent variables. Based on the results of the optimization process, the optimum value of the BPY when using methanol is 95.92%, which is obtained at 73.80°C with a reaction time of 74.02 min, an AOMR of 6.58:1, a catalyst concentration of 1.13 %wt and a mixing intensity of 824.45 rpm. The optimum value of the BPY when using ethanol is 95.53%, which is obtained at 64.96°C with a reaction time of 88.02 min, an AOMR of 7.005:1, a catalyst concentration of 1.25 wt% and a mixing intensity of 592.18 rpm. Table 4 shows that the results of the optimization are in the range of the results obtained from studying the effects of the independent parameters on the BPY. The modeling process was performed using MLP, RBF and ANFIS methods. The RBF model has the second lowest and lowest RMSE (3.39% for ethanol compared to 3.37% with the ANFIS model and 2.34% for methanol), the lowest MAE (1.56% for ethanol and 1.38% for methanol) and deviation (56.25% for ethanol and 49.87% for methanol) and the highest R (.92 for ethanol and .95 for methanol), producing the best overall response compared to the MLP and ANFIS models for predicting BPY values. From an economic viewpoint, based on the prices of materials and energy in Iran, the highest BSC of the biodiesel is 2.1 $/kg with a BPY of 80.0% and the lowest BSC is 1.29 $/kg with a BPY of 64.0%. On the other hand, the highest BPY is 95.5% with a BSC of 1.31 $/kg. It is clear that the production condition with the highest performance has a difference of only 2 /kg compared to the production condition with the lowest cost; therefore, reaching the highest BPY is not equal to paying the highest BSC.
Using the maximum BPY from the experimental results with the aim of finding the relation between the BSC and the prediction accuracy of the developed models, it was found that if the developed models are placed in a decision tree, the MLP model generates a BPY of 91.0% resulting in an increase in the BSC of 6.5 /kg, the ANFIS model generates a BPY of 91.5% resulting in an increase in the BSC of 5.7 /kg, and the RBF model generates a BPY of 93.2% resulting in an increase in the BSC of 3.2 /kg. Therefore, the results of the RBF model are confirmed as the closest match to the experimental results. The overall finding is that attaining the highest BPY compared to the lowest BSC only involves a difference of 2 /kg, and paying that extra 2 /kg increases the BPY by 31.5%. Therefore, attaining the highest BPY does not also require paying the highest BSC.

Disclosure statement
No potential conflict of interest was reported by the authors.