# Replicating File Segments between Multi-Cloud Nodes in a Smart City: A Machine Learning Approach
## 7 Simulation and Results
\begin{bmatrix}0&6&5&3&\infty&13&12&10&14&\infty&\infty&\infty&\infty& \infty&\infty\\ 6&0&6&\infty&\infty&\infty&\infty&\infty&\infty&\infty&16&13&\infty&\infty&\infty \\ 5&6&0&7&8&\infty&\infty&\infty&\infty&\infty&\infty&14&\infty&\infty\\ 3&\infty&7&0&8&\infty&\infty&\infty&\infty&\infty&\infty&\infty&\infty&17& \infty\\ \infty&\infty&8&8&0&\infty&\infty&\infty&\infty&\infty&\infty&\infty&\infty&12 \\ 13&\infty&\infty&\infty&\infty&0&\infty&\infty&\infty&\infty&\infty&\infty&\infty &\infty&\infty\\ 12&\infty&\infty&\infty&\infty&\infty&0&18&\infty&\infty&\infty&\infty&\infty &\infty\\ 10&\infty&\infty&\infty&\infty&\infty&18&0&\infty&20&\infty&\infty&\infty& \infty\\ 14&\infty&\infty&\infty&\infty&\infty&\infty&\infty&0&\infty&\infty&\infty& \infty&\infty\\ \infty&16&\infty&\infty&\infty&\infty&\infty&20&\infty&0&\infty&\infty&\infty &\infty\\ \infty&13&\infty&\infty&\infty&\infty&\infty&\infty&\infty&0&15&\infty&\infty \\ \infty&\infty&\infty&14&\infty&\infty&\infty&\infty&\infty&\infty&15&0&\infty \\ \infty&\infty&\infty&\infty&17&\infty&\infty&\infty&\infty&\infty&\infty&0&19\\ \infty&\infty&\infty&\infty&\infty&12&\infty&\infty&\infty&\infty&\infty&\infty &\infty&19&0\end{bmatrix}  \tag{53}\]  
For \(e_{9}\) to access \(s_{11}\), we have three different paths:  
1. \(p_{1}\equiv c_{1}\to c_{4}\to c_{5}\to e_{9}\)
2. \(p_{2}\equiv c_{2}\to c_{3}\to c_{5}\to e_{9}\)
3. \(p_{3}\equiv e_{7}\to c_{3}\to c_{5}\to e_{9}\)  
The cost for \(e_{9}\) to access \(s_{11}\)\(n\) times through path \(p_{1}\) when hosting in an intermediate node \(c_{5}\) is as follows:  
\[cost=\tau(c_{1},c_{5})+\rho(c_{5})+\pi(c_{5})+n\times\tau(c_{5},e_{9})\]  
The following experiment shows the results of node \(e_{9}\) requesting file segment \(s_{11}\). This file segment exists in three different locations according to Table 1. Those locations are \(c_{1},c_{2}\) and \(e_{7}\) and paths for each source are studied below. The costs of different paths from \(c_{1}\) to \(e_{9}\) are shown in Figure 4. Among paths that start with node \(c_{1}\), the path with the minimum cost is:  
\[c_{1}\to c_{4}\to c_{5}\to e_{9}\]  
Figure 4: Path costs from \(c_{1}\) to \(e_{9}\). Figure 4 shows the lowest cost paths from \(c_{1}\) to \(e_{9}\). It is obvious that total costs differ from a path to another. Note that costs in the same path could differ depending on which node will be selected for replication. Costs of different paths from \(c_{2}\) to \(e_{9}\) is shown in Figure 5. Among paths that start with node \(c_{2}\), the path with the minimum cost is:  
\[c_{2}\to c_{3}\to c_{5}\to e_{9}\]  
Figure 5 shows the lowest cost paths from \(c_{2}\) to \(e_{9}\). Again, it is obvious that total costs differ from a path to another. Costs in the same path could differ depending on which node will be selected for replication. Costs of different paths from \(e_{7}\) to \(e_{9}\) is shown in Figure 6. Among paths that start with node \(e_{7}\), the path with the minimum cost is:  
\[e_{7}\to c_{3}\to c_{5}\to e_{9}\]  
Figure 6 shows the lowest cost paths from \(e_{7}\) to \(e_{9}\). Again, it is obvious that total costs differ from a path to another. Costs in the same path could differ depending on which node \(e_{7}\) to \(e_{9}\). Figure 5: Path costs from \(c_{2}\) to \(e_{9}\). Table 1.0 Path costs from \(e_{7}\) to \(e_{9}\). node will be selected for replication. Data in Figures 4-6 illustrate different path costs from source to destination. Every bar represents total cost of a path. Those costs are calculated using Equation (51). Lengths of segments are shown in Table 2, communication delays are shown in Equation (53) and the hosting cost is being calculated based on the segment hosting shown in Table 1.1 A comparison with the three minimums resulting from different starting points shows different costs for the three shortest paths are shown in Figure 7, the comparison shows that replicating \(s_{11}\) from node \(c_{1}\) will give the minimum cost.