Improving farmers’ net revenue in traditional context: Analytic Hierarchy Process, Expert System, and Linear Programming

The low yield of the agricultural sector in Sub-Saharan Africa (SSA) is not solely due to the type of agriculture (mainly traditional), but also to the crop selection process which is typically based on impressions or past experience. This approach cannot always ensure an optimal crop selection even for subsistence farming. To improve farmers’ net revenue, this work proposes a three-stage approach for crop selection in the context of traditional agriculture. Firstly, since crops’ yields are influenced by several environmental parameters, an analytic hierarchy process is used to set the weights of those parameters. Secondly, an expert system using a rule-based inference engine is designed to determine the appropriateness of crops depending on environmental and time constraints. Finally, the net revenue of the farmer is formulated as a linear programming problem, considering the operating account of the various crops selected during the previous stages. In addition, a web interface has been developed to allow farmers to benefit from the whole system. Scenarios have been designed from a collection of crop technical itineraries, and they have been compared with the outputs of the expert system. The result shown that the system can effectively help farmers to improve their net revenues.


Introduction
A large majority of the population in Sub-Saharan Africa (SSA) especially those living in rural areas, relies on agriculture for securing their source of revenue and fulfilling their basic needs [1]. Although a significant percentage of the land is arable in Sub-Saharan Africa, this land is poorly exploited, resulting in food insecurity, malnutrition and poverty. For instance, the percentage of undernourished in SSA remains the highest in the developing world [2] and the number of people experiencing extreme poverty rather increased from 278 million in 1990 to 437 million in 2019 [3]. The low yield of the agricultural sector in SSA is due to a number of challenges, including the inefficiency of the agriculture extension system; the misuse of arable land; the lack of information on agricultural techniques; and poor crop selection. Among these challenges, crop selection remains one of the most important. In fact, selecting the best crop can improve the farmer's productivity and net income. But what is observed is that farmers often select their crop(s) using traditional methods such as trial and error methods, hunches, and past experience. This does not guarantee optimal solutions for cash crop farming. Optimizing the crop selection process is a complex issue [4]. In practice, it should consider at least the limited available resources, as well as the time and the 2 environmental characteristics of the farming system. Due to the environment particularities from one region to another, crop selection systems are typically designed for a specific locality [5] or a nationwide area [6]. In one hand, the crop selection process may consist of determining the most appropriate crop that fits the most to the given environmental and time constraints. In that direction, expert systems (ES) are usually designed [7] [8]. On the other hand, the crop selection process may consist of determining the crop(s) that optimize(s) the use of certain resources or the farmer's revenue. For that purpose, the problem is naturally formulated as a linear programming (LP) problem [5] [9]. In this latter formulation, the initial set of crops considered in the LP problem is supposed to be cultivable on the given land. Even if recently crop selection has been extended to a multi-period LP problem [4,11], it remains nonetheless that the initial set of crops is known and supposed to be cultivable, although at different periods, on the given plot. But what if this initial set of cultivable crops for a given plot is unknown when trying to optimize the net revenue of the farmer? In fact, at a national scale and even regional one, plots may present significant differences in their characteristics, meaning the initial set of crops for the LP problem may change. This work suggests a new approach for a better crop selection to improve farmers' net revenue in an SSA context, especially in Cameroon, where traditional agriculture is still practiced by most farmers. In the typical scenario, a farmer owns land where he can cultivate various types of crops. The characteristics of each crop are known and include among others: the period when the crop can be grown, the type of soil, the water quantity. Each crop also implies an operating cost based on the required material, entrants and labour days. Finally, each harvested crop provides a benefit to the farmer, depending on the yield and the cost per unit. The proposed approach is based on the combination of an expert system and linear programming: the expert system determines the initial set of crops based on time and environmental constraints, while linear programming is used to determine the appropriate mix of crops that will maximize the farmer's revenue, taking available equipment, budget, acreage, and the other related operating materials and costs into account. Due to the lack of quantitative data for setting weights of the different parameters influencing the crop selection process, an analytical hierarchy process is adopted. The rest of the paper is structured as follows. Section 2 presents related works on crop selection using expert systems and/or linear programming. A formal description of the problem is presented in Section 3; followed by the approach for the maximization of farmer's net revenue in Section 4. Section 5 presents an overview of the web-based system and the results on some real cases. A validation of the system is proposed in Section 6. This paper ends with a conclusion and possible directions for future developments.

