The Scientific World Journal
Volume 2018 (2018), Article ID 3170816, 7 pages
https://doi.org/10.1155/2018/3170816

Research Article

Fuzzy Logic Tool to Forecast Soil Fertility in Nigeria

G. O. Ogunleye,¹ S. G. Fashoto,² Petros Mashwama,² S. A. Arekete,³ O. M. Olaniyan,⁴ and B. A. Omodunbi⁴

¹Department of Computer Science, Federal University, Oye-Ekiti, Ekiti State, Nigeria
²Department of Computer Science, University of Swaziland, Kwaluseni, Swaziland
³Department of Computer Science, Redeemer’s University, Ede, Osun State, Nigeria
⁴Department of Computer Engineering, Federal University, Oye-Ekiti, Ekiti State, Nigeria

Correspondence should be addressed to G. O. Ogunleye; gabriel.ogunleye@fuoye.edu.ng

Received 20 April 2018; Revised 6 September 2018; Accepted 12 September 2018; Published 15 October 2018

Academic Editor: Yudong Cai

Copyright © 2018 G. O. Ogunleye et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract.

The soil is composed of several nutrients which are important for the effective growth of plants. Nitrogen, phosphorus, and potassium are micronutrients which are very important for plant growth. There have been several methods and soil tests developed to test the compositions of these nutrients in the soil. Interpreting the results gotten from such tests has been a herculean task for farmers. Employing the use of a soft computing method to interpret such result would be a noble idea. In this paper, we describe the use of fuzzy logic to interpret the values of nitrogen, phosphorus, and potassium (NPK) gotten from conventional soil test to know their levels in the soil and predict possible NPK inputs.

1. Introduction

Agriculture is a major sector in the Nigerian economy [1]. It accounts for the employment of up to 70% of Nigeria’s population. Agriculture also contributes about 40% to the Gross Domestic Product (GDP) of Nigeria [2]. It also provides the country with food and raw materials for agro-allied industries.

Major crops grown in Nigeria include beans, sesame, cashew nuts, cassava, yam, cocoa beans, groundnut, gum arabic, kola nut, maize, millet, palm kernel, palm oil, plantain, rice, rubber, sorghum, soybeans, and yam. There have also been series of programs initiated by the government to improve the state of agriculture in Nigeria such as National Fadama I &II project, River Basin Development Authorities, Operation Feed the Nation, etc. All these methods adopted by various governments in Nigeria have not yielded good results so far. The government is now trying to diversifying the economy back to agriculture because in the past years attention has only been focusing on petroleum.

The fertility of the soil is determined by several factors such as light, soil composition, PH, nutrients, and climate change. These factors affect the constituents of the soil. It is necessary to know the constituents of the soil and over the years several methods have been developed and are in use to measure the soil constituents such as indicator methods, metal-electrode, glass-electrode methods, and semiconductor sensor methods for measuring soil PH, direct light indicator for measuring light intensity, litmus test, and a test probe to measure soil PH and a dry test to know amount of nutrients in the soil.

After all this data has been calculated, the farmer still has to decide what this data means, what crops can be planted or what other action can be taken. All this can be achieved with the help of soft computing. Soft computing is a type of computing different from hard computing which is tolerant of imprecision, uncertainty, partial truth, and approximations [3, 4].

This study is based on developing a fuzzy inference system to interpret results of nitrogen, phosphorus, and potassium gotten from soil tests carried on soil samples gotten from southern part of Nigeria (Ibadan) which forms our case study. The results would also be used to predict amount of fertilizer (NPK) that should be applied to the soil to restore its fertility to an optimum level.

The study would help farmers in interpretation of results of their soil test carried out on nitrogen, phosphorus, and potassium. The study is further aimed at better crop and reduction in crop loss from wrong application of fertilizer. The rest of the paper is organized as follows: Literature Review is presented in Section 2 and Methodology is presented in Section 3 while System Implementation is presented in Section 4, and Section 5 comprises Conclusion.

