You are on page 1of 6

Food Control 18 (2007) 928933

www.elsevier.com/locate/foodcont

A neural network for predicting moisture content of grain


drying process using genetic algorithm
Xueqiang Liu, Xiaoguang Chen, Wenfu Wu *, Guilan Peng
Biological and Agricultural Engineering School, Jilin University, Changchun 130025, China
Received 13 January 2006; received in revised form 18 May 2006; accepted 22 May 2006

Abstract
This paper is concerned with optimizing the neural network topology for predicting the moisture content of grain drying process using
genetic algorithm. A structural modular neural network, by combining the BP neurons and the RBF neurons at the hidden layer, was proposed to predict the moisture content of grain drying process. Inlet air temperature, grain temperature and initial moisture content were
considered as the input variables to the topology of neural network. The genetic algorithm is used to select the appropriate network architecture in determining the optimal number of nodes in the hidden layer of the neural network. The number of neurons in the hidden layer was
optimized for 6 BP neurons and 10 RBF neurons using genetic algorithm. Simulation test on the moisture content prediction of grain drying
process showed that the SMNN optimized using genetic algorithm performed well and the accuracy of the predicted values is excellent.
2006 Elsevier Ltd. All rights reserved.
Keywords: Grain drying; Predicting; Neural network; Genetic algorithm; Moisture content

1. Introduction
Grain drying is a non-linear process with a long delay.
Its main objective is to achieve the desired nal moisture
content. Over-drying requires excessive energy and even
can damage the quality of the dried material, especially
in case of seed. On the other hand the grain will be vulnerable to mildew if the moisture content remains high. There
is an option to determine the moisture content in the drying
process by measurement but the accuracy of this approach
is not satisfactory due to the technical limitations of the
available moisture sensors used in the on-line observing
process. In case of farm dryers, the weather conditions
and dust have a great eect on the accuracy, as well.
Another way to predict the moisture content is to calculate
it based on drying air parameters using physically based
models. But the accurate model is dicult to be established
for the drying process with a long delay is non-linear.

Corresponding author. Tel.: +86 431 5691908.


E-mail address: wwf@email.jlu.edu.cn (W. Wu).

0956-7135/$ - see front matter 2006 Elsevier Ltd. All rights reserved.
doi:10.1016/j.foodcont.2006.05.010

Recently, the articial intelligence methods as well as neural networks have been proposed for process control of
grain drying.
The articial neural network (NN) is a well-known tool
for solving complex, non-linear biological systems
(De Baerdemaeker & Hashimoto, 1994) and it can give reasonable solutions even in extreme cases or in the event of
technological faults (Lin & Lee, 1995). Huang and Mujumdar (1993) created a NN in order to predict the performance of an industrial paper dryer. The NN model by
Jay and Oliver (1996) was used for predictive control of
drying process. Trelea, Courtois, and Trystram (1997) used
explicit time and recurrent NNs for modelling the moisture
content of thin-layer (5 cm) corn during the drying process
and for wet-milling quality at constant air ow rate and
absolute humidity and variable temperature. Thyagarajan,
Panda, Shanmugam, Rao, and Ponnavaikko (1997) modelled an air heater plant for a dryer using a NN. Sreekanth,
Ramaswamy, and Sablani (1998) predicted psychometric
parameters using various NN models. Kaminski, Strumillo, and Tomczak (1998) used a NN for data smoothing
and for modeling material moisture content and tempera-

X. Liu et al. / Food Control 18 (2007) 928933

ture. Farkas, Remenyi, and Biro (2000a, 2000b) set up a


