# Robust and Secure Data Transmission Using Artificial Intelligence Techniques in Ad-Hoc Networks
## 4 Proposed Work
### Use of ML Techniques
#### 4.4.1 Artificial Neural Network (ANN)  
ANN is a technique of machine learning that is designed to work like a human brain. The working of ANN is similar to how a human brain works and memorizes from experience. ANN is a non-linear statistical model which processes input to discover a new pattern. The ANN consists of three layers as discussed below. The process involves two attributes, namely energy consumption and delay, that are combined to create a single weight. This weight is then passed to one input node as illustrated in Figure 8.  
Input layer: The input regarding the number of the optimized route is obtained based on the node's properties, such as packet delay and energy consumed by nodes, which is provided as input information to the ANN. Hidden Layer: This is positioned between the input and output of ANN. It can be single or multiple layers. Here, we used a single hidden layer. The main function of this layer is to process the input data to know the relationship between the attributes fed to the input layer. Output layer: The resultant value after computation is obtained at this layer. The ANN computes the input values and provides the best route with minimum energy consumption and delay. The complete structure of ANN is shown in Figure 8.  
Depending upon the optimized properties of nodes, the final output is obtained. The discrepancy between the input values and the output values is obtained in terms of error values. Based upon the error value, the weight of neurons in the hidden layer is adjusted and this process is known as backpropagation. Each neuron consists of two states which are 0 and 1, corresponding to deactivation and activation of the sigmoid function. Each neuron composed of weight \(\mathrm{W_{ij}}\) corresponds to its interconnection. The case of \(\mathrm{W_{ij}}\) = 0 represents the independence of the neuron, if \(\mathrm{W_{ij}}\) = \(\mathrm{W_{ji}}\) this shows that weights are symmetric. Every neuron behaves as an individual unit of an ANN structure with a non-linear transfer function given by Equation (1). \[\mathrm{f(x_{i})}=\mathrm{Y_{i}}=\mathrm{x_{i}} \tag{1}\]  
The neuron's output is fed back to the other interconnected neurons by the linked weight of \(\mathrm{W}\) = \(\mathrm{W_{ij}}\). In the form of hardware, the weight corresponds to resistance, and weight in terms of resistance is given by Equation (2). \[\mathrm{W_{ij}}=\frac{1}{\mathrm{R_{ij}}} \tag{2}\]  
The ANN includes two inputs: one is the external input and the other is the output of network neurons. Therefore, the total input to the neuron can be given by Equation (3). \[\sum_{\mathrm{j}\
eq 1}\frac{\mathrm{x_{i}}}{\mathrm{R_{ij}}}+\mathrm{In_{i}} \tag{3}\]  
\(\mathrm{R_{ij}}\) represents the resistance/interconnection of weight between neurons 'i' and 'j'. The output is obtained in the output layer of ANN in the form of two-state values. The output Y_j of output neuron 'j' provides values like Y_j'0 and Y_j'1, which represent  
Figure 8: ANN Structure. values corresponding to 0 and 1, respectively. The output of input neuron (i) of x_i can be represented by Equation (4). \[\text{If}\left(\sum_{j\
eq\text{i}}\frac{\text{x}_{\text{j}}}{\text{R}_{\text{ ij}}}+\text{In}_{\text{i}}<\text{x}_{\text{j}}\right)\left\{\text{x}_{\text{j}}= \text{x}_{\text{i}}^{0}\right\} \tag{4}\]  
The state of the ANN can be identified by determining the energy function of the neurons. Mathematically, it can be represented by Equation (5). \[\text{E}=-\frac{1}{2}\sum_{\text{i=1}}^{\text{N}}\sum_{\text{j=1}}^{\text{N}} \frac{\text{x}_{\text{i}}\text{x}_{\text{j}}}{\text{R}_{\text{ij}}}-\sum_{ \text{i=1}}^{\text{N}}\text{In}_{\text{i}}\text{x}_{\text{i}} \tag{5}\]  
The energy is varied due to the alteration in the state-run of neurons (i) [13; 35]. Therefore, the deviation in energy can be represented by Equation (6).