Related work
The selection of crop(s) to grow is one of the most important steps when starting a farming venture. Usually crops are tied to particular seasons. Depending on the period of the year and the location of the plot, the season can be easily deduced. That is why, rather than considering the season, the period [2,6] and the region [10] are chosen in the literature. However, both parameters are not enough to determine the appropriateness of a crop. Numerous other environmental constraints are usually involved among which the soil quality [13] and the water quantity [14]. Other non-negligible factors include wind [15], light/shade [6], altitude [16] and slope [13]. Additional factors for crop selection such as marketability and profitability, and available technology are suggested in [9]. Crop selection can also depend indirectly on the farmer's capital [6]. Based on these factors, several techniques have been used to determine optimal crop planning, including expert systems as described below. In the area of Artificial Intelligence, Expert Systems (ES) can be defined as computer-based systems that emulate the decision-making ability of a human expert [17]. ES tackle the issue of transferring expertise through knowledge from highly skilled specialists to non-experts, by simulating the decision or the behavior of a person that has deep knowledge in a specific domain. In agriculture, this transfer usually takes place from research to extension, from extension to farmers, and even from farmers to farmers. ES have been extensively used in agriculture since the beginning of 1980s. The earliest agricultural ES dealt with disease diagnosis and pest management. One of the first agricultural ES was formulated by and al. in 1983 [18]. They designed an experimental expert system to diagnose soybean disease. This work later inspired the design of several subsequent ES on soybean, such as SOYBUG [19] and SOYPEST [21]. Other crops that drew the attention of expert systems designers include cotton [21][22][23], rice [24][25][26] and wheat [27,28]. Apart from disease diagnosis, ES have also been designed for irrigation systems (watering) [29][30][31] and tools or machinery selection [32][33][34]. With the plethora of works on the design of ES in agriculture, some researchers have paid attention to the crop selection problem. One of the first efforts in that direction dates back to Morgan et al. who designed CUE: a rule-based ES to select the appropriate wheat variety for use in particular locations in Scotland. Later, another rulebased ES called CROPLOT [8] was proposed by Nevo and Amir. The system helps to select the most suitable crop(s) from among several possibilities (onion, vetch, wheat, chick-pea, sunflower, cotton, tomato and corn) based on environmental constraints in the Jezreel Valley in Israel. CROPES [35] and CROPLAN [36] have been proposed respectively in India and USA. CROPES recommends crops based on location, climate, soil's information and available resources, while CROPLAN attempts to determine the optimal crop planning based on production conditions at the levels of farm, field, and crop. In general, ES in agriculture are usually advisory systems that emphasize either on the management of specific crops or a range of crops, but within specific geographic regions Improving farmers' net revenue in traditional context: Analytic Hierarchy Process, Expert System, and Linear Programming 3 [37]. Beyond advice on appropriate crops, farmers are also interested in finding crop(s) that will maximize their revenue. To address this issue, crop selection is rather formulated as an optimization problem and solved using mathematical modelling. A popular approach in mathematical modelling is linear programming. Linear programming has been extensively used in agriculture since 1950's. Some works have been conducted at the level of a single farm [38] [39], a district [40] [5], or even a country [41], [6], [9]. One of the first works was based on data collected in northern Kern County (California, USA) to determine the crop that optimizes the net revenue of the farmer among cotton, potatoes, alfalfa, sugar beets and barley [42]. In most of the cases, the problem has been formulated as a resource allocation problem, where the resource is the land to be allocated to a set of crops in order to optimise the revenue of the farmer. In that direction, a LP model for finding the optimal land allocation to the five major food crops in India is proposed in [10]. Advanced models using Mixed Integer Linear Programming are proposed in [4], taking simultaneously into account several factors such as the market prices variability of harvested products and specific resource requested for each crop. A recent survey presenting optimization techniques in crop selection is found in [43]. Although a plethora of initiatives has been conducted using LP or other based techniques, only few have tackled the issue in a SSA context. One of the first of these was conducted in Zambia, at the level of a farm in Gwembe Valley [38]. The work focuses on maximization of the net revenue of farmers using a technique derived from goal programming. Another initiative considered 16 selected small-scale farmers from some operational areas of Fanteakwa district in Ghana [5]. The proposed model maximizes the net revenue of farmers based on crop yields and net profits. Crop selections systems that use either ES or LP techniques (or both) cannot be expected to be reliable outside of the particular region they were designed for, because constraints and objectives may differ considerably. For instance, developed countries use modern agriculture with machinery, while developing countries still use with rudimentary techniques. A system designed for a particular farm depends on that farm's particular local conditions, and may not be expandable to a district or country scale. To the best of our knowledge, this is the first work tackling the crop selection problem for traditional agriculture at the national scale in the context of SSA.

