# An Enhanced Distributed Data Aggregation Method in the Internet of Things
## 3 Proposed Method (LA-RPL)
### Data Aggregation Scheme Based on Learning Automata  
As a novel research topic, the learning mechanism of alive organisms classifies into two general categories. The first category deals with recognizing the learning principles of organisms and the relevant stages. The second category deals with presenting a methodology of placing such principles in a machine. Learning is defined as the occurred changes in a system efficiency based on the former experience. One of the essential features of a learner system is the ability to improve the performance of itself with the passage of time. To put in mathematical explanation, the main objective of a learner system is to optimize a task which is not entirely recognized. Therefore, one of the approaches of this problem is to decrease the objectives of learner system into an optimization problem defined on a set of parameters; the aim of which is to find the set of optimal parameters. A Learning Automata considered as an abstract object with a finite number of operations. Learning Automata operates through choosing one operation from the operation set and applying that operation to the environment. The applied operation is evaluated by a random environment, and the learning automata employs the environmental response to choose its next operation. During this procedure, the automata learn to choose the optimal operation. How to utilize the environmental response of the former operation in selecting the next operation is specified by the learning algorithm of the automata [41]. A learning automata consists of two main components [42]:  
Figure 7: The proposed DIO packet format. Random automata with a limited number of operations and a random environment communicating with the automata. * The learning algorithm through which the automata learns the optimal operation. A random automata defined as the fourfold set \(LA\equiv\{\alpha,\ \beta,\ p,\ T\}\), where \(\alpha\equiv\{\alpha_{1},\ \alpha_{2},\ \ldots,\ \alpha_{n}\}\) is the set of automata's operations (n denotes the number of automata's operation), and \(\beta\equiv\{\beta_{1}\,\beta_{2}\,\ \ldots,\ \beta_{m}\}\) is the input set of automata. The environment is denoted by the fourfold set of \(E\equiv\{\alpha,\ \beta,\ c,\ d\}\), where \(c\equiv\{c_{1},c_{2},\ \ldots,\ c_{n}\}\) is the set of penalty probabilities and \(d\equiv\{d_{1},\ d_{2},\ldots,d_{n}\}\) denote the automata's bonuses. The environment input is one of the \(n\) selected operations of the automata. The output (i.e., response) of the environment to each operation \(i\) is denoted by \(\beta i\). If \(\beta i\) is a binary response, the environment is denominated as \(P\)_-model_. In such an environment, \(\beta i(n)=1\) is construed as the unfavorable response, or failure; and \(\beta i(n)=0\) is considered as favorable response, or success. Set \(c\) denoting the penalty (failure) probabilities of the environment responses is defined  
\[c_{i}=Prob\{\beta(n)=1\big{|}\alpha(n)=\alpha_{i}\},\ i=\{1,2,3,\ldots n\} \tag{1}\]  
where the probability of receiving an unfavorable response from the environment is denoted by \(\alpha_{i}\). Note that \(\alpha_{i}\) values are unspecified, and it is supposed that all values of \(c_{i}\) have a unique minimum value. In the same way, the environment can be demonstrated as a set of bonus (success) probabilities (i.e., \(\{d_{i}\}\)) where \(d_{i}\) denotes the probability of receiving favorable a response from operation \(\alpha_{i}\). The relation between the random automata and environment is shown in Figure 8. This set as well as the learning algorithm are denominated as _Stochastic Learning Automata_. In a similar manner, the stochastic learning automata can be demonstrated by the fourfold set \(LA\equiv\{\alpha,\ \beta,\ p,\ T\}\), where \(p=\{p_{1},\ p_{2}\,\ \ldots,\ p_{n}\}\) is the border of the probabilities of automata's operations, and \(T\equiv p(n+1)=T[\alpha(n),\ \beta(n),\ p(n)]\) is the learning algorithm.