2. Literature Review

2.1. Soft Computing

There are different definitions of soft computing such as soft computing is a set of “inexact” computing techniques, which are able to model and analyze very complex problems [5]. Soft computing is an emerging approach to computing which parallel the remarkable ability of the human mind to reason and learn in an environment of uncertainty and imprecision [6]. Soft computing is the fusion of methodologies designed to model and enable solutions to real world problems, which are not modeled or too difficult to model mathematically [7]. These methodologies and techniques have been used to create more acceptable cheaper, more complete and approximate solutions to problem. This idea was formulated by Lotfi A. Zadeh in his paper on soft data analysis. The techniques and methodologies include Evolutionary Computing which was developed in 1960 by Rechenberg, Neural Networks developed in 1943 by McCulloch, Fuzzy Logic was developed in 1965 by Lotfi A. Zadeh and Genetic algorithm by John Holland in 1975 which was later popularized by his student David Goldberg [8]. As opposed to hard computing which can also be referred to as conventional computing, which requires a precisely stated analytical model and often a lot of computational time [9], soft computing exploits the tolerance for imprecision, uncertainty, partial truth, and approximation to achieve tractability, robustness, and low solution cost [9]. Fuzzy Logic (FL), Artificial Neural Networks (ANN), and Genetic Algorithms (GA) are considered as core techniques of soft computing [5].

There are have been several applications of soft computing methodologies in different areas of computing such as handwriting recognition [10], Automotive Systems, Manufacturing, Image Processing, Architecture, Decision Support, and Power Systems [9].

2.1.1. Fuzzy Logic

Fuzzy logic is a soft computing technique which uses inexact information to make informed and exact predictions or inference. It takes into account the uncertainty in human decision to make certain predictions and it parallels the remarkable ability of the human mind to reason and learn in an environment of uncertainty and imprecision [11]. The human mind easily reason in an uncertain, in exact way and this manner of reasoning cannot be expressed precisely not even with statistical or probability methods but fuzzy efficiently maps out this uncertainty and inexactness.

Fuzzy set theory was first proposed by Zadeh in 1965 [3, 4] and was first used by Mamdani in control [12] since then, there have been different other applications of fuzzy logic in different fields such as in electronics [13], agriculture, industrial processes, and environmental protection. According to [14],” rather than regard fuzzy theory as a single theory, we should regard the process of “fuzzification” as a methodology to generalize any specific theory from a crisp (discrete) form to a continuous (fuzzy) form”

2.2. Application of Fuzzy Logic in Agriculture and Other Fields

Ever since the inception of fuzzy logic in the 1970s, there have been several applications in different fields. Examples of such fields are as follows.

Development of first generation fuzzy logic based hardware [15] provided faster fuzzy control solutions incorporating inference engines. In time past, applications have been based on software modules deployed on conventional microprocessors, personal computers, and workstation type of computing platform. Fuzzy hardware has been implemented in the integration of software algorithms in Integrated Circuits (IC) chips for rule-based fuzzy controllers incorporating fuzzy inference [16].

Some authors have used fuzzy logic to convert heuristic control rules stated by a human operator into an automatic control strategy [17].

Rajesh et al. [18] developed an automated rice cooker with advanced logic technology, which allows it to think for itself and make adjustments to the temperature and timing of cooking of a batch of rice. It made use of a Sugeno style fuzzy approach which used the amount of water, rice, and time as inputs to give the rice cooker the best temperature to cook the rice.

Development of embedded fuzzy applications [19]: a fuzzy logic control of washing machines uses a triangular membership function for the control of washing machines based on specification of the degree of dirt on clothes and it also specifies the amount of soap needed to wash the clothes [20]. Washing machines like this are already in use today.

Fuzzy logic has also been applied in planning of transportation process which is characterized by subjectivity, ambiguity, uncertainty and imprecision [21]. Some Japanese authors also made a crucial addition to fuzzy set theory applications in traffic and transportation [22–24]. Temperature control systems have been extensively designed improved upon using fuzzy logic [25].

