МОДЕЛЮВАННЯ І УПРАВЛІННЯ
UDC 004.942: 631.15
I.V. BALCHENKO*, V.V. LYTVYNOV*, S.V. LYTVYN*
THE DEVELOPMENT OF THE MODEL OF THE EXPERT SYSTEM ON THE BASIS OF FUZZY SETS FOR PANNING OF AGRICULTURAL WORK
*Chemihiv National University of Technology, Chemihiv, Ukraine
Анотація. Розроблено структурну схему експертної системи в контексті системи автоматизованого управління для складання виконавчого плану виконання сільськогосподарських робіт для поля, на якому вирощується певна культура. Проектування моделі експертної системи проводилося за алгоритмом нечіткого логічного виведення Мамдані в пакеті Fuzzy Logic Toolbox обчислювального середовища MATLAB. Показано реалізацію модуля експертної системи на прикладі ідентифікації сприятливих умов для виконання посіву цукрових буряків.
Ключові слова: нечітка логіка, лінгвістична змінна, функція належності, експертна система, виконавчий план, агрофірма.
Аннотация. Разработана структурная схема экспертной системы в контексте системы автоматизированного управления для составления исполнительного плана выполнения сельскохозяйственных работ для поля, на котором возделывается определенная культура. Проектирование модели экспертной системы производилось по алгоритму нечёткого логического вывода Мамдани в пакете Fuzzy Logic Toolbox вычислительной среды MATLAB. Показана реализация модуля экспертной системы на примере идентификации благоприятных условий для выполнения посева сахарной свеклы.
Ключевые слова: нечёткая логика, лингвистическая переменная, функция принадлежности, экспертная система, исполнительный план, агрофирма.
Abstract. The structural scheme of the expert system in the context of the automated control system for the preparation of the executive plan of agricultural work for the field, that is cultivated a culture, has been developed. Designing of the expert system model performed by the algorithm offuzzy logical deduction of the Mamdani in the packet Fuzzy Logic Toolbox of the computing environment MATLAB. The realization of the module of the expert system on an example for identification of favorable conditions for sugar beet seeding has been shown.
Keywords: a fuzzy logic, a linguistic variable, a membership function, an expert system, an executive plan, an agrarian firm.
1. The problem statement
A development conception for the computer-aided management system of an agricultural enterprise was proposed by authors in the work [1]. It was showed, that incompleteness factors and a large amount of primary qualitative information should be considered when algorithmization of problems statements of a system.
The design principles of the functional subsystem of planning for automating management of a crop cultivating agricultural enterprise are shown in the work [2]. When planning the agricultural work it is necessary to correlate the current condition of the soil or crop with the terms, the cost of the additional work and the extent of possible improvement of the soil or crop condition. Thus, it is necessary an expert participation in a decision on an inclusion in the executive plan of agricultural works.
The feature of a work planning is the relative noncriticality to the runtime term. The fuzziness in relation start time of work’s performance and duration, which is comparable with the
118
© Balchenko I.V., Lytvynov V.V., Lytvyn S.V., 2014 ISSN 1028-9763. Математичні машини і системи, 2014, № 4
individual characteristics of fields and the time of a technic concentration in the work area, is allowed [1]. Using an apparatus of a fuzzy logic in the development of a knowledge base and inference engines of an expert system allows to formalize the procedure for evaluating the condition of the field by fragmentary, unreliable and possibly inaccurate information and to make decisions about the need for work performance with deep arguments.
Fuzzy expert systems allow not only to consider the uncertainty, but also to simulate reasoning, that is difficult to implement in systems on a traditional logic. Therefore, the main purpose of the fuzzy logic application is a creation apparatus that is able to model human reasoning based on the experts experience and to explain decision-making methods [3].
In this connection it became necessary to construct the expert system based on a fuzzy logic. This system must allow to form an executive plan for the field on which the culture is cultivated.
2. The development of the model of the expert system
The computer-aided management system of an agricultural enterprise can be viewed as an adaptive fuzzy automatic control system relative to the field as a control object. The system is represented as a closed control system with feedback. In it live circuit the fuzzy controller is used as a regulator. The fuzzy controller is an expert system with input signals that describe conditions of the field. The fuzzy controller generates a control action in the form of executive plans of works through implementation schemes of a fuzzy inference. In this scheme, pre-entered knowledge, that is received from experts at the design stage, are used and presented in a form of the rule base of a fuzzy inference system. Any next change in a rule base expert is implemented from the outside by an expert.
In the figure 1 the generalized structural scheme of a fuzzy computer-aided management system of an agricultural enterprise is presented.
A fuzzification
->
A rule base (desired conditions)
A fuzzy A defazzi-
J Si ’-pi.
inference ~ fication ■ e
e ^ An interface J
tions) A plan of
--------- A J agricultural
у works
Real conditions
A
І
An agriculturist
Sensors
Fig. 1. The structural scheme of a fuzzy computer-aided management system
of an agricultural enterprise
The generalized control object is a field where the culture is cultivated. The control object includes directly controlled technological process in the form of executive plans of works, amplifying transforming mechanisms in the form of control over the execution of plans, the regulatory authorities in the form of planning and dispatching services, and methods for measuring of the field condition [1]. Input variables that charactering the real field condition are exposed by the fuzzification and are used in the fuzzy inference system. Fuzzy inference system contains a base of fuzzy production rules of a generalized form “IF {“The field conditionl”, ... , “The field condition N”} THEN “The effect on the field””. Experts’ knowledge about management work is
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
119
represented in the rule base in the fuzzy form to achieve the desired condition of the object on the basis of knowledge about the values that characterize the actual object condition. Crisp output values are received as a result of fuzzy inference and the subsequent defuzzification use in the description of the work and its inclusion in the executive plan.
Special tools of fuzzy modeling in MATLAB allow performing the full range of research on the development and application of fuzzy models [4]. For these reasons, MATLAB was chosen as software tools, within which it is possible realize theoretical concepts of fuzzy sets and fuzzy inference procedure.
The module for identification of favorable conditions for sugar beet seeding was realized using the configuration package Fuzzy Logic Toolbox of the computing environment MATLAB (fig. 2).
Fig. 2. Functional scheme for identification of favorable conditions for sugar beet seeding in the editor window of the MATLAB
The main stages of fuzzy inference are: a fuzzification of the input variables, a formation of the rule base, an aggregation of sub-conditions, an activation of sub-conclusions, an accumulation of conclusions, and a defuzzification of output variables. We show the implementation of these steps on the example of the identification of favorable conditions for sugar beet seeding.
2.1. The fuzzification
The fuzzification is a transformation of a crisp set of an input data to a fuzzy set, which is determined by the values of membership functions. Fuzzification allows to present objective presence inaccurate measurement of object conditions. The purpose of fuzzification stage is the establishment of a correspondence between a specific numerical value of the input variable of the fuzzy inference system and the value of a membership function of the term of the input linguistic variable. The input data {xl5x2...xt} □ X, where i is the number of the field conditions, are values,
which are received from sensors or by agriculturist evaluating. Then a linguistic evaluation of an each crisp parameter is carried according to membership functions that are specified in the system. After this, a crisp set of input parameters is transformed into fuzzy set A, which is characterized by a membership function pA (x), and is used as linguistic variables in logical rules of a knowledge base.
In the development of the knowledge base of the expert system to plan for sugar beet seeding the knowledge base was used, and it is presented in table 1. The values of the input conditions were amended according to their fuzzy linguistic variables (table 1) at the fuzzification stage, and then the variation of the membership function was chosen.
120
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
The parameter values for a range of a linguistic variable were calculated on the permissible deviations of parameters from the mean values in accordance with norms.
Table 1 shows that possible values for the soil moisture are the following set:
V = (40; 45; 50; 55; 60; 65; 70; 75; 80; 85; 90). (1)
Each element of the set has its own degree of membership: the higher the degree of membership, the greater the probability that the parameter value is in the norm. Membership functions or information for their construction are given by experts by subjective preferences and are not random.
Table 1. The knowledge base for the work “Sugar beet seeding”
A parameter name A symbol A parameter value
The soil humidity, % V Low Middle High
40-50 60-70 80-90
The soil temperature, °С T Low Middle High
2-4 5-7 8-9
The soil density, gm/cm3 p Low Middle High
0.6-0.9 1-1.3 1.4-1.7
The runtime term of work (April) T Early Average Late
1-10 11-20 21-30
The resulting fuzzy set can be represented as follows:
= ( 0 0 0,5 1 1 1 0,5 0 0 0 )
Vmiddle = (40,45,Ю,60,65,70,^?,80,85,90)
Because the set of a humidity parameter is finite, the fuzzy set A is written as:
A
V
^ N mA (Vn ) ,
^n=l V ’
n
(3)
where m~ (Vn ) is a membership degree of the element Vn □ V to fuzzy set A. The membership
degree is a value from range [0 1]. The higher degree of a membership, the more element of the set corresponds to the properties of a fuzzy set.
Considering all other parameters, it is possible to consider the system to be type of MISO (Multiple Input Single Output). In this case, the system depends on the values of all input parameters, and will be described in the rules, which take into account all of input parameters of the system. There is generalized record of the MISO system that is the following:
У = [Av л At л Apa At]. (4)
Each parameter has a range of variation. Linguistic assessment of the value of each input variable is performed by three terms, and the output variable is performed by five terms. Membership function is trapezoidal: y=trapmf (x, [a, b, c, d]). The argument a is a minimal valid value of the parameter with zero probability of a norm. Interval between the arguments b and c shows the parameter belonging to the norm with probability 1. And, accordingly, the argument d is a maximum valid value with zero probability of a norm.
Let us consider the definition of the membership function for example soil humidity parameter (V) in more detail. The low value for the parameter is the range of [40 60], the average value is the range of [50 80] and the high value is the range of [60 70]. Selecting a trapezoid form of the membership function is conditioned by the fact that the parameter membership to the norm with probability 1 isn’t determined by a single value of the variable, but determined by range of acceptable values.
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
121
For input condition of the soil humidity, the membership function has three qualitative representations, for which the mechanism of fuzzy inference is mathematically formalized as:
mow (V) = \
1, if V є [40..50] 60 - V
60 - 50 0, if V > 60
, if Vє [50..60].
(5)
mimiddle (V)
V - 50
, if V є [50..60]
mhlgh (V) =
60 - 50 1, if V є [60..70]
80 - V , if V є [70..80] 80 - 70
0, if V < 50 and V > 80
1, ifV є [80..90]
V - 70
--------, ifV є [70..80]
80 - 70
0, if V < 70
(6)
(7)
For each input conditions trapezoidal fuzzy sets were given. Membership functions are normal (normalized) and take values in the range from 0 to 1. Graphical view of the membership functions is shown in figures 3a-f.
f)
Fig. 3. Membership functions of input variables of the humidity a), the temperature b), the density c), the runtime term d), the output variable of seeding conditions f)
122
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
After completion of the fuzzification stage for all input variables must concrete values of membership functions for each of the linguistic terms were determined, and they are used in the conditions of the rule base of the fuzzy inference.
Let us assume that the state of the field, where sugar beet cultivation is planned, is characterized by the conditions: the humidity level is 59%, the density is 1.1 gm/cm3, the temperature is 7.52 °C, the runtime term is April 8th. After fuzzification we got truth degree of elementary fuzzy statements, which are presented in table 2.
able 2. Truth degrees of fuzzy sets after fuzzification
A fuzzy set A truth degree A fuzzy set A truth degree
“The low humidity” 0,11 “The low density” 0
“The middle humidity” 0,89 “The middle density” 1
“The high humidity” 0 “The high density” 0
“The low temperature” 0 “The early runtime term” 0,4
“The middle temperature” 0,48 “The average runtime term” 0,6
“The high temperature” 0,52 “The late runtime term” 0
2.2. The formation of fuzzy production rules
Causal relationships between the parameters and conditions of seeding are formalized in the form of the set of fuzzy logic rules. Format basic rules of inference “if - then” is called a fuzzy implication. The rule condition may be the statement “The humidity is low”, the term “low” is given by the fuzzy set of the universal set of the linguistic parameter “The humidity”. The consequence for this condition may be one of the terms of the output parameter of seeding conditions.
The fuzzy knowledge base including information about the relation of the "values of the parameters - conditions for seeding" and contains by the following linguistic rules:
1) If (The humidity is Low) and (The temperature is Low) and (The density is low) and (The runtime term is Early) then (Conditions for seeding are Unsatisfactory) (1);
2) If (The humidity is Low) and (The temperature is Low) and (The density is Low) and (The runtime term is Average) then (Conditions for seeding are Below satisfactory) (1);
3) If (The humidity is Low) and (The temperature is Low) and (The density is Low) and (The runtime term is Late) then (Conditions for seeding are Below satisfactory) (1);
4) If (The humidity is Low) and (The temperature is Low) and (The density is Low) and (The runtime term is Late) then (Conditions for seeding are Below satisfactory) (1);
5) If (The humidity is Low) and (The temperature is High) and (The density is Low) and (The runtime term is Early) then (Conditions for seeding are Satisfactory) (1);
6) If (The humidity is Low) and (The temperature is Middle) and (The density is Low) and (The runtime term is Average) then (Conditions for seeding are Satisfactory) (1);
7) If (The humidity is Low) and (The temperature is High) and (The density is Low) and (The runtime term is Average) then (Conditions for seeding are Satisfactory) (1)
8) If (The humidity is Low) and (The temperature is Middle) and (The density is Low) and (The runtime term is Late) then (Conditions for seeding are Satisfactory) (1);
9) If (The humidity is Low) and (The temperature is High) and (The density is Low) and (The runtime term is Late) then (Conditions for seeding are Satisfactory) (1);
10) If (The humidity is Middle) and (The temperature is Low) and (The density is Low) and (The runtime term is Early) then (Conditions for seeding are Below satisfactory) (1);
11) If (The humidity is High) and (The temperature is Low) and (The density is Low) and (The runtime term is Early) then (Conditions for seeding are Unsatisfactory) (1);
12) If (The humidity is Middle) and (The temperature is Middle) and (The density is Low) and (The runtime term is Early) then (Conditions for seeding are Above satisfactory) (1);
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
123
13) If (The humidity is Middle) and (The temperature is Middle) and (The density is Middle) and (The runtime term is Early) then (Conditions for seeding are Optimal) (1);
14) If (The humidity is Middle) and (The temperature is Middle) and (The density is Middle) and (The runtime term is Average) then (Conditions for seeding are Optimal) (1);
15) If (The humidity is High) and (The temperature is High) and (The density is Middle) and (The runtime term is Early) then (Conditions for seeding are Above satisfactory) (1);
16) If (The humidity is High) and (The temperature is High) and (The density is High) and (The runtime term is Average) then (Conditions for seeding are Above satisfactory) (1);
17) If (The humidity is High) and (The temperature is High) and (The density is High) and (The runtime term is Late) then (Conditions for seeding are Satisfactory) (1);
18) If (The humidity is Middle) and (The temperature is High) and (The density is Middle) and (The runtime term is Late) then (Conditions for seeding are Optimal) (1);
19) If (The humidity is Middle) and (The temperature is Middle) and (The density is High) and (The runtime term is Late) then (Conditions for seeding are Above satisfactory) (1);
20) If (The humidity is Middle) and (The temperature is High) and (The density is Middle) and (The runtime term is Low) then (Conditions for seeding are Optimal) (1);
21) If (The humidity is High) and (The temperature is High) and (The density is High) and (The runtime term is Late) then (Conditions for seeding are Satisfactory) (1);
22) If (The humidity is Middle) and (The temperature is High) and (The density is Middle) and (The runtime term is Average) then (Conditions for seeding are Optimal) (1).
2.3. The aggregation of sub-conditions
The aggregation is a procedure for determining the truth degrees of conditions for each of the rules of the fuzzy inference system. Here are used values of membership functions of the terms of the linguistic variables that make up the nuclei of the antecedents of fuzzy production rules and were received at the fuzzification stage.
In MISO system the condition is a compound statement, its truth degree is based on the known truth values of its elementary statements using fuzzy logic operation «AND»:
p(V П T П p П x)=min{p(V); p(T); p(p);p(x)}. (8)
After aggregation on the basis of truth degree of the input parameters, obtained in sec. 2.1, were received the truth degree of conditions (table 3).
Table 3. Truth degrees of conditions1
Р 0 0 0 1 1 1 0 0 0
V T \ т 0,4 0,6 0 0,4 0,6 0 0,4 0,6 0
0,11 0 0(1) 0(2) 0(3) 0 0 0 0 0 0
0,11 0,48 0(4) 0(6) 0(8) 0,11 0,11 0 0 0 0
0,11 0,52 0(5) 0(7) 0(9) 0,11 0,11 0 0 0 0
0,89 0 0(10) 0 0 0 0 0 0 0 0
0,89 0,48 0(12) 0 0 0,4(13) 0,48(14) 0 0 0 0
0,89 0,52 0 0 0 0,4(20) 0,52(22) 0(18) 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0,48 0 0 0 0 0 0 0 0 0
0 0,52 0 0 0 0 0 0 0 0 0
1 In table 3 in parentheses is indicated number of the rule for which was evaluated the truth degree of conditions.
124
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
2.4. The activation of sub-conclusions
The activation of fuzzy inference systems is a procedure or process of finding the truth degree of each of the elementary logic statements (sub-conclusions), which make up the nuclei of consequents of all the fuzzy production rules. Because conclusions are made regarding the output linguistic variables, on activation the truth degree of elementary sub-conclusions are associated with basic membership functions.
Membership functions m( y) of each of the elementary sub-conclusions of consequents of all production rules are received using the method of min-activation of fuzzy composition:
m( y ) = mm {c; m( x)} (9)
where m(x) is membership functions of the terms of linguistic variables;
c is fuzzy truth degree of statements, which form the corresponding nuclei consequent of fuzzy production rules.
Using the procedure of activation, we received the following non-zero membership functions m(y):
by rules 13,20:
by the rule 14:
by the rule 22:
M У):
0,4, if y є [0,79..1] У - 0,75
M y) = <
0,79 - 0,75 0, if y < 0,75
0,48, if yє [0,798..1] y - 0,75
, if y є [0,75..0,79],
m122( y)=<
0,798 - 0,75 0, if y < 0,75
0,52, if yє [0,802..1] y - 0,75
, if yє [0,75..0,798],
0,802 - 0,75 0, if y < 0,75
if y є [0,75..0,802].
(10)
(11)
(12)
2.5. The accumulation of conclusions
The accumulation in the fuzzy inference system is a process of finding the membership function for output linguistic variables. The aim of the accumulation is in a union of all truth degrees of sub-conclusions for the membership function of the output variables. The result of the accumulation is defined as a union of fuzzy sets of all sub-conclusions of a fuzzy rule base with respect to the corresponding linguistic variable using the max-union:
m( y) = max {mB (y); 1^0 (y); (y); m 22 (y)}. (13)
In accumulating all truth degrees of the output parameter, which were presented in sec.
2.4, the fuzzy set of the output variable was obtained, and is identical to the formula 12.
The fuzzy inference of rules in the MATLAB editor is shown in figure 4.
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
125
Fig. 4. The fuzzy inference of rules in the MATLAB editor
2.6. The defuzzification
The defuzzification is an inverse transformation of the fuzzy set A in the crisp set B. The aim of a defuzzification is to obtain quantitative values, using the results of the accumulation of output linguistic variables. These values can be used by external to the fuzzy inference system devices (executive mechanisms of the computer-aided management system of an agricultural enterprise). In this model, the identification of conditions for seeding (probability of favorable conditions) is performed by the method of the center of gravity, which calculates the centroid of the area:
fymax , . , Г Vmax s \ i
ym(y)dy /1 m(y)dy
* Vmin J V™„
Vmax Vmin
(14)
where [ymax; ymin ] - is a medium of a fuzzy set of an output linguistic variable.
So, when the humidity level is 59%, the density is 1.1 gm/cm , the temperature is 7.52 °C, the runtime term is April 8th, after defuzzification the output parameter was 0.89. There are optimal conditions for sugar beet seeding, and may be used by agriculturist for making the decision about including work «seeding» in the executive plan on date April 8th.
Moreover, the surface of the "input-output" was obtained by the results of the fuzzy inference. The surface shows the dynamics of the execution conditions for sugar beet seeding (see fig. 5 a-d).
Thus, the dynamics of the computer-aided management system of an agricultural enterprise with fuzzy controller is totally based on the architecture of the fuzzy inference system: on method of construction and content of base production rules and on the method of implementation of the algorithm of the fuzzy inference. In the design of the fuzzy system the experts and expert poll methodologies must be carefully chosen and the rule base formed. The choice of implement ways of each stages of the algorithm of fuzzy inference is made to greater extent intuitively, since there are no complete and holistic methods of synthesis of the fuzzy inference algorithm on the basis of production rules, which is allowed to realize fuzzy control in accordance to any preset assessment of the required quality of the control. Typically, the choice of the specific fuzzy inference algorithm is carried out empirically from a limited number of possible implementations.
126
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
a b
c d
Fig. 5. Dependence of favorable conditions for sugar beet seeding from the runtime term and the temperature a), from the temperature and the humidity b), from the density and the humidity c), from the runtime
term and the density d)
The above given inference system is a system of Mamdani-Zadeh. The choice of fuzzy model of type Mamdani is caused by the fact that the rules of the knowledge base are clear and intuitive, whereas for Sugeno-type models it is not always clear which linear dependences "input - output" should be used and how to get them.
3. Conclusion
The developed model of the expert system on the basis of a fuzzy logic and field conditions allows finding the best solution of the problem of formulation and correction of the executive plan of work when field conditions are being changed in real time.
The main advantages of designing of a model of the expert system on the basis of a fuzzy logic are:
1) a support of the development of a rapid prototype of the expert system with an increasing complexity of a functionality;
2) for an agronomist it is more understandable a fuzzy logic model than the similar mathematical model on the basis of differential or difference equations;
3) a method of fuzzy sets allows to include qualitative variables in the analysis and to operate with fuzzy input data and linguistic criteria;
4) fuzzy models are simpler to implement in comparison with traditional control algorithms of technical systems.
ISSN 1028-9763. Математичні машини і системи, 2014, № 4
127
REFERENCES
1. Бальченко І.В. Особливості побудови автоматизованої системи управління
сільськогосподарським підприємством / І.В. Бальченко, В.В. Литвинов, В.П. Клименко // Математичні машини і системи. - 2013. - № 4. - С. 82 - 94.
2. Balchenko I. Features of planning technologies in computer-aided management systems of an agricultural enterprise / I. Balchenko, V. Lytvynov, M. Shulga // International Journal “Information Models and Analyses”. - 2014. - Vol. 3, N 3. - P. 263 - 270.
3. Zadeh L.A. Fuzzy sets as basis for a theory of possibility / L.A. Zadeh // Fuzzy Sets and Systems. -1978. - N 1. - P. 3 - 28.
4. Sivanandam S.N. Introduction to fuzzy logic using MATLAB / Sivanandam S.N., Sumathi S., Deepa
5. N. - Springer Berlin Heidelberg New York, 2007. - 441 p.
Стаття надійшла до редакції 23.10.2014
128
ISSN 1028-9763. Математичні машини і системи, 2014, № 4