# Edge and Cloud Computing in Smart Cities
## 2 Architectural Models for Edge and Cloud Computing in Smart Cities
### Clustered Edge-Cloud Architecture with Federated Learning  
The clustered edge-cloud architecture with FL introduces a structured, decentralized approach to computational resource allocation, where edge nodes are grouped into dynamically coordinated clusters that collaborate with cloud servers. This architectural model optimizes computational efficiency by minimizing latency, reducing network congestion, and preserving data privacy, thereby enhancing the scalability and adaptability of edge computing in smart-city environments. Unlike fully distributed architectures, which operate without a predefined structure, the clustered model ensures systematic coordination, enabling intelligent workload distribution and federated machine learning (ML) while mitigating inter-cluster communication overhead [46; 47]. The architecture consists of a set of clusters  
\[C_{E}=\{Cl_{1},Cl_{2},\ldots,Cl_{Q}\}, \tag{16}\]  
where each cluster \(Cl_{q}\) comprises multiple edge nodes \(\mathcal{E}_{q}\) and a cluster coordinator \(G_{q}\). Each cluster is dynamically formed based on spatial proximity, resource availability, and computational demand. The set of \(N_{q}\) edge nodes within the \(q\)th cluster is denoted as  
\[E_{q}=\{E_{q1},E_{q2},\ldots,E_{qN_{q}}\},\quad q=\{1,2,\ldots,Q\}, \tag{17}\]  
where each edge node \(E_{qi}\) (\(i=1,2,\ldots,N_{q}\)) is characterized by a triple \((P_{qi},S_{qi},L_{qi})\), representing processing power, available storage, and inherent latency, respectively. The cluster coordinator \(G_{q}\) manages intra-cluster task distribution and FL aggregation. The selection of a cluster coordinator follows an optimization criterion  
\[G_{q}=\arg\min_{E_{qi}\in\mathcal{E}_{q}}\left(\alpha L_{qi}-\beta P_{qi}-\gamma S _{qi}\right), \tag{18}\]  
where \(\alpha,\beta,\gamma\) are weighting coefficients balancing latency, computational power, and storage capacity in selecting the optimal coordinator. Higher processing power and storage are preferred, ensuring efficient coordination while minimizing latency [48; 49; 50]. Each cluster follows a hierarchical processing framework, where tasks are first assigned to an available edge node within the cluster based on the optimization function  
\[E_{qi}^{*}=\arg\min_{E_{qi}\in\mathcal{E}_{q}}\left(T_{E_{qi}}+\frac{d_{E_{qi},G_{q}}}{B_{E_{qi},G_{q}}}\right), \tag{19}\]  
where \(T_{E_{qi}}\) represents the processing delay at edge node \(E_{qi}\), \(d_{E_{qi},G_{q}}\) denotes the communication distance to the cluster coordinator, and \(B_{E_{qi},G_{q}}\) is the available bandwidth between and \(G_{q}\). If no edge node within the cluster meets the latency constraint, the task is offloaded to the cloud according to  
\[F(\tau)= \begin{cases}E_{qi}^{*},&\text{if }T_{E_{qi}^{*}}+T_{\text{comm}}(E_{qi},G_{q}) \leq T_{\text{th}},\text{where }E_{qi}\in E_{q}\\ C,&\text{otherwise},\end{cases}  \tag{20}\]  
where \(T_{\text{th}}\) is the maximum latency threshold for real-time processing [51; 52]. FL is integrated into this architecture to facilitate collaborative model training without exposing raw data to external networks. Each edge node \(E_{qi}\) maintains a local ML model \(\mathcal{M}_{i}\) and updates it using local datasets \(Dt_{i}\) following  
\[\mathcal{M}_{i}^{t}=\mathcal{M}_{i}^{t-1}-\eta\
abla L(\mathcal{M}_{i}^{t-1}, Dt_{i}), \tag{21}\]  
where \(\eta\) is the learning rate, and \(\
abla L\) represents the gradient of the loss function. The locally trained models are then transmitted to the cluster coordinator for aggregation  
\[\mathcal{M}_{q}^{t}=\sum_{i=1}^{N_{q}}w_{i}\mathcal{M}_{i}^{t},\quad\sum_{i=1 }^{N_{q}}w_{i}=1, \tag{22}\]  
where \(w_{i}\) represents the weight assigned to each edge node based on its dataset size. The aggregated model is periodically synchronized with the global cloud model  
\[\mathcal{M}_{\text{C}}^{t}=\sum_{q=1}^{Q}v_{q}\mathcal{M}_{q}^{t},\quad\sum_{q =1}^{Q}v_{q}=1, \tag{23}\]  
where \(v_{q}\) is the aggregation weight assigned to each cluster.