# Resource Allocation for Network Slicing in RAN Using Case-Based Reasoning
## 2 System Model
### Dataset  
The experiments were performed using a dataset comprising of \(n\) cases in the case library plus a second set of test cases. To populate the case library we chose the \(n\) combinations to be uniformly distributed across the cell with a mix of different numbers of users in each slice. For each case, the value of the slice ratio was obtained by exhaustive search with a step length of 0.01 allocated within the slice to each user chosen using proportional fair scheduling. The best slice ratio was then linked to that user distribution to create a case that could be saved in the case library (Table 1).  
The pseudocode of the case library build is given in Algorithm 1.  
```
0: Bandwidth \(W\); \(Searchstep=0.01\);
0: Case library;
1:for each \(i\in[1,n]\)do
2:\(\omega_{1}=0.01\), \(\omega_{2}=0.99\), \(QUR_{old}=0\)
3: Insert user randomly, \(U=\{U11,U12\ldots U(a*b)1,U(a*b)2\}\);
4:for\(j=0\); \(j<j\); \(j++\)do
5:\(B1=W*\omega_{1},B2=W*\omega_{2}\);
6: Resource allocation for U1 and U2 and caculate QUR by Equation (2).
7:if\(QUR>QUR_{old}\)then
8:\(QUR^{*}=QUR\);
9:else
10:\(QUR^{*}=QUR_{old}\);
11:endif
12:\(QUR_{old}=QUR\);
13:\(\omega_{1}+=Searchstep\), \(\omega_{2}-=Searchstep\)
14:endfor
15: Case library add \(\{i,U,[\omega_{1},\omega_{2}],QUR^{*}\}\);
16:endfor
17:return Case library;
```  
**Algorithm 1** Pseudocode of case library build.  
### Dataset  
The experiments were performed using a dataset comprising of \(n\) cases in the case library plus a second set of test cases. To populate the case library we chose the \(n\) combinations to be uniformly distributed across the cell with a mix of different numbers of users in each slice. For each case, the value of the slice ratio was obtained by exhaustive search with a step length of 0.01 allocated within the slice to each user chosen using proportional fair scheduling. The best slice ratio was then linked to that user distribution to create a case that could be saved in the case library (Table 1).  
The pseudocode of the case library build is given in Algorithm 1.  
```
0: Bandwidth \(W\); \(Searchstep=0.01\);
0: Case library;
1:for each \(i\in[1,n]\)do
2:\(\omega_{1}=0.01\), \(\omega_{2}=0.99\), \(QUR_{old}=0\)
3: Insert user randomly, \(U=\{U11,U12\ldots U(a*b)1,U(a*b)2\}\);
4:for\(j=0\); \(j<j\); \(j++\)do
5:\(B1=W*\omega_{1},B2=W*\omega_{2}\);
6: Resource allocation for U1 and U2 and caculate QUR by Equation (2).
7:if\(QUR>QUR_{old}\)then
8:\(QUR^{*}=QUR\);
9:else
10:\(QUR^{*}=QUR_{old}\);
11:endif
12:\(QUR_{old}=QUR\);
13:\(\omega_{1}+=Searchstep\), \(\omega_{2}-=Searchstep\)
14:endfor
15: Case library add \(\{i,U,[\omega_{1},\omega_{2}],QUR^{*}\}\);
16:endfor
17:return Case library;
```  
**Algorithm 2** Pseudocode of case library build.  
Figure 2: CBR framework.  
We have \(d\) attributes (i.e., one attribute for each segment) and \(n\) cases in the library, where each attribute represents the number of users in each segment. Here, we denote the query case as a matrix \([q_{1},q_{2},\ldots q_{m}]\). Similarly, each case \(c\) in the library contains \(d\) attributes \(A_{c1}\), \(A_{c2}\), \(\cdots A_{cd}\). Note that for simplicity in this feasibility stage, we restrict the attribute value per segment to one. The ratio of S1 and S2 users in each case remains unchanged.