In this section, we devise two algorithms for the MEC servers’ deployment and requests allocation to minimize the sum of deployment cost and latency cost. The algorithms are implemented based on Java on a computer with 3.4GHz, 8.00 GB RAM, and 64 bit operating system.
5.1. Enumeration Algorithm
In this solution, we enumerate all possible deployment sets of MEC servers, and compare the total cost among all deployment sets to get the optimal deployment set with minimal total cost. As shown in algorithm 1, we first find all feasible candidate deployment sets. Then, the deployment cost of unit workload and an average latency of all requests are calculated under each feasible candidate deployment set. The main processes are shown in the following steps.
Step 1: Find feasible deployment sets for MEC servers. To reduce the computational complexity of algorithm 1, we first calculate the lower limit of the number of deployed MEC servers based on the computing capacity constraint. The lower limit of the number of MEC servers deployed is calculated according to Equation (16) (line 2 in algorithm 1). Then, we use a recursive algorithm to find all candidate deployment sets under different numbers of MEC servers (line 4 in algorithm 1). Finally, we set the candidate deployment sets that the satisfy capacity requirements of all requests as feasible deployment sets (lines 5-9 in Algorithm 1).
Algorithm 1: Enumeration Algorithm |
Input: network topology G, the set of requests |
Output: The total cost , the number of deployed MEC servers F, and the set of deployment locations Wopt |
Determining Feasible Deployment Sets |
1: Initialize U denotes the set of all feasible deployment sets, U←Φ |
2: Compute lower limit |
3: for F←Flo to N+M do |
4: Use recursive algorithm to search sets QF={ ,,..} of MEC candidate locations which includes F MEC servers. |
5: for ∈ QF do |
6: if ∑j∈C•SCj <∑idi then |
7: QF←QF-{} |
8: end if |
9: end for |
10: U←U∪QF |
11: end for |
Calculating Total Cost of Feasible Deployment Sets |
12: for each feasible set ∈ U do |
13: Calculate the minimum delay T of all users by invoking Algorithm 2 |
14: Calculate the deployment cost of unit workload with Equation (18) |
15: Calculate the total cost , =Dc+Ψ•(T/|I|) |
16: end for |
17: Optimal deployment set of MEC Wopt ← select the set with minimum total cost |
Step 2: Calculate latency of all requests under a feasible deployment set. We aim to minimize the latency of all requests. In algorithm 2, first, we need to determine the priority of requests. The priority of requests is determined by using the request with minimum latency time first (MDTF) [
30]. Assuming that there is only a request
i in the network, the latency of request
i to each MEC server in deployment set
is pre-calculated. The minimum latency of request
i to each MEC server is selected as the latency of request
i. We sequentially select a request from the sorted request set.
Then, we find the optimal MEC server for each request and calculate the corresponding latency of each request (lines 2–22 in algorithm (2). Since CU and DU have the master-slave characteristic in three-layer RAN architecture, the different coverage between the candidate locations of DU layer and the candidate locations of CU layer need to be considered. Therefore, the MEC server deployed at candidate location in the DU layer can only respond to requests in local zone, and the MEC server deployed at candidate location in the CU layer can respond to all requests in the network. Here, if the MEC server
j belongs to DU layer and request
i belongs to the local zone where location
j is located, we need to calculate whether the total request arrival rate to MEC server
j is greater than average service rate of MEC server
j after request
i is assigned to MEC server
j. If average service rate
uj of MEC server
j is greater than total request arrival rate at MEC server
j, the request
i is assigned to MEC server
j and
K candidate paths is selected between DU
n and MEC
j by using K-shortest path (lines 3–7). All candidate paths
Ki are traversed for each request
i, and the latency of request
i for each candidate path
k is calculated according to the following formulation (lines 8–11):
The minimum is selected as the latency ti,j of request i assigned to MEC server j (line 12 in algorithm 2). If average service rate uj of MEC server j is less than the total request arrival rate at MEC server j, the latency ti,j of request i assigned to MEC server j is set as infinite (line 13 in algorithm 2), that is, the system stability cannot be satisfied. If the MEC server j belongs to CU layer, the lines 5–15 are repeated and the latency ti,j of request i is calculated (lines 18–20 in algorithm 2).
Finally, all MEC servers in the set
are traversed for each request
i, and the latency
ti,j of request
i assigned to each MEC server
j is calculated. The minimum
ti,j is selected as the latency
ti of request
i, and the MEC server
j with the minimum
ti,j as the optimal MEC server of request
i (lines 21–22 in algorithm 2). We traverse all requests and calculate the latency of all requests (line 23 in algorithm 2).
Algorithm 2: Assign Requests to MEC Servers |
Input: network topology G, the set of requests |
Output: the total delay of all request T. |
1:while request i ∈ I in ascending order of delay do |
2: for MEC server j ∈ do |
3: if j ∈ N then |
4: if request i belongs to the local zone where j is located |
5: if C•SCj>∑idi •yi,j and uj >∑i λi •yi,j then |
6: Obtain RRU r that request i belongs to and RRU r being connected with DU n |
7: Pre-calculate K candidate paths between DU n and MEC j by using K-shortest path |
8: for each path k ∈ Ki do |
9: Allocation continuity wavelength with First-Fit on path k |
10: Calculate the delay based on Equation (17) |
11: end for |
12: ti,j← min k |
13: else ti,j ← ∞ |
14: end if |
15: else ti,j ← ∞ |
16: end if |
17: end if |
18: if j ∈ M then |
19: Repeat lines 5-13 |
20: end if |
20: end for |
21: ti ← min j ti,j |
22: Find the optimal MEC j* with minimize delay, |
i.e., j* = arg min j∈(ti,j) |
23: T←T+ti |
24: Update network status |
25: end while |
Step 3: Calculate total cost of each feasible deployment set. We first calculate the latency of all requests under a feasible candidate deployment set according to algorithm 2. Then, we calculate the MEC servers’ deployment cost of the corresponding deployment set according to Equation (18). Finally, we traverse all feasible deployment sets, and calculate the sum of deployment cost and latency cost for each feasible deployment set. We choose the deployment set that has the minimum deployment cost and latency cost as the optimal deployment scheme.
Theorem 1. The computational complexity of enumeration algorithm is O(|N+M·|I|·|R|·K).
Proof. In Algorithm 1, lines 3–11 find all candidate deployment sets under different numbers of MEC servers, whose computational complexity is O(|N+M), where N+M is the number of candidate locations, R is the number of MEC servers. Then for each deployment set, the requests allocation in Algorithm 2 will be executed, whose computational complexity is O(|I|·|R|·K), where I is the number of requests, K is the number of candidate paths. Therefore, the overall computational complexity of enumeration algorithm is O(|N+M·|I|·|R|·K). □
5.2. Approximate Algorithm based on the improved entropy weight and TOPSIS method
We propose an approximate algorithm for solving MEC servers’ deployment problem quickly and effectively, which combines entropy weight [
17,
31], and TOPSIS method [
32] based on unassigned requests ratio. As shown in Algorithm 3, first, we determine the indicators of each candidate location. Then, based on the improved entropy weight and TOPSIS method, we evaluate the score of each candidate location. Finally, we will get
K most suitable locations to be co-located with MEC servers. The detailed processes are shown in the following steps.
Algorithm 3: Approximate Algorithm based on the improved entropy weight and TOPSIS method |
Input: network topology G, the set of requests |
Output: The total cost, the number of deployed MEC F, and the set of deployment locations Wopt. |
1: Initialize Wopt←Φ, T←Φ, K=0 |
2: Calculate the deployment cost of unit workload for each candidate location with Equation (19) |
3: Execute Algorithm 4 to calculate average delay of each candidate location |
4: Evaluate cj according to Equation (28) |
5: for 0 to R do |
6: if I≠Φ then |
7: for j ∈ (N+M)/Wopt do |
8: Calculate unassigned requests UIj |
9: Calculate Sj according to Equation (29) |
10: end for |
11: Sort Sj in decreasing order |
12: Find the first Sj |
13: Wopt←Wopt ∪ {j} |
14: Determine the unassigned requests I by invoking Procedure 1. |
15: R=R+1 |
16: Update the network state |
17: else exit |
18: end if |
19: end for |
20: Calculate the deployment cost of unit workload for each MEC in the set Wopt with Equation (18) |
21: Calculate the total delay T of all requests by executing Algorithm 2 |
22: Calculate the total cost , =Dc+Ψ•(T/|I|) |
Step 1: Determine the indicators for each candidate location. There are many complex factors affecting on location decision-making of MEC server, such as latency, bandwidth, energy consumption, and cost. In the location selection phase of MEC server, deployment cost and latency are the main considerations [
13]. We first calculate the deployment cost of the unit workload of each candidate location according to Equation (19) in line 2.
Then, we calculate the average latency of requests served at each candidate location according to Algorithm 4. If the candidate location
j belongs to DU layer, the requests in local zone where location
j is located are sorted in ascending order of latency (lines 4–5 in algorithm 4). The sorted requests are assigned to candidate location one by one until the capacity reaches the capacity of MEC server at candidate location or the total request arrival rate is bigger than average service rate of MEC server at the candidate location (lines 6 in algorithm 4). The latency
of request
i for each candidate path
k is calculated according to Equation (17) and the minimum
is selected as the latency
ti,j of request
i assigned to MEC server
j (lines 8-9 in algorithm 4). The average latency of location
j belonging to the DU layer is calculated in line 15. If the candidate location belongs to CU layer, we should calculate latency of each request in the network. The lines 6–15 in algorithm 4 are repeated, and the average latency of location
j belonging to the CU layer is calculated (lines 17–20 in algorithm 4).
Algorithm 4: Calculate Average Delay for Each Candidate Location |
Input: network topology G, the set of user requests |
Output: The average delay of requests to each candidate location aveTj. |
1: for j ∈ J do |
2: Initialize λj←Φ, D←Φ, R←Φ, Tj←Φ |
3: if j ∈ N then |
4: Pre-calculate delay of each request in local zone where location j is located |
5: for request i in the zone according to ascending order of delay do |
6: if C•SCj>∑idi •yi,j and uj >∑i λi •yi,j then |
7: Allocate the request i to MEC j |
8: Calculate the delay of request i for each candidate path k with Equation (17) |
9: ti,j← min k |
10: Tj=Tj+ti,j |
11: R=R+1 |
12: else exit |
13: end if |
14: end for |
15: aveTj= Tj/R |
16: end if |
17: if j ∈ M then |
18: Pre-calculate delay of each request in the network |
19: Repeat lines 6-15, calculate the aveTj |
20: end if |
21: end for |
Step 2: Calculate the score of each candidate location. The indicators of the candidate locations have been determined by using the above step.
First, the entropy of each indicator is calculated by using entropy weight method. The deployment cost and average latency are cost type indicators, which represents that the smaller the attribute value reaches, the better the location is. The standardization of each indicator at each candidate location is as follows:
where
xjσ is the original value of indicator
σ at location
j; max(
xjσ) is the maximum value of indicator
σ; min(
xjσ) is the minimum value of indicator
σ.
To calculate the index value proportion
of the
σth indicator of the
jth location, the formula is defined as:
We evaluate the input entropy of each indicator and the entropy weight of each indicator according to Equations (22) and (23), respectively:
Then, the score of each candidate location is calculated by combining entropy weight and the TOPSIS method. To eliminate the influence of indicator dimension and its variation range on evaluation results, the original matrix is normalized as follows:
The weighted normalized decision matrix is calculated as:
The Euclidean distance of each candidate location from the ideal location and the negative-ideal location is calculated by Equations (26) and (27), respectively.
where
and
are positive ideal location and negative-ideal location.
The score of each candidate location is formulated as the relative closeness to the ideal solution:
Finally, on the one hand, to avoid the MEC servers gather around in the same area, and on the other hand, to prevent a large capacity MEC server only respond to a small number of unassigned requests, we consider the influence of unassigned requests on deployment locations. We introduce the metric of “unassigned requests ratio”. The UIj is the number of unassigned requests at candidate location j, and TIj is the total of requests at candidate location j. Let “UIj/TIj” denote the unassigned requests ratio. When the unassigned requests ratio is high, this means that candidate location j has more unassigned requests.
Therefore, the candidate location
j is more suitable to be co-located with MEC server. Considering the influence from other already deployed MEC servers and unassigned requests, the score of each candidate location can be re-evaluated by:
Taking
Figure 3 as an example, the location of DU-2 has already deployed MEC server. Suppose that all requests in sub-zone 2 and some requests in sub-zone 1 and sub-zone 3 have been assigned to the MEC server that is co-located with DU-2. The total number of requests of sub-zone 1, sub-zone 2 and sub-zone 3 are 20, 30 and 20, respectively. The unassigned requests of sub-zone 1 and sub-zone 3 are 5 and 15, respectively. To meet the demands of unassigned requests, the next deployment location needs to be determined. Suppose that values of
cj of DU-1, DU-3, and CU are 0.45, 0.47, and 0.54, respectively. The location co-located with CU is the optimal deployment location. Considering the influence from unassigned requests, the score
Sj of DU-1, DU-3, and CU are 0.11, 0.35, and 0.15, respectively ((5/20) × 0.45 = 0.11, (15/20) × 0.47 = 0.35, (20/70) × 0.54 = 0.15). Therefore, the location co-located with DU-3 is the optimal deployment location. Compared to deploying the MEC server at location co-located with CU, the MEC server deployed at location co-located with DU-3 can save resources based on meeting the request requirements.
Step 3: Find near optimal deployment set and calculate total cost. First, we determine whether there are unassigned requests (line 6 in algorithm 3). If there are unassigned requests, a candidate location with the highest score
Sj is selected (lines 7–12 in algorithm 3). We will allocate requests to the MEC server
j according to ascending order of latency and determine the unassigned requests (Procedure 1). The system updates the network and unassigned requests are included in
I (line 16 in algorithm 3). Then, we repeat the above process until all requests are assigned, and obtain the near optimal deployment set. Finally, the sum of deployment cost and latency cost is calculated for near optimal deployment set (lines 20–22 in algorithm 3).
Procedure 1: Determine Unassigned Requests |
Input: network topology G, the set of requests |
Output: unassigned requests I |
1: if j ∈ N then |
2: Pre-calculate delay of each request in the zone where location j is located |
3: for each i in the zone according to ascending order of delay do |
4: if C•SCj>∑idi •yi,j and uj >∑i λi •yi,j then |
5: Allocate the request i to MEC j |
6: I←I/i |
7: else exit |
8: end if |
9: end for |
10: if j ∈ M then |
11: Calculate delay of each request in the network |
12: Repeat the above process, calculate I |
13: end if |
14: end if |
Theorem 2. The computational complexity of approximate algorithm is O(|I|·|N+M|·(K+|R|)).
Proof. In Algorithm 3, we first evaluate the indicators for each candidate location. The line 2 evaluate the deployment cost of unit workload for each candidate location, whose computational complexity is O(|N+M|). The average latency of each candidate location will be evaluated by Algorithm 4, whose computational complexity is O(|I|·|N+M|·K). Then, we find R optimal locations to co-located with MEC servers iteratively in lines 5–19. In each iteration, we need to determine unassigned requests in Procedure 1 with O(|I|). Thus, the computation complexity of lines 5–19 is O(|N+M|·|I|·|R|). As a result, the overall computational complexity of approximate algorithm is O(|I|·|N+M|·(K+|R|)). □