## 3 Data Delivery Mechanism
### Modeling Cost Function by Employing NN Concept  
The link cost function depends on the input features based on the characteristics of wireless propagation, channel contention, and topological environment surrounding a node such as HMRR denoted as \(x_{1}\), QL denoted as \(x_{2}\), RSS denoted as \(x_{3}\), and HD denoted as \(x_{4}\). We also generalize the number of inputs during derivation of the cost function because the number of inputs is varied according to applications. The link cost function can be characterized as a nonlinear function of a weighted sum of the inputs as seen in Equation (1). In general, each weight value is determined by the importance of the corresponding input:  
\[\textit{Cost}_{i}=f(X_{i}\cdot W^{T}) \tag{1}\]  
where \(\textit{Cost}_{i}\) is the link cost of the \(i\)th neighbor node out of \(N\) neighbor nodes and \(f\) is a nonlinear function. \(X_{i}\) is the input vector collected from the \(i\)th neighbor node, composed of [\(x_{i,1}\), \(x_{i,2}\),..., \(x_{i,n}\)] (\(n\) is the number of inputs) and \(W\) is the corresponding weight vector composed of [\(w_{1}\),\(w_{2}\),...,\(w_{n}\)]. Also, \(T\) is the notation of vector transpose. For fair comparison in the function, we normalize each input into the range in [0, 1] using min. and max. value of each input samples. The equation can be represented in a two layered NN in which the input layer consisted of input features and the output layer with the activation function f as seen in Figure 2.  
As in Figure 2, we employ log function as the nonlinear function \(f\) because of its promising characteristic. By using a log function as in Equation (2), many natural processes have a history dependent progression in which it begins small and accelerates to some point and then approaches to a saturation point over input features:  
\[Cost_{i}=log(X_{i}\cdot W^{T}) \tag{2}\]  
Now, let's discuss the connectivity of the inputs in the network. In Figure 2, all inputs are fully connected to the function. It is just like black-box style connection which is commonly used in NN. However, we intuitively know that some inputs are highly correlated to generate the output of the cost function. For instance, if HMRR(\(x_{1}\)) is high then QL(\(x_{2}\)) and RSS(\(x_{3}\)) are high because they are correlated among them. To take this into the consideration, we connect the inputs in the coupled and uncouple connection style according to whether inputs are correlated or uncorrelated to the hidden layer which is the output layer in Figure 2, as seen in Figure 3. There is no weight on the connections between the hidden layer and the output layer. For instance, the connections of \(x_{1}\), \(x_{2}\), and \(x_{3}\) are coupled and that of \(x_{4}\) is uncoupled in the PCNN. Figure 3: Link cost function represented in PCNN. Figure 2: Link cost function represented in a two-layered neural network. From Figure 3, our derived cost function can be formulized as Equation (3):  
\[Cost_{i}=\sum_{j}log\big{(}X_{i,c,j}\cdot W_{c,j}^{T}\big{)}+\sum_{k}log\big{(}x_ {i,u,k}\cdot w_{i,k}^{T}\big{)} \tag{3}\]  
where \(X_{i,c,j}\) and \(x_{i,u,k}\) are the \(j\)th coupled(\(c\)) input vector set and the \(k\)th uncoupled(\(u\)) input collected from the \(i\)th neighbor node respectively. \(W_{c,j}\) and \(w_{i,k}\) are the corresponding weight vector set and weight respectively. For instance, in our inputs, we have one coupled input vector set, \([x_{i,1},\,x_{i,2}]\) and only one uncoupled input \(x_{i,3}\). From Equation (3), the optimal performance of the cost function depends on the proper weight vector. The optimal performance of the cost function depends on the proper weight vector which can be obtained by training the cost function to reach to the maximum of the packet transmission success ratio (PTSR). To find an optimal weight vector, we imitate the training process [9] for finding the optimal weights in an NN as seen in Figure 4. Each weight in the cost function means the importance of each input for producing the link cost.