## 5 Ubunye Service Allocator
### Ubunye Auction Implementation  
The algorithms in Figures 4 and 5 present our resource allocation proposal, which covers three stages: initialization, evaluation, and provisioning. In the initialization stage, the dataset (JSON file) is loaded with the simulation scenario settings, creating the number of users, base stations, routers, links, applications, services, and predefined edge nodes in each scenario. In the evaluation stage, the available edge nodes are scored according to the predefined QoS and QoE criteria, and a score for each one is calculated using Equations (1) and (2). At the end of this stage, the edge node with the highest score is defined. In the provisioning stage, the initialized service will be assigned. The process will be repeated until all the requested services have been provisioned and meet the simulation's stop criteria. The algorithm in Figure 6 defines the simulation's stopping criteria. More details can be seen in the experimental evaluation section below. All algorithms related to our article are detailed on the GitHub using the following link: [[https://github.com/Ubunye-Orchestration-ML](https://github.com/Ubunye-Orchestration-ML)]([https://github.com/Ubunye-Orchestration-ML](https://github.com/Ubunye-Orchestration-ML)) (accessed on 20 January 2025). ```
Input: List of services and edge servers Output: Service provisioned to the best edge server
1:Initialize: \(server\_proposals\leftarrow\{\}\) for\(service\_id\gets 1\)to\(total\_services\)do for\(service\_id\gets 1\)to\(total\_services\)do
2:\(service\leftarrow\) find\(\_service(service\_id)\) if\(service=\) None or\(service\_server\
eq\) None or\(service\_being\_provisioned\)then continue
3:endif Evaluating the QoS and QoE criteria: for\(edge\_server\)in EdgeServer.all()do
4:\(network\_switch\gets edge\_server\_network\_switch\) for\(network\_link\)in NetworkLink.all()do if\(edge\_server.has\_capacity\_to\_host(service)\)and\(network\_switch=network\_link\_nodes[0]\)then
5:\(latency\gets network\_link.delay+base\_station\_wireless\_delay\) \(cpu\_free\gets edge\_server.cpu-edge\_server.cpu\_demand\) \(memory\_free\leftarrow(edge\_server.memory-edge\_server.memory\_demand)/1024\) \(score\leftarrow\lfloor\log_{10}(latency)\rfloor+\lfloor\log_{10}( memory\_free)\rfloor+\lfloor\log_{10}(cpu\_free)\rfloor\) \(server\_proposals[edge\_server.id]\leftarrow\{\text{`score'}:score,\text{' service'}:service\}\) endif
6:endfor endfor
7:endfor
8:
9:Provisioning Service on the Winner Edge Node (Best Auction Bid): if\(server\_proposals\
eq\{\}\)then
10:\(winning\_server\_id\leftarrow\)argmax(\(server\_proposals[\)score\(]\))
11:\(winning\_server\_id\leftarrow\)argmax(\(winning\_server\_id\))
12:\(service\_proposals[winning\_server\_id][\text{`service'}]\) \(service\_provision(target\_server=winning\_server)\)
```  
**Algorithm 1** Ubunye Latency Algorithm. ```
Input: List of services and edge servers Output: Service provisioned to the best edge server Inclaize: \(server\_proposals\leftarrow\{\}\) for\(service\_id\gets 1\)to\(total\_services\)do \(service\leftarrow\) find\(\_service(service\_id)\) if\(service=\) None or\(service\_server\
eq\) None or\(service\_being\_provisioned\)then
8:continue
9:endfor
10:\(server\_id\leftarrow\)argmax(\(server\_proposals[\)score\(]\))
11:\(winning\_server\_id\leftarrow\)argmax(\(server\_proposals[winning\_server\_id][\text{`service'}]\))
12:\(service\_proposals[winning\_server\_id][\text{`service'}]\)
13:endif
```  
**Algorithm 2** Ubunye BW Algorithm.