# Cooperative Admission Control with Network Coding in 5G Underlying D2D-Satellite Communication
## Problem Formulation
### Cooperative Admission Control with Multiple Access Network Coding (JAMANC Algorithm)
At each iteration, within two directions, the algorithm finds a neighbor set of the current solution, which are \(V_{left}\) or \(V_{right}\) by calling \(Break^{\prime}Joint(V_{left},MPFL)\) or \(Break^{\prime}Joint(V_{left},JPFL)\). The algorithm evaluates all the neighbors' stable matchings by cost function \(f(V)\). The algorithm jumps to the next solution, which gives the smallest value of the \(f(V)\). The algorithm can also select the next solution to be a random neighbor with minimum probability to avoid getting stuck in a local optimum solution. If the next solution turns to be worse, then that direction is discarded. Similarly, if the best current solution of the direction is better than the previous, then the best is assigned to the current solution. The algorithm moves the current solution to the next and repeats all the steps. The algorithm terminates if either one of the directions has no neighbors left or two directions meet each other utilizing the MPFL mode assignment. If both forward and backward searches pause and the MPLF cost of the current matching of the forward search MPFL(\(V_{left}\)) is equal or higher then backward MPFL(\(V_{right}\)), then the results are obtained from bi-directional. This gives the best solution so far and terminates at this point. ```
Input: An instance \(l\) of ATPSPS(J(PFL)-MANC (MPFL) matching. Output: A stable matching (Mode identification). 1.\(V_{left}\):= GALESHAPLEY(I,MPFL); \(\longrightarrow\) MPFL propose JPFL;
2.\(V_{Right}\):= GALESHAPLEY(I,JPFL); \(\longrightarrow\) JPFL propose MPFL;
3.if\(l(V_{left}<f(V_{Right}))\) then
4.\(V_{best}\): = \(V_{left}\)
5. else
6.\(V_{best}\): = \(V_{Right}\)
7. end
8. Forward := Valid;
9. Backward:= Valid;
10.while (valid) do
11. if (forward) then
12.\(neighborSet\):= \(\odot\);
13. for (each device in the MPFL set) do
14.\(Stable\)\(Matching\):= \(REAK\)'\(JOINT(M_{left}\), MPFL)
15.\(neighborSet\):=(neighborSet) \(\cup\) (stable Matching)
16. end
17. if (small random probability \(p\)) then
18.\(M_{next}\) := a random matching in \(neighborSet\);
19. else
20.\(V_{next}\) := arg \(min_{V_{neighborSet}}(f(V))\);
21. if \((f(Vnext)\leq f(Vleft))\) then
22. forward := In Valid
23. if \((f(V_{best})<f(V_{left}))\) then
24.\(V_{best}\) := \(V_{left}\)
25. end
26. end
27.\(V_{left}\) := \(V_{next}\)
28. end
29. if (backward) then
30.\(neighborSet\):= \(\odot\);
31. for (each device in JPFL set) do
32.\(stableMatching\) := \(REAK\)'\(JOINT(V_{Right},JPFL)\)
33.\(neighborSet\):= \((neighborSet)\cup(stableMatching)\)
34. end
35. if (small random probability \(p\)) then
36.\(V_{next}\) := a random matching in neighborSet;
37. else
38.\(V_{next}\) := arg \(min_{V_{neighborSet}}(f(V))\);
39. end
40. if \((f(V_{next})>f(V_{right}))\) then
41.\(backward\) := Invalid
42. if \(f(V_{best})>f(V_{right})\) then
43.\(V_{best}\) := \(V_{right}\)
44. end
45. end
46.\(V_{right}\) := \(V_{next}\)
47. end
48. if ((not forward) and (not backward)) then
49. if (MPFL(\(V_{left}\)) \(\leq JPFL(V_{right})\)) then
50. Forward := Valid
51. Backward := Valid
52. else
53. Break;
54. end
55. end
56. end
57.while end
58. Return \(V_{best}\)
```  
**Algorithm 5**JAMANC Algorithm