There have also been vast applications of fuzzy logic in the area of agriculture such as in the mapping of soil using a combination of GIS, Expert Knowledge, and Fuzzy Logic [26, 27] because standard soil surveys were not designed to provide the detailed (high-resolution) soil information required by some environmental modeling [28].

Reference [29] wrote on development and improvement of an image capture/processing system to distinguish weeds from good plants and a fuzzy logic decision-making system to determine the locations and amount of herbicide to apply in an agrarian field. As data concerning economic thresholds of weed effect on crop profitability cannot easily be adapted to a given area or even to a given farm, a fuzzy logic methodology was applied to convert image data into sprayer commands to permit agriculturists to utilize experience to classify weed status at a given location in the field. This research indicated that a fuzzy logic system has the capability to understand and facilitates the representation and processing of human knowledge in computer and the inputs, outputs, and rules of FL are easy to modify.

Singh and Sharma [30] developed a fuzzy expert system for potato. They recommended optimum amount of NPK fertilizer needed for the soil. The authors made use of three input variables taken nitrogen, phosphorous, and potassium present already in soil which are partitioned into three, four, and two sets, respectively, each. These input variables were represented in triangular shapes. The nitrogen, phosphorous, and potassium needed in the soil accordingly were partitioned into three, four, and two sets each and are represented in triangular shapes. However the portioning into three four and two sets of the input and output variables does not deal effectively with the stratification of the soil.

3. Methodology

3.1. Data Collection

A soil test was carried out by taking soil samples from different parts of a field. The soil samples collected were mixed together. The sample is thereafter tested in the laboratory and from the result gotten, the levels of nitrogen, phosphorus, and potassium in the soil are then known. All measurements were carried out in parts per million (ppm).

There exist standards of measurement of nitrogen, phosphorus, and potassium in the soil. Kaiumov [31] empirical model stated that there exists an interval of the soil attribute, and if values of this attribute lie within this interval, then its utility is optimal. These tables or standards form the basis for the interpretation of the soil fertility we used in this paper.

3.2. Linguistic Variables

From Tables 1 and 2, the linguistic variables for our fuzzy model would be “Low”, “Medium”, “High”, and “Excessive”. We would use them for the membership functions. The Min and Max values would be used as the range for the membership functions of the measured nutrients and the Min and Max values as the range for the membership functions of the required nutrients, respectively.

Table 1: Input variables with their linguistic functions showing minimum & maximum values.

INPUT
LEVEL
MIN VALUE
MAX VALUE

NITROGEN
LOW
-1
20

ADEQUATE
20.1
41

HIGH
41.1
70

EXCESSIVE
70.1
100

PHOSPHORUS
LOW
-1
20

ADEQUATE
20.1
40

HIGH
40.1
100

EXCESSIVE
100.1
150

POTASSIUM
LOW
0
150

ADEQUATE
150.1
250

HIGH
250.1
800

EXCESSIVE
800.1
1500

Table 2: Output variables showing linguistic variables and recommended values.

OUTPUT
LEVEL
RECOMMENEDED
VALUE

NITROGEN
LOW
0 - 30

AVERAGE
30 - 70

HIGH
70 - 100

PHOSPHORUS
LOW
0 - 30

AVERAGE
30 - 70

HIGH
70 - 100

POTASSIUM
LOW
0 - 20

AVERAGE
20 - 70

HIGH
70 - 100

SOIL FERTILITY
LOW
0 – 40

AVERAGE
40 – 80

HIGH
80 - 100

3.3. Membership Functions

The system would make use of triangular membership functions. Therefore they would have a range of three values of the form [Lower limit mid-point Upper limit].

3.3.1. Model of Fuzzy Logic System

In the fuzzy logic system, the input and output variables and their membership functions have to be first decided upon based on the expert’s knowledge and experimental studies and a rue base is formed to represent the expert’s knowledge. A model is thereafter created in MATLAB based on the input and output variables, their membership functions with their Minimum and Max values, and rules decided upon and transferred to the model.