Area of study: Cameroon
Cameroon is an SSA country of about 25 million inhabitants distributed over ten regions, for a total area of 475 000 km². On the agricultural level, the diversity of pedoclimatic conditions makes it possible to subdivide the national territory into 5 major agro-ecological zones encompassing single and bimodal rainfall [44]. The agricultural sector employs 62% of the population, including 40% of the total female population [45]. These figures show that improving the revenue of farmers can help to fight against poverty.

Problem description
We consider a farming system for traditional agriculture, in which the net revenue of the farmer should be maximized. For this end, a subset of crops should be selected among a set of crops, depending on time and environmental constraints. Traditional agriculture implies the use rudimentary techniques and equipment such as machetes, hoes, buckets. Each crop requires a set of resources and operations. Each operation requires equipment, maintenance products and fertilizer, and their quantity differs depending on the crop and the size of the cultivated area. The farmer may already own some equipment and resources. The unit cost of each resource is considered as known. Finally, historical data are available on the unit price that can be obtained from selling the different harvested products and on the yield per hectare for each crop. The farmer's objective is to look for an optimal selection of crops that maximizes his net revenue expressed as the difference between the expected revenues from selling harvested crops and the production costs.

Data acquisition
An important work has already been done in Cameroon by the "Service d'Appui aux Initiatives Locales de Développement" (SAILD)., which is a Cameroonian nongovernmental association. SAILD has produced a the technical itineraries of the major crops in Cameroon and described the different conditions in which those crops can be grown [46]. A set of ten parameters have been considered: region (each region having particular weather conditions); time of year (from January to December); soil type; soil quality; water quantity; shading; lighting; wind level, slope level, and altitude. The same document also provides an estimation of the yield of the different crops based on previous agricultural campaigns, and the prices of crops on the market. The present work relies on these data.

Overview
The process of determining optimal crops is done in three main stages. Figure 1 presents the flowchart of the decision-making process. Although the crop selection depends on several parameters, those parameters do not have the same degree of influence. For instance, the soil EAI Endorsed Transactions on Context-aware Systems and Applications 11 2019 -05 2020 | Volume 7 | Issue 20 | e2 quality may have a greater influence on the crop than the wind or the slope of the field. Therefore, the first step consists into determining the different parameters' weights. For this purpose, an analytic hierarchy process is used. The second step is to determine appropriate crops based on parameters' weights, time and environmental constraints. This is done using an expert system. The last step is to determine the optimal crop(s) with yield(s) and net revenue for the farmer. This is performed using a Linear Programming model.

Analytic Hierarchy Process for parameters' weights determination
Analytic Hierarchy Process is a technique largely used in decision making process. It has been designed by Thomas L. Saaty [47] initially for the optimization of resource allocation when several criteria are involved, and particularly when those criteria may not be quantifiable. Later, it has been extended to the selection of the best solution among a list of candidates and to the comparison or prioritization among a set of solutions [48]. The main steps involved in this technique include:  Hierarchical structuring: decomposition of the problem into sub-problems;  Definition of priorities: classification of the elements according to their relative importance;  Evaluation of logical coherence: the elements are grouped and classified logically. AHP has been applied to determine the weights of the different parameters for crop selection. The process is done in five main steps: 1) Building the hierarchy among criteria; 2) Classifying the criteria based on the judgements of experts; 3) Normalizing the elements; 4) Computing the weights of criteria; 5) Evaluating the coherence of judgements. The complete process is presented in Figure 2.

Figure 2. Analytic Hierarchy Process for determining parameters' weights for crop selection
Building the hierarchy Since the problem is not composed of subproblems, we only have one level of hierarchy with the following criteria: Region, Period, Shade, Lighting, Water quantity, Altitude, Slope, Soil Type, Soil Quality, Wind.

Classifying the criteria
Classifying the criteria amounts to define priorities by comparing elements of the hierarchy in a binary way. Saaty [49] has proposed the binary comparison scale presented in Table 1, to define priorities among criteria. The degree of EAI Endorsed Transactions on Context-aware Systems and Applications 11 2019 -05 2020 | Volume 7 | Issue 20 | e2 importance defines how important each criterion is compared to others. Criteria have been compared two by two using the binary comparison scale. The generated binary comparison matrix is provided in Table 2.
Normalizing the elements This step consists into normalizing the columns of the comparison matrix, so that the sum of the elements of each column equals 1. In order to normalize, we calculate the sum of each column. We normalize the elements by dividing each element by the sum of its column (SUM1).
The resulting standardized comparison matrix is provided in Table 3.