NN to model moisture distribution in agricultural xedbed dryers. It is clear from past literature that NNs are
good for modelling drying process.
The selection of an appropriate NN topology to predict
the drying process is important in terms of model accuracy
and model simplicity. The architecture of a NN greatly inuences its performance. Many algorithms for nding the optimized NN structure are derived based on specic data in a
specic area of application (Blanco, Delgado, & Pegalajar,
2000; Boozarjomehry & Svrcek, 2001), but predicting the
optimal NN topology is a dicult task since choosing the
neural architecture requires some priori knowledge of grain
drying and/or supposes many trial-and-error runs.
In this paper, we present a genetic algorithm capable of
obtaining not only the trained optimal topology of a neural
network but also the least number of connections necessary
for solving the problem. In the following sections, the techniques used in this paper are briey reviewed, and the
design of the NN system for predicting the grain drying
process is discussed in detail. A grain drying process is used
to demonstrate the eectiveness of the neural network. The
nal section draws conclusions regarding this study.
2. Materials and methods
2.1. Neural network system
The back-propagation neural network (BPNN) is a multilayer feed-forward network with a back-propagation
learning algorithm. The BPNN is characterized by hidden
neurons that have a global response. The commonly used
transfer function in the BPNN is the sigmoid function
1
f sj
1
1 expsj
where sj is the weighted sum of inputs coming to the jth
node.
Usually, there is only one hidden layer for the BPNNs as
the availability of such a layer is sucient to produce the
set of desired output patterns for all of the training vector
pairs.
The radial basis function neural network (RBFNN)
belongs to the group of kernel function nets that utilize
simple kernel functions as the hidden neurons, distributed
in dierent neighborhoods of the input space, and whose
responses are essentially local in nature. The RBF produces
a signicant nonzero response only when the input falls
within a small-localized region of the input space. The most
common transfer function in an RBFNN is the Gaussian
activation function
!
Pn
2
i1 xi  C ki
/k exp 
; k 1; 2 . . . q
2
b2
where xi is the ith variable of input; Cki the center of the kth
RBF unit for input variable i; and b2 is the width of the kth
RBF unit.

929

Because of the dierent response characteristics of hidden neurons in these two kinds of neural networks, the
interpolation problems can be solved more eciently with
a BPNN, and the extrapolation problems are better to be
dealt with an RBFNN.
Since the dierent properties of the BPNN and the
RBFNN are complementary, Nan Jiang, Zhao, and Ren
(2002) designed a structural modular neural network
(SMNN) with genetic algorithm and showed that the
SMNN constructed a better inputoutput mapping both
locally and globally. The SMNN combine the neurons in
the generalization capabilities of BPNN and the computational eciency of RBFNN together in one network structure. Its architecture is shown in Fig. 1, which has three
layers: the input layer which takes in the input data; the
hidden layer which comprises both the sigmoid neurons
and the Gaussian neurons; and the output layer where a
linear function is used to combine the BP part and the
RBF part.
In this research, we adapt their SMNN for predicting
moisture content of grain drying process. The number of
neurons in the input and output layers are given by the
number of input and output variables in the process. The
inputs of the structure can be variables such as inlet moisture content, grain temperatures, and air temperatures,
which are easily measurable. The output of the system is
the moisture content of the grain.
2.2. Design structural modular neural network using GA
The network conguration of the SMNN can be transformed into two subset selection problems: one is the number of BP hidden neurons; and the other is the distinct
terms nc which are selected from the N data samples as
the centers of RBF hidden neurons.
There are a few types of representation schemes available for decoding the neural network architecture, such
as the binary coding and the gray scale. In the present
work, the chromosome in the GAs population is divided
into two parts. One part is a xed length chromosome that
contains the number of BP hidden neuron in binary form.
The other part is a variable length chromosome (i.e. real
coding) that represents the number and position of the
RBF hidden neurons. The centers of the RBF part are randomly selected data point from the training data set and
the center locations proposed here are also restricted to
be the data sample. The data sample xi is labeled with index
i (i = 1, 2, . . . , N), then the RBF neurons can be coded as a

output
RBF hidden node

BP hidden node
input

Fig. 1. Structural modular neural network architecture.

930

X. Liu et al. / Food Control 18 (2007) 928933

chromosome with integer values ranging from 1 to N. A