The rules are checked if they suitably represent the expert’s knowledge and are tested if they are correct. If there is any error with any of the rules, the rule is replaced. After all rules have been tested, defuzzification is carried out to produce crisp outputs for the model or system.

After the soil is carried out, the measured nitrogen, phosphorus, and potassium are the input and variable and required nitrogen, phosphorus, and potassium and present level of soil fertility as the output variables and from the experts' knowledge. Fuzzy sets and membership functions are decided upon and fuzzy rules formed. Defuzzification produces crisp values or the outputs.

The detailed view of the NPK system is shown in Figure 1 consisting of the input variables, membership functions, rules, and defuzzification process to produce the crisp output. Katorgin (2004), Kaiumov [31], and Singh and Sharma [30] discussed the recommended setting for the values of the mandami fuzzy logic system for input and output for soil fertility. For setting of the values for input in part per million, Table 1 range from 0 to 100 for nitrogen, phosphorus is 0 to 150, while potassium is 0 to 1500 in parts per million. The accepted recommended values for mandami fuzzy logic output settings as illustrated by Kaiumov [31] when converted to parts per million are that when nitrogen is from 0-30 it is categorized as low, 30-70 as average, and 70-100 as high. For phosphorus it is the same as nitrogen while potassium from 0 to 20 is low and 20 to 70 is average while 70 to 100 is high, all in parts per million. The datasets gotten were divided into training and testing. About 70% of the datasets were used for the training while the 30% of the datasets were used for testing to validate the datasets.

Figure 1: Flowchart of NPK system.

3.4. Rules

The rules used in this system were based on the following assumptions or postulations culled from the following [32]:

(1)When amount of phosphorus is high, phosphorus application is unnecessary and should be limited(2)When phosphorus is low, the rate recommended is intended to satisfy immediate crop needs and begin to produce their own(3)Crops need potassium to be able to use the nitrogen in the soil(4)Even though soil potassium level is optimum, extra is still needed to make up a portion of crop removal(5)The soil can produce its own nitrogen through the use of nitrogen fixing bacteria’s and thus does not need extra when its concentration is high

These are the interpretations of different rules that are used:

 H: high M: average L: low E: excessive NIL: none N: nitrogen P: phosphorus K: potassium R.N: required nitrogen R.P: required phosphorus R.K: required potassium S.F: soil fertility

In this paper, 64 Rules are used with 3 inputs and 4 outputs.

4. System lmplementation

4.1. Rule Editor

The rule editor is shown in Figure 2 which hosts the rules conveying the experts’ knowledge and binding the inputs together. New rules can be added or existing rules changed by using either of the “Add Rule” or “Change Rule” buttons, respectively, and a rule can be deleted using the “Delete Rule" button. The rules are joined together using the AND or OR connective.

Figure 2: Rule editor.

The rule viewer allows the user to see the effect of each input on the outputs based on the rules inputted. It gives the user the defuzzified results.

4.2. Program Implementation

Figure 3 shows the front page that the user gets to on starting the application. It contains the name of the application and a short description about it. Upon clicking the enter button, the user is taken to a new page or interface for entering the values of each of the components.

Figure 3: Front page.

4.3. Reading Dialog Interface

Figure 4 allows the user to be able to enter the nitrogen, phosphorus, and potassium results gotten from the soil test he has carried out on his farm. The values added are in PPM (parts per million). After entering the values, the user clicks on the forecast button and he receives the present level of soil fertility based on the values entered in percentage and thereafter, the user gets recommended values of NPK needed for the fertility of the soil to reach an optimum level as shown in Figure 5. The recommended values given to the user are also in PPM and the user can then go ahead to use it to calculate the amount of fertilizer needed in the soil.

Figure 4: Reading dialog interface showing a user’s input.

Figure 5: Reading dialog interface showing the result of a user’s input in Figure 4.

