# BGP Neighbor Trust Establishment Mechanism Based on the Bargaining Game
## 3 The BGP Neighbor Trust Mechanism Based on the Bargaining Game
### Implementation of BNTE-BG Mechanism
For the benefit attribute \(x_{i}\), the payoff of \(AS_{2}\) is calculated as Formula (5)  
\[\Delta x_{i_{AS_{2}}}=x_{i}^{t_{AS_{1}}}-x_{imim_{AS_{2}}}^{pro} \tag{5}\]  
For the cost attribute \(x_{j}\), the payoff of \(AS_{2}\) is calculated as Formula (6)  
\[\Delta x_{j_{AS_{2}}}=x_{jmax_{AS_{2}}}^{pro}-x_{j}^{t_{AS_{1}}} \tag{6}\]  
Standardized processing: \(\Delta v_{i_{AS_{2}}}=\frac{\Delta x_{i_{AS_{2}}}}{x_{imax_{AS_{2}}}^{pro}-x_{ imin_{AS_{2}}}^{pro}}\); \(\Delta v_{j_{AS_{2}}}=\frac{\Delta x_{j_{AS_{2}}}}{x_{imax_{AS_{2}}}^{pro}-x_{ jmin_{AS_{2}}}^{pro}}\)Calculate the total payoff of AS\({}_{2}\) as Formula (7)  
\[U_{arg}=\sum_{e=1}^{5}\Delta v_{e_{AS_{2}}}*w^{\prime\prime}{}_{e} \tag{7}\]  
where \(W^{\prime}=\{w^{\prime\prime}_{1},w^{\prime\prime}_{2},w^{\prime\prime}_{3},w^{ \prime\prime}_{4},w^{\prime\prime}_{5}\}\) represents \(AS_{2}\)'s private preference for service quality attributes. It is set by \(AS_{2}\). Step 2: Call \([PERSON]\left(U_{agr},u^{agr}_{AS_{2}}\right)\) to determine whether to establish a neighbor relationship. \[[PERSON]\left(U_{agr},u^{agr}_{AS_{2}}\right)=\left\{ \begin{array}{ll}U_{agr}-u^{ agr}_{AS_{2}}\geq 0\;;\;\;\text{output ``Establish neighbor''}\\ U_{agr}-u^{agr}_{AS_{2}}<0\,,\,t_{AS_{2}}\leq T_{AS_{2}};\;\;\text{Continue negotiation}\\ U_{agr}-u^{agr}_{AS_{2}}<0\;;\;\;\text{output'' Establish neighbor failed''}\end{array} \right.\]
* The payoff function \(U_{req}\left(X^{(t_{AS_{2}})},X^{acc}_{AS_{1}}\right)\) and dicker judgment function \(Dick(U,u)\) are implemented as follows: When \(AS_{1}\) receives the service quality attribute quote vector \(X^{(t_{AS_{2}})}\), it calls \(Dick(U,u)\) to judge whether to establish a neighbor relationship. Step 1: Call \(U_{req}\left(X^{(t_{AS_{2}})},X^{proc}_{AS_{2}}\right)\) function to generate the total payoff \(U_{req}\). For benefit attribute \(x_{i}\), the payoff of \(AS_{1}\) is calculated as Formula (8) \[\Delta x_{i_{AS_{1}}}=x^{acc}_{imax_{AS_{1}}}-x^{t_{AS_{2}}}_{i}\] (8) For cost attribute \(x_{j}\), the payoff of \(AS_{1}\) is calculated as Formula (9) \[\Delta x_{j_{AS_{1}}}=x^{t_{AS_{2}}}_{j}-x^{acc}_{jmin_{AS_{1}}}\] (9) Standardized processing: \(\Delta v_{i_{AS_{1}}}=\frac{\Delta x_{i_{AS_{1}}}}{x^{acc}_{imax_{AS_{1}}}- x^{acc}_{imax_{AS_{1}}}}\); \(\Delta v_{j_{AS_{1}}}=\frac{\Delta x_{j_{AS_{1}}}}{x^{acc}_{imax_{AS_{1}}}- x^{acc}_{jmin_{AS_{1}}}}\) Calculate the total payoff of \(AS_{1}\) as Formula (10) \[U_{req}=\sum_{e=1}^{5}\Delta v_{e_{AS_{1}}}*w^{\prime}{}_{e}\] (10) where \(W^{\prime}=\{w^{\prime}_{1},w^{\prime}_{2},w^{\prime}_{3},w^{\prime}_{4},w^{ \prime}_{5}\}\) represents \(AS_{1}\)'s private preference for service quality attributes, It is set by \(AS_{1}\). Step 2: Call \([PERSON]\left(U_{req},u^{req}_{AS_{1}}\right)\) to determine whether to establish a neighbor relationship. \[[PERSON]\left(U_{req},u^{req}_{AS_{1}}\right)=\left\{ \begin{array}{ll}U_{req}-u^{ req}_{AS_{1}}\geq 0\;;\;\;\text{output ``Establish neighbor''}\\ U_{req}-u^{req}_{AS_{1}}<0\,,\,t_{AS_{1}}\leq T_{AS_{1}};\;\;\text{Continue negotiation}\\ U_{req}-u^{req}_{AS_{1}}<0\;;\;\text{output'' Establish neighbor failed''}\end{array} \right.\]  
Therefore, as long as AS follows the BNTE-BG mechanism during the neighbor establishment process, it can be guaranteed to establish a neighbor relationship with the trusted AS. The quote strategy function is based on the premise that AS is rational and willing to cooperate.