range was given for the string length, and the string should
only contain distinct terms. So the chromosome is
Ci = Bi [ Ri. For example
B1 0

1 1

B2 0

1 0

R1 13
R2 17
C1 0
C2 0

15 10
11 12
1
1

1 0
0 1

16
15
1
0

17
19
13
17

11
14

13 20

15 10
11 12

16
15

17
19

11
14

0;

B2 0

1 0

13 20

In the rst step, Ri part uses a variable length crossover


which is like uniform crossover. The common terms in both
RBF part parents are searched and two binary template
strings are created to mark the common terms in both parents. If the corresponding term is the common term, the
binary bit in the template string will be set to 1, otherwise
it will be 0. Secondly, two random numbers of distinct
terms are selected from the RBF parents and exchanged
with each other. For example, the above R1 and R2 will
do rst step crossover as follows.
First create two template strings to mark the parents:
T1 1

1 0

T2 1

1 0

0 1

14
12

20
15

17 11
19 10

13

16

After the rst step crossover, the two parent chromosomes


are changed to
1
0

1
0

0
1

13
17

15 14 20 17 11
11 12 15 19 10 13

16

To increase the diversity, the second step crossover is done


nally. Therefore, the above two chromosomes become

2.2.1. Crossover
For selected two chromosomes (parents) from the population, the crossover will be done in two steps: (1) the binary part string representing the BP neurons (Bi) and the
real number encoding part string representing the RBF
neurons (Ri) will do crossover separately; (2) the whole
chromosome does crossover in which BP string and the
whole RBF string can be switched according to a probability distribution. Therefore, Bi part uses the traditional one
single point crossover: a point is selected between 1 and
L  1 where L is the string length of the BP part. Both
Bi strings are severed at this point and the segments to
the right of this point are switched. And the crossover point
is chosen with a uniform probability distribution. For
example, if the crossover site is 3, after carrying out the rst
step crossover, the above B1 and B2 will be
1

15
11

C1 0 1
C2 0 1

where Bi represents the BP part binary code chromosome;


Ri represents the RBF part real code chromosome; and Ci
is the full length chromosome.
According to the validation method, the objective function used in this paper is the root mean squared error
(RMSE) of the test data which have not been used in the
training of the neural network. The genetic operators used
in this paper are as follows.

B1 0

R1 13
R2 17

Then exchange two distinct terms from parent 1 with two


distinct terms from the end of parent 2, and keep the common terms unchanged:

C1 0 1
C2 0 1

1
0

1
0

0
1

17 11
13 15

12
14

15
20

19
17

10 13
11

16

2.2.2. Mutation, deletion and addition


Like the crossover, for each selected chromosome from
the population, the string of the BP neurons and the string
of the RBF neurons mutate separately. A simple point
mutation is used in Bi part and the operator exchanges with
a given probability each term in Ri part with a randomly
selected term in the corresponding complementary subset
of the string. For example, the above C1 will be as follows
after mutation:
C1 0

1 0

17

11

12

15 19

48

13

16

The deletion and addition are only for RBF part to alleviate premature loss of allele diversity, which is caused by the
variable length crossover in RBF string. The deletion and
addition operators are applied to each selected string with
equal probability. For deletion operators, a random number of terms are removed from the RBF string beginning
from a randomly selected position. A random number of
terms are added to the end of the RBF string through
the addition operators. The newly added terms are randomly chosen from the complementary subset of the selected string.
The GA to evolve the SMNN structure is presented in
the following:
(1) Randomly choose an initial population of p individual chromosomes Ci (i = 1, 2, . . . , p). Each chromosome denes a network with number of b BP
hidden neurons and number of r RBF hidden neurons associated RBF center locations.
(2) Decode each chromosome. Each chromosome presents one network architecture. Using the LevenbergMarquardt algorithm to train the network and
compute the RMSE value of the training data and
the testing data for each chromosome Ci. Set the
number of generations Ng for evolution. Set counter
g = 0.
(3) Taking the RMSE of the testing data as the tness
f(Ci) (i = 1, 2, . . . , p) value of each individual chromosome. Rank tness value of each individual in
the population.

X. Liu et al. / Food Control 18 (2007) 928933

T7

T5

80

T4
T3

60

T2

40

T1
TU

20

TL

56

51

46

41

36

31

26

21

1
-20

16

TM

11

temperature/C

T6

100

time/h

Fig. 3. The grain temperatures (T1T8) and drying-air temperatures (TU,


TM, TL).

30
25
20
15
10
inlet MC

outlet MC
61

57

53

49

45

37
41

33

29

25

21

17

13

0
5

The experiment was carried out on a tower-type mixedow grain dryer with high of 26 m, section area of 16 m2
and solid ow rate from 2.4 to 4.0 m/h (see Fig. 2). The
dryer is quadrate in shape with the air in the drying section
owing through the grain column from the air plenum to
the ambient, and in the reverse direction in the cooling section. A grain turn-ow is located midway in the drying
column.
The controller of the dryer consists of the temperature
sensors, the data acquisition system, and a personal computer. The PC communicates with the sensors and the
grain-discharged motor through a data acquisition card.
The rpm of the grain-discharged motor is proportional to
05 V input to the driver of the grain-discharged motor.

T8

120

2.3. Database preparation

140

moisture contents/% w.b.

(4) Set counter g = 1, apply genetic operators to create


ospring:
(a) Use roulette wheel selection to produce the
reproduction pool.
(b) Apply two-step crossover with given probability
to two parent chromosomes in the reproduction
pool, create two ospring.
(c) Apply mutation with given probability to every
bit of the ospring.
(d) Apply deletion and addition with given probability to the RBF part strings of ospring, produce
the new generation.
(e) Decode each chromosome in new generation.
Train each network and compute the new RMSE
values of the training data and the testing data
for each new chromosome.
(f) Set g = g + 1, if g > Ng, stop. Otherwise, go to
step (a).

931

time/h

Fig. 4. The inlet and outlet moisture contents for training and testing
neural network.

In order to study the dynamics of grain drying, about


60 h of data were collected while the dryer operated
under manual performance, with air ow rate from 0.27
to 0.42 m/s, the surrounding temperature from 27 to
10 C, and the drying-air temperature from 80 to
125 C. One set data per hour are chose, so there are 60 sets
data to be used to training and testing the neural network.
Figs. 3 and 4 show all the input graphs used for training the
NN.
3. Results and discussion

Fig. 2. Schematic of the tower-type mixed-ow grain dryer (T1T8 are the
grain temperatures).

The experiments are carried out with the SMNN algorithm proposed in this paper. For comparison purpose,
the results by using the evolved BPNN alone and by using
the evolved RBFNN alone are also calculated.
In this paper, the inlet moisture content (Min), grain
temperatures (T1T8) and drying-air temperatures (TU,
TM, TL) are taken as the input parameters, while the outlet
moisture content (Mout) as output parameter. Thus the
SMNN aims to nd a mapping f such that Mout = f(T1,
T2, T3, T4, T5, T6, T7, T8, TU, TM, TL, Min). The SMNN
used here has 12 neurons in the input layer and one neuron
in the output layer. The number of the hidden layer is
decided by the GA algorithm proposed in this paper.
The numbers of data for neural network training and
testing are 40 sets and 20 sets, respectively. The initial chromosome length of the BP part is 5. For the RBF part, the
minimum string length is dened as 2 and the maximum

X. Liu et al. / Food Control 18 (2007) 928933

average MSE
minimum MSE

MSE for test data

best result

0.08
0.06
0.04

49

46

43

40

37

34

31

28

25

22

19

16

13

10

0.02
0

generation

testing results

Epochs

Fig. 6. The MSE for training and testing data.

241

226

211

196

181

166

151

136

121

106

91

76

61

46

31

16

training results

MSE

Fig. 5. The average and minimum MSE for testing data in each
generation.

0.12
0.11
0.1
0.09
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0

SMNN
BPNN
RBFNN

Number of
hidden neurons

MSE of
training data

MSE of
testing data

6-BP, 10-RBF
22
42

0.0298
0.0304
0.0309

0.0312
0.0368
0.0336

17
16
15
14
13
12

57

53

49

45

41

37

33

29

25

21

17

13

10

11

time/h

Fig. 7. The predicted outlet moisture contents by SMNN. Solid line:


predicted data; dash line: measured data.

neurons). The comparison between the evolved SMNN