4.4. Prediction Accuracy of the Proposed System

The prediction accuracy of the proposed system was carried out and compared with the existing system commonly known as J48 algorithm for predicting soil fertility. We used the formulae (1), (2), and (3):

where TPR is true positive rate, TP = true positive and P= positive, TNR = true negative rate, TN = true negative, and N= negative.

From Table 3, generally the results gotten from our work showed that fuzzy logic outperformed the J48 in predicting soil fertility. 1.2% and 1.7% false alarms were discovered in fuzzy logic and J48 method, respectively. Using formulae (1), (2) and (3) above, the percentage of predicting accuracies were found to be apparently better than the results gotten from other method of J48 algorithm for predicting soil fertility. The datasets used for this work were partitioned into two. 70% of the datasets collected were used for the training while the remaining 30% of the datasets were used for testing to validate the datasets.

Table 3: Predictive accuracies of fuzzy logic with J48 for soil fertility.

Prediction Accuracy
J48 Algorithm
False Positive

J48
87.6%
1.7

Fuzzy Logic
99.1%
1.2

5. Summary, Recommendation, and Conclusion

5.1. Summary

This paper has shown how fuzzy logic as an expert system can be applied to the forecasting of soil fertility. The modularity of the system enables the verification of the rules used in the system. The separation of control from knowledge would allow for expansion of the knowledgebase of the system without affecting the total functionality of the system. The use of fuzzy logic also takes into account the variability and imprecision of soil test readings. The system can work on any windows enabled workstation.

5.2. Recommendation

The project recommends for further work by the use of Artificial Neuro Fuzzy Inference System (ANFIS) to analyze the system and also due to the different nutrients demands of different crops, crop types can be included as criteria for nutrient recommendation in future studies.

5.3. Conclusion

The application of this concept of the fuzzy expert system approach would proffer a better soil quality which would invariably offer a means to assess soil quality as "a degree or grade of perfection".

Fuzzy logic has continued to gain grounds since its inception and there are more and more applications of fuzzy logic that have been developed. There is still a lot to be done in the agricultural sector and this study believes that as our knowledge of fuzzy logic keeps increasing it would be applied to other sectors.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Authors’ Contributions

The first author participated in carrying out research design and conception and manuscript preparation. The second author participated in the data analysis and programming implementation. The third and fourth authors assisted in participating in performing the predictive accuracy of the system with the existing systems including the paper formatting. The fifth and last authors assisted in participating in the field work and general proofreading of the manuscript.

References

P. S. Amaza and J. K. Olayemi, “Technical efficiency in food crop production in Gombe state, Nigeria,” Nigerian Agricultural journal, vol. 32, pp. 140–151, 2000.

CBN. (2006). Annual Report and statement of Accounts for the year ende 31st December 2006. Central Bank of Nigeria.

L. Zadeh, A definition of soft computing, 1965.

L. Zadeh, Fuzy Sets, Inform and Control, 1965.

H. Yanbo, Y. Lan, Steve. Steven et al., Development of soft computing and applications in agricultural and biological engineering, Elsevier, 2010.

L. A. Zadeh, “what is soft computing,” Journal of Soft Computing, 1992.

R. C. Chakraborty, Introduction to Soft computing (2005). Retrieved April 16th, 2015, from my readers web site: http://www.myreaders.com.

D. E. Goldberg, “Genetic algorithms in search, optimization, and machine learning,” Choice Reviews Online, vol. 27, no. 02, pp. 27-0936–27-0936, 1989.

C. Wang, What is Soft Computing, 2004.

A. Choudhary, “A Review of Various Soft Computing Techniques in the Domain of Handwriting Recognition,” Journal of Information & Computation Technology, pp. 601–606, 2014.

S. Jang, T. Sun, and E. Mizutani, Neuro-Fuzzy and Soft Computing A Computational Approach to Learning and Machine intelligence, Prentice Hall, 1997.

