# Multi-Agent Dynamic Fog Service Placement Approach
## 3 Service Placement Orchestrator Implementation  
### Design Motivation  
The aim of this orchestrator design process is to demonstrate how orchestrators make decisions to control their services in respect to the QoS and security requirements. Each decision the orchestrators make to start/stop/move their services must be verified in a dynamic way, whether the minimal requirements related to various hardware and software restrictions of the involved hardware devices, as well as requirements due to peculiarities of the application area (e.g., sensitive data should be protected better than environment monitoring data), are met. The orchestrator design should consider its three main stages:  
* Each orchestrator as a part of the first stage should take into account such requirements as security, CPU, RAM, and power based on the application area and diverse fog node hardware/software capabilities to decide if it is possible to launch all required services without violating these requirements;
* The second stage is to find an optimal distribution for deployable services among different fog nodes. It can be vital for saving energy and computation resources in cases when some services need to be stopped, suspended, or moved to other fog nodes; \begin{table}
\begin{tabular}{c l c c} \hline \hline
**Ref.** & **Solution** &
\begin{tabular}{c} **Dynamic** \\ **Placement** \\ \end{tabular} & **Distributed** & **Resilience** \\ \hline
[30] & Application Module placement algorithm & ✓ & - & - \\
[31] & ECC platform & ✓ & - & - \\
[32] & Management modules & ✓ & - & - \\
[33] & PSO-based metaheuristic and a greedy & ✓ & - & - \\
[34] & heuristic algorithm & ✓ & - & - \\
[35] & Decentralized algorithm & ✓ & - & - \\
[36] & Folo: Dynamic task allocation framework & ✓ & - & - \\
[37] & Decentralized replica placement & ✓ & ✓ & - \\
[38] & Optimization framework & ✓ & ✓ & - \\
[39] & MM and RM framework & ✓ & (both) & ✓ \\
[40] & ELECTRE load balancing algorithm & ✓ & - & ✓ \\
[41] & MicroFog framework & - & ✓ & - \\
[42] & S-HIDRA architecture & - & ✓ & - \\
[27] & A3C algorithm & ✓ & ✓ & - \\
[43] & Kubernetes framework & ✓ & - & - \\
[44] & Framework & ✓ & - & - \\
[45] & Two-stage optimization model & ✓ & - & ✓ \\
[46] & DCSP method & ✓ & ✓ & - \\
[47] & ANFIS and GAO & - & - & - \\
[48] & CFS model & ✓ & - & - \\
[49] & CBR-MADE-k model & ✓ & ✓ & - \\
[50] & Orchestration and management solution & ✓ & ✓ & - \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Related work summary. * The third stage is a dynamic service placement for a situation when circumstances change during the runtime, and orchestrators need to change the distribution of their services among available fog nodes according to these new conditions. The orchestrator in the first stage should have all the information of services and placements in all the fog nodes collected and synchronized, and should be aware of the available QoS and security requirements. If all minimal requirements are satisfied, services can be launched. During the second stage, an orchestrator should search for an optimal placement of its services. The orchestrator should detect in the third stage certain changes in its resources or environment indicators, process this data, and relocate its services from the current fog node to another one. Having considered design requirements and knowing the benefits of multi-agent systems, it provides a good starting point. MAS behaves like a network that can correct itself and analyze itself [51]. These intelligent network nodes can both function individually and cooperate to pursue their general and individual goals. The integration of a MAS constitutes a complex framework designed for system control and optimization. However, security issues must be addressed to maintain its resilience, and resource monitoring needs a solution due to the lack of an integrated tool. Particle Swarm Optimization (PSO) is a population-based metaheuristic technique that is used to solve optimization problems [52].