# Replicating File Segments between Multi-Cloud Nodes in a Smart City: A Machine Learning Approach
## 8 Conclusions  
This paper proposes a machine learning approach for optimising file replication in a multi-cloud system in a smart city. Edge servers often communicate with clouds to request data in IoT and smart cities in general. A large amount of data transfer occurs by smart sensors and devices as they request significant amounts of data from different clouds in order to use them in tasks such as interpolation, prediction and decision making. This paper defines a framework for multi-cloud and edge server-cloud collaboration in which they build a virtual workflow to share files. In this paper, the file is divided into segments and segments can be replicated. In other words, there is no need to replicate the whole file if only certain segments are requested in some geographical areas while others are not. In this paper, a mathematical operator is proposed. This operator is applied on a predefined topology. Based on this topology and by applying the operator the needed number of times, the minimum route between some source and destination is found. A closed-form theorem is proposed and proved. The outcome of applying this operator is a cyclic sound path which leads from source to destination. The proposed algorithm finds all the nodes (sources) whether they are clouds or edge servers that host the requested segment. For every source, paths are found and the cost of those paths are calculated. The path is a series of nodes connected together in an acyclic series as mentioned earlier. A node in a path is internal if it belongs to the path and if it is between the source and destination. Every internal node is evaluated for being a hosting candidate for the requested segment based on experience (node history) and the node replies with either accept, neutral or reject. The node that has the minimum total cost from the accepting nodes is selected. If there are no accepting nodes then the one that will guarantee the lowest cost among the neutrals is selected. If there are no neutral nodes then the system will not replicate and the requesting node will stream from one of the sources. This will still guarantee a better performance than full replication if the performance of full replication is measured the same way the algorithm measures the costs. Simulation shows the improvement of system performance when applying the proposed model as compared to full replication. The worst case scenario cost of optimising any selected path by replicating to a node that belong to this path is equivalent to the best case scenario cost of no replication and definitely better than the worst case scenario of replicating the whole file.  
Figure 12: Error based on server.  
**Author Contributions:** Conceptualization, S.A.; Methodology, Y.K.; Software, N.M. and A.Y.S.; Validation, Z.A.-A.; Formal analysis, Y.K. and S.A.; Investigation, N.M. and A.Y.S.; Writing--original draft, Y.K.; Writing--review & editing, N.M.; Visualization, Z.A.-A. All authors have read and agreed to the published version of the manuscript.  
**Funding:** This research received no external funding.  
**Institutional Review Board Statement:** Not applicable.  
**Informed Consent Statement:** Not applicable.  
**Data Availability Statement:** Not applicable.  
**Conflicts of Interest:** The authors declare no conflict of interest.