and the evolved BPNN and RBFNN can be seen at Table
1. It is clear that even though the generalization error of
evolved BPNN and RBFNN are similar as the evolved
SMNN, the evolved SMNN performs slightly better on
the testing data and the complexity of the evolved SMNN
is signicantly reduced compared with the other two
networks.
The predicted result from simulation test on the moisture content prediction of grain drying process based on
the SMNN is shown in Fig. 7. The gure shows that the
accuracy of predicted value is excellent.

0.12
0.1

Table 1
MSE of grain drying process prediction

string length is 20. The population size is chosen as 20. The


probabilities for the crossover and the mutation are 0.5 and
0.02, respectively, and the probability of deletion and addition is taken as 0.04. The above GA parameters are selected
after a series of trial and error runs. Since the training set
containsP40 distinct terms, the search space therefore con13
i
tains 25 20
dierent networks. The geni2 C 40 1:98  10
eration number is set to be 50.
The evolution of average and minimum MSE of the testing data are shown in Fig. 5, where the average MSE is the
average value of MSE in the whole chromosomes for each
generation and the minimum MSE is the minimum one in
the whole population. The best result is the record of the
minimum value for one particular GA run. Fig. 5 indicates
that the average MSE decreases through the evolution and
the best generalization network is emerged at the 32th generation. For the best performance SMNN, the MSE values
on the training data and the testing data are 0.0298 and
0.0312, as shown in Fig. 6. The algorithm automatically
searches for the appropriate network size according to
the given objective. The best SMNN is at the 32th generation which has least neurons (6 BP neurons and 10 RBF

moisture content/% w.b.

932

4. Conclusions
As would be expected there was a fairly strong inuence
of the NN topologies on the accuracy of the estimation.
Therefore, the selection of the most appropriate NN topology was the main issue. In this paper, the SMNN has been
proposed which comprises sigmoid and Gaussian neurons
in the hidden layer of the feed-forward neural network.
The GA is used to select the appropriate network architecture in determining the optimal number of nodes in the hidden layer of the SMNN. Since the GA is a global search
method, so it has less probability of being trapped at local
minima. It has been demonstrated that the proposed
SMNN algorithm can automatically determine the appropriate network structure, and the experimental results show
good performance of the SMNN over the BPNN and the
RBFNN.
This study also shows that neural network modeling can
be used to obtain good accurate of moisture content prediction during grain drying process over a wide experimen-

X. Liu et al. / Food Control 18 (2007) 928933

tal range. The technological interest of this kind of modeling must be related to the fact that it is elaborated without
any preliminary assumptions on the underlying mechanisms. The applications of neural networks and genetic
algorithm can be used for the on-line prediction and control of drying process.
Acknowledgements
This work was elaborated within the project of Precise
Drying System of Maize, No. 05EFN217100439 funded
by the Ministry of Science and Technology of Peoples
Republic of China.
References
Blanco, A., Delgado, M., & Pegalajar, M. C. (2000). A genetic algorithm
to obtain the optimal recurrent neural network. International Journal
of Approximate Reasoning, 23, 6783.
Boozarjomehry, R. B., & Svrcek, W. Y. (2001). Automatic design of
neural network structures. Computers and Chemical Engineering, 25,
10751088.
De Baerdemaeker, J., & Hashimoto, Y. (1994). Speaking fruit approach to
the intelligent control of the storage system. In Proceedings of 12th
CIGR World Congress on Agricultural Engineering, Vol. 2, Milan,
Italy, 29 August1 September, 1994, pp. 14931500.

933

Farkas, I., Remenyi, P., & Biro, A. (2000a). A neural network topology
for modelling grain drying. Computers and Electronics in Agriculture,
26, 147158.
Farkas, I., Remenyi, P., & Biro, A. (2000b). Modelling aspects of grain
drying with a neural network. Computers and Electronics in Agriculture, 29, 99113.
Huang, B., & Mujumdar, A. S. (1993). Use of neural network to predict
industrial dryer performance. Drying Technology, 11(3), 525541.
Jay, S., & Oliver, T. N. (1996). Modelling and control of drying processes
using neural networks. In Proceedings of the tenth international drying
symposium (IDS96), Krakow, Poland, 30 July2 August, Vol. B, pp.
13931400.
Jiang, N., Zhao, Z., & Ren, L. (2002). Design of structural modular neural
networks with genetic algorithm. Advances in Engineering Software, 34,
1724.
Kaminski, W., Strumillo, P., & Tomczak, E. (1998). Neurocomputing
approaches to modelling of drying process dynamics. Drying Technology, 16(6), 967992.
Lin, C. T., & Lee, C. S. G. (1995). Neural Fuzzy Systems. Englewood
Clis, NJ: Prentice Hall.
Sreekanth, S., Ramaswamy, H. S., & Sablani, S. (1998). Prediction of
psychrometric parameters using neural networks. Drying Technology,
16(35), 825837.
Thyagarajan, T., Panda, R. C., Shanmugam, J., Rao, P. G., &
Ponnavaikko, M. (1997). Development of ANN model for non-linear
drying process. Drying Technology, 15(10), 25272540.
Trelea, I. C., Courtois, F., & Trystram, G. (1997). Dynamic models for
drying and wet-milling quality degradation of corn using neural
networks. Drying Technology, 15(3 and 4), 10951102.

You might also like