1
Equal importance of both elements 3 Weak importance of one element over another 5 Strong importance of one element over another 7 Demonstrated importance of one element over another 9 Absolute importance of one element over another 2,4,6,8 Intermediate values between two adjacent judgments. Used when compromise is needed

Computing the weights of the criteria
The weight of each criteria is computed by the equation 1 and the result presented in Table 4. From this table, the most important criteria are: the region, the period, the quality and the type of the soil and the water quantity.

Evaluating the coherence of judgments
The coherence of judgments requires computing three successive quantities: the average coherence, the coherence index and the coherence ratio. The average coherence is obtained by multiplying each column of the non-normalized binary comparison matrix by the weights of the associated criteria. The sum of the elements is then computed for each row (SUM 3 in Table  5). The coherence of each criterion is given by dividing the previous sum by the weight of the criterion. The coherence of each criterion and the average coherence are given in Table 6. The coherence index and the coherence ratio are giving respectively by Equations (2) and (3). The value of the coherence ratio is computed by dividing the coherence index by the random coherence that is derived from Table  7. For ten criteria, the value of the random coherence equals 1.49. With a coherence index of 0.13, the coherence equals 0.0872. According to Saaty, when the coherence ratio is less than 10%, the judgement is considered as consistent. Therefore, the arbitrarily chosen comparison matrix makes sense. The value of the coherence ratio proves that the weight of each criterion we have obtained is acceptable. Once the weights of parameters are set, the ES can use them to determine the appropriate crops.

Expert system
The architecture of the ES is represented in the Figure 3. The core of the system is composed of a knowledge base and an inference engine. The knowledge base contains rules and facts, and the inference engine applies those rules to deduce new information. The web-based user interface aims to facilitate the interaction between users and the ES.

Knowledge Base
The knowledge base is composed of a Rule base and a Fact base. The Rule base is the set of deductive rules (also called production rules) given in the form of a database. A rule is composed of facts related to logical operators. Each rule is a clause containing a head and a tail. The rules represent the operative knowledge that allows the ES to deduce facts from other facts. The Fact base is a database that contains the set of facts. It represents part of the knowledge of an ES in declarative form. The following facts are basic facts for pineapple:  period(pineapple, December)  region(pineapple, littoral)  soil_type(pineapple, limestone)  soil_quality(pineapple, rich in organic matter)  water(pineapple, little)  shading(pineapple, some hours of the day)  lighting(pineapple, some hours of the day)  wind(pineapple, average)  slope(pineapple, low)

Inference Engine
We used the inference engine implemented in the SWI-Prolog platform † . SWI-Prolog is a versatile implementation of the Prolog language. The algorithm used here for reasoning is the backward chaining algorithm. To answer a question, the inference engine seeks to unify it, either with a fact (Example: region (pineapple, littoral)) or with the head of a rule (Example: Wind(Y)). If the unification succeeds: it responds "true" or gives the value of the variable (Example: X = pineapple) if there were any in the query.
The probabilities assigned to the selected crops are based on the weight of each selection criterion. At the beginning, the inference engine executes the main rule with the percentage of each culture is initialized to 0 and stored in the fact base, then according to the responses of the user and the facts, each percentage is updated. Table 8 presents the process of assigning different probabilities. The choice of a web-based interface is motivated by a study in Cameroon, showing that the penetration of smartphones in rural regions is rapidly increasing [50]. We used Prolog Engines (abbreviated "Pengines") to connect the web interface to Prolog. The Pengine package greatly simplifies the development of JavaScript based web-applications that can communicate to a Prolog server by providing Remote Procedure Calling over HTTP [51].

Net revenue maximization model in Linear Programming
Net revenue is considered rather than the revenue, because it is a better measure of the farmer's actual benefit. A crop's high sale price may be offset by operational costs incurred by sowing, harvesting, etc. On the other hand, the farmer may already own some resources, equipment, fertilizer or maintenance products relevant for a particular crop, thus reducing operational costs and making the crop more profitable than others. The objective function given in (4) maximizes the net revenue of the farmer, subject to constraints (5) to (9). Constraint (5) indicates that the sum of the areas associated to each crop can be greater than the total available area.
The amount of available resource must be deducted from the required quantity in order to reduce the operational cost. To avoid the case in which the amount is greater than the required quantity, a variable is introduced. Constraint (9) ensures that the budget is not exceeded.
Maximize Non negativity constraints , , ≥ With the following parameters: : total number of crops; : total number of required resources; : the available budget; ( ≥ 0) X: the total area; : the amount of available resource ; : yield of crop per unit area. : sale price per unit area of crop ( > 0) : the amount of resource per unit area of crop ; : cost/unit of resource ( > 0) and the following variables: : area of crop i sown : quantity of already-available resource j used.

