# TRUST-ME: Trust-Based Resource Allocation and Server Selection in Multi-Access Edge Computing
## 3 Trust-Based Reinforcement-Learning-Enabled MEC Server Selection
### Influuencers' Direct Trust  
The level of direct trust a user places in an MEC server depends on whether the MEC server meets the user's minimum utility threshold, which is symbolized as \(U_{n}\), and its latency constraint \(T_{n}\) [sec]. This is measured through the ratings \(\hat{r}_{1,s,n}\in[0,1]\) and \(\hat{r_{2,s,n}}\in[0,1]\), respectively, which the user assigns to the MEC server based on the computing capacity that the latter one offers. The user's ratings are evaluated under two distinct conditions:  
**Case 1**: If the user's requirements are satisfied, meaning \(U_{n}\leq u_{n}\) and \(T_{n}\geq t_{n}\), the MEC server receives a perfect satisfaction rating of 1 for the computing capacity service. Thus, the final rating given to the MEC server is \(\hat{r}_{s,n}=\hat{r}_{s,n}\). **Case 2**: If the computing capacity service provided by the MEC server does not meet the user's utility and latency constraints, the user's satisfaction rating will reflect the gap between the actual utility received and the minimum required utility, and the latency constraint gap, respectively. The ratings provided under the two cases considering the experienced utility and latency are given in Equation (4) and Equation (5), respectively:  
\[\hat{r}_{1,s,n}=\left\{ \begin{array}{ll}\hat{r}_{s,n}&,\text{if }U_{n}\leq u_{n}\\ \frac{u_{n}-U_{n}}{U_{n}}&,\text{if }U_{n}>u_{n}\end{array} \right. \tag{4}\]\[\tilde{r}_{2s,n}=\left\{ \begin{array}{ll}\tilde{r}_{s,n}&,\text{ if }T_{n}\geq t_{n}\\ \frac{T_{n}}{t_{n}}-1&,\text{ if }T_{n}<t_{n}\end{array} \right. \tag{5}\]  
By combining the two ratings in an overall rating \(\tilde{r}_{s,n}\) provided by the user to the MEC server, the corresponding overall rating is derived as follows by considering that the user considers the satisfaction of its utility and latency constraints to be equally important:  
\[\tilde{r}_{s,n}=0.5\cdot\tilde{r}_{1s,n}+0.5\cdot\tilde{r}_{2s,n} \tag{6}\]  
In Case 1, the ratings \(\tilde{r_{1s,n}}\) and \(\tilde{r_{2s,n}}\) are non-negative and are both set to 1. In Case 2, the ratings for both variables are negative and within the range of \([-1,0)\). To address this, we employed the min-max normalization technique, which is a common method for data normalization, to transform the piecewise rating function from \([-1,1]\) to \([0,1]\), as demonstrated below:  
\[r_{s,n}=\frac{\tilde{r}_{s,n}-\min_{\forall i\in\mathcal{N}_{n,s}}\{\tilde{r} _{s,n}\}}{\max_{\forall i\in\mathcal{N}_{n,s}}\{\tilde{r}_{s,n}\}-\min_{ \forall i\in\mathcal{N}_{n,s}}\{\tilde{r}_{s,n}\}}=\frac{\tilde{r}_{s,n}+1}{2} \tag{7}\]  
where \(\mathcal{N}_{n,s}\) refers to the set of computing service times provided to user \(n\) by MEC server \(s\). The expression \(f(t_{i})\) captures the time decay factor, which reflects how the user's earlier ratings lose their relevance over time in terms of impacting the user's trust in an MEC server, and is defined as follows:  
\[f(t_{i})=\exp(-\lambda(t-t_{i})) \tag{8}\]  
where \(\lambda\), \(t\), and \(t_{i}\) are the rate of decay, current service time, and historical service time, respectively. The decay rate \(\lambda\) is used in the time decay function to reduce the impact of older feedback on the current trust value. If \(\lambda\) is high, then the older feedback will decay faster, and thus, the recent interactions will significantly influence the trust metric. This can be beneficial in dynamic environments where recent performance is more indicative of future behavior. On the other hand, if \(\lambda\) is low, then the feedback decays slowly, and thus, more weight is given to historical data. This can stabilize the trust metric in environments where performance is consistent over time.