H. E. Mamdani, “Applications of fuzzy algorithms for control of simple dynamic plant,” IIEE Proc, vol. 121, 1974.

K. Hirolta, Industrial Applications of Fuzzy Technology, Springer, Tokyo, Japan, 1993.

A. K. Sharma and B. V. Padamwar, “Fuzzy Logic Based Systems in Management and Business Applications,” International Journal of Innovative Research in Engineering & Science, vol. 1, no. 2, pp. 1–6, 2013.

A. B. Patki, “Fuzzy Logic Based Hardware: Some Experiences,” Proceedings of First International Discourse on Fuzzy Logic and the Management of Complexity. FLAMOC, pp. 15–18, 1996.

L. Zadeh, “Coping with Imprecision of the Real World: An Interview with Lotfi A. Zadeh,” ACM, vol. 27, no. 4, pp. 304–311, 1994.

E. H. Mamdani and S. Assilian, “An experiment in linguistic synthesis with a fuzzy logic controller,” International Journal of Man-Machine Studies, vol. 7, no. 1, pp. 1–13, 1975.

K. D. Rajesh, R. Rao, and V. R. Kandula, “A Comprehensive Study on Making Food Using Rice Cooker with Fuzzy Logic Technique,” International Journal of Computer Science and Information Technologies, vol. 4, pp. 246-247, 2013.

I. M. Ahmad, Fuzzy Logic for Embedded Systems Applications, Elsevier, Cambridge, Mass, USA, 2004.

M. Agarwal, Fuzzy Logic Control of Washing Machines, Indian Institute of Technology, Kharagpur, 2009.

C. P. Pappis and E. H. Mamdani, “A fuzzy logic controller for a traffic junction,” IEEE Transactions on Systems, Man, and Cybernetics, vol. 7, no. 10, pp. 707–717, 1977.

M. Nakatsuyama, N. Nagahashi, and N. Nishizuka, “Fuzzy logic phase controller for traffic functions in the one-way arterial road,” in Proceedings of the Proceedings IFAC 9th Triennial World Congress, pp. 2865–2870, Oxford, 1983.

M. Sugeno and M. Nishida, “Fuzzy control of model car,” Fuzzy Sets and Systems, vol. 16, no. 2, pp. 103–113, 1985.

T. Sasaki and T. Akiyama, “Traffic control process of expressway by fuzzy logic,” Fuzzy Sets and Systems, vol. 26, no. 2, pp. 165–178, 1988.

P. Singhala, D. Shah, and B. Patel, “Temperature Control using Fuzzy Logic,” International Journal of Instrumentation and Control Systems, vol. 4, 2014.

A. X. Zhu, B. Hudson, J. Burt, K. Lubich, and D. Simonson, “Soil mapping using GIS, expert knowledge, and fuzzy logic,” Soil Science Society of America Journal, vol. 65, no. 5, pp. 1463–1472, 2001.

G. Bragato, “Fuzzy continuous classification and spatial interpolation in conventional soil survey for soil mapping of the lower Piave plain,” Geoderma, vol. 118, no. 1-2, pp. 1–16, 2004.

L. Band and I. D. Moore, “Scale, Landscape attributes and geographical information systems,” Hydrol, vol. 401, p. 422, 1995.

Y. Huanga, Y. Lanb, T. J. Steven, A. Fang, H. C. Wesley, and L. E. Ronald, “Development of soft computing and applications in agricultural and Biological Engineering,” Computers and Electronics in Agriculture, pp. 107–127, 2010.

H. Singh and N. Sharma, “Optimization of fertlizer rates for wheat crop using fuzzy expert system,” International Journal of Computer Applications, vol. 100, no. 1, pp. 36–40, 2014.

M. K. Kaiumov, Handbook on Yield Programming , Rosselkhozizdat Press, Moscow, Russia, 1977 (in Russian) (Slovak).

Masseuchesets, U. o. (2013). Interpreting your Soil Test Result. Retrieved 7 15, 2015, from University of Masseuchesets: http://www.umass.edu.