Working of the system
The system is accessible at the following link: http://wallamre.msacad.com/. Each interface contains a question related to a parameter of the ES and a drop-down menu with a list of possible answers as shown in Figure 4. After selecting the values of all the parameters of the ES, the system provides a list of appropriate crops with suitability percentage according to the values of the parameters the user has entered (Figure 5). At this point, there is a possibility for the user to determine among those crops which one can optimize his net revenue. Since we are considering the operating account, the user has the possibility to enter the available resources ( Figure 6), available equipment (Figure 7), and available fertilizer and maintenance products (Figure 8). Despite the total area and the available budget, any other information related to the operating account is optional. The final interface presents the result by given the crop(s), the associated area that will be used, an estimation of the quantity to harvest, and an estimation of the net revenue of the farmer (Figure 9).

Evaluation of the net revenue improvement
The evaluation of the net revenue improvement was achieved by comparing the result of the system with what is usually done in some regions in Cameroon. We designed two scenarios for the evaluation. For each scenario, we considered two cases: the first in which the farmer owns no resource; and the second in which he owns some.

Scenario 1: Pineapple in the Centre region
Pineapple is one of the most cultivated crops in the Centre region of Camroon. Table 9 provides favorable conditions  in which pineapple can grow. The data have been entered into the ES and results are given in Table 10. From the results, the success rate of Pineapple was the highest and was close to 100%, showing a correctness of the system and validating the trivial choice of farmers who usually decide to grow pineapple. The net revenue of the farmer was later on optimized. In the case first, we considered that farmer owns no resource apart from the available budget to invest and the area of the land that are respectively 60,000 XAF and one hectare. The system therefore presents carrot as the crop providing the optimal net revenue, using 914 square meters, requiring all the available budget and providing a net revenue of about 60,699 XAF. In the second case, we considered that farmer owns some resources taken into account during the net revenue optimization. The list of available resources is given in Table 11. In this last case the most profitable crop was bean, using an area of 998 square meters. The farmer obtains a net revenue of about 66,263 XAF, with an investment of 65,500 XAF (the cost of available useful resources plus the budget).

Scenario 2: Cocoa in the south region
We considered cocoa in this second scenario, one of the most cultivated crops in the South. Favorable conditions for cocoa are given in Table 12. Results from the expert system is given in Table 13 and show the correctness of the ES since the success rate of cocoa was 97.49%. As in the first scenario, we will consider two cases when optimizing the net revenue of the farmer. The available budget was 75,000 XAF with an area of 1 hectare. In the case where the farmer owns no other resource, the system shows that the most profitable crop was sweet potato on an area of 1542 square meters, using all the available budget, and providing a net revenue of around 130,421 XAF. The second case assumes that the farmer already owns some resources. If we consider the resource in Table 14 as available, then, the most profitable crop will still be sweet potato, on an area of 2911 square meters providing a net revenue of around 246,279 XAF with an investment of 141,625 XAF (the cost of available useful resources plus the budget). Two observations can be derived from both scenarios. The first is the fact that the most suitable crop according to the environmental condition is not always the one that maximizes the net revenue to the farmer. Secondly, the fact that the farmer already owns some resources can make another crop more profitable than the crop found in the case he owns no resource.

Conclusion
Crop selection is a sensitive process that cannot be done trivially as it is presently in SSA in traditional agriculture, since it depends mainly on environmental constraints. In this paper, we have proposed a three-stage approach for a better crop selection process to improve the revenue of farmers in a Sub-Sahara African context. The approach consists firstly in determining the weights of the crop selection criteria through the Analytical Hierarchy Process (AHP); secondly in defining expert system rules that will allow determination of the appropriate crops according to the values of the environmental parameters; and thirdly in optimizing the net income by using linear programming. Finally, we have proposed a web interface that will allow farmers to take benefit from the whole system. Traditional agriculture still plays a major role in rural areas and remains an irreplaceable driver of the local economy.
Optimizing the crop selection process can increase the net income of farmers and contribute to the improvement of their living conditions. However, data used for designing the system may change due to climate change or environmental mutation. For instance, the rainy season may shift or last longer, or the price of a crop may increase or decrease on the market. It is therefore crucial, to consider uncertainty in future works.