## 4 Proposed Methodology
### Solution Based on the FOCN  
According to our proposal, the ACU in a Fog colony filters and categorizes service placement requests based on the completion deadlines. The filtered requests are then sent to the MADE-k control loop for placement decisions. During the monitor phase, placement requests are received and tracked, and node availability is periodically updated in the local knowledge base. Then, in the third step of Made-k, based on the information sent by the ACU on the requests (priority or not and the degree of priority), the MADE-k will sort these placement requests and pass them to the decision stage according to the order of priority. In the decision phase, we propose to use the meta-heuristic algorithm \"Imperialist Competitive Algorithm\" (ICA) [31]. The ICA belongs to the category of optimization methods and has proven to perform well compared to other algorithms (such as ODMA and cuckoo Search) in terms of speed and convergence speed. In addition, several approaches have proven the performance of this algorithm in solving high-dimensional problems. The ICA is inspired by imperial competition, where imperialists and colonies compete to find the best solution based on a process of competition and migration. Indeed, the term \"colony\" in the ICA is different from the notion of colony we used in the proposed architecture. According to the ICA, colonies are less efficient solutions than imperialists (candidate solutions). So, the objective of this algorithm is, from a set of solutions and using the \"Fitness\" objective function, to select the best solution, which in our case is the best node in which to  
Figure 8: Activity diagram of the proposed solution based on the FOCN, using standard UML notations (rectangles for activities, diamonds for decision points, and arrows for control flow)place the service while minimizing system latency and respecting most of the constraints imposed by FC. In fact, the first step of the ICA involves randomly creating an initial population, then calculating the Fitness objective function, and finally sorting the solutions based on their Fitness values, where the Nimp solutions (imperialists) are those with the smallest Fitness values.The fitness value of each solution is calculated according to several different objectives. These objectives include service latency (\(SL\)), energy consumption (\(EC\)), and resource utilization (\(RU\)), as described in Equation (1). The goal is to minimize the fitness function \(F\), which incorporates the following optimization objectives:  
\[F=\xi_{SL}\cdot SL+\xi_{EC}\cdot EC-\xi_{RU}\cdot RU \tag{1}\]  
where \(SL\), \(EC\), and \(RU\) represent service latency, energy consumption, and resource use, respectively, multiplied by the impact coefficients associated with these objectives. These coefficients represent the relative importance of each objective and are determined based on the system's requirements. Given the importance of both service latency (\(SL\)) and resource utilization (\(RU\)) in the optimization process, we assign the following coefficients to reflect their priorities:  
\[\xi_{SL}=0.5\quad\text{(latency is the top priority)}\]  
\[\xi_{EC}=0.2\quad\text{(energy consumption is less important)}\]  
\[\xi_{RU}=0.3\quad\text{(resource utilization is also important but secondary to latency)}\]  
These values were selected to strike a balance between minimizing latency, optimizing resource utilization, and managing energy consumption in the Fog Computing environment. The key difference in our approach is that, in the event of a service placement failure in the current colony, the RS will take over the SPP resolution and search for an available node not only within a single colony but across all Fog colonies. In the worst-case scenario, if the RS cannot find an available node, it forwards the placement request to the Cloud layer. In the following section, we focus on recommender systems and explain in detail how they solve the SPP in FC.