## 4 Analytical Framework for Heterogeneous Service Provisioning
### Algorithms for Rate-Adaptive Provisioning  
To operationalize the analytical model, we develop a modular three-phase algorithmic pipeline tailored for rate-adaptive and latency-aware service provisioning in smart healthcare IoT environments, where responsiveness and prioritization are vital. The pipeline comprises three core algorithms, each targeting a distinct stage of the provisioning process. Algorithm 1 handles network initialization by gathering critical parameters such as link capacities, service-to-link mappings, and current traffic states, establishing a stable baseline for iterative optimization. Algorithm 2 dynamically updates link prices and adjusts weight distributions using gradient-based techniques, enabling real-time adaptation to congestion and incorporating predictions from ML models to anticipate traffic fluctuations. Algorithm 3 fine-tunes service delivery rates per user by computing end-to-end path costs and applying inverse utility functions, with optional RL modules to support adaptive control based on real-time system feedback. ```
0: Set of services \(S=\{s_{1},...,s_{n}\}\), links \(T=\{t_{1},...,t_{m}\}\), link capacities \(C=\{c^{1},...,c^{m}\}\)
0: Initialized weight matrix \(W\) and price matrix \(P\)
1: Initialize matrices \(W\in\mathbb{R}^{|S|\times|T|}\) and \(P\in\mathbb{R}^{|S|\times|T|}\)
2:for all services \(s\in S\)do
3:for all consumers \(i\) of service \(s\)do
4:for all links \(t\in T_{s,i}\)do
5:\(w_{s,i}^{t}\leftarrow\frac{1}{\{|j|\in T_{s,j}\}|}\) {Compute using Equation (16)}
6:\(p_{s,i}^{t}\gets 0\) [Initialize price (see Equation (16))]
7:endfor
8:endfor
9:endfor
10:return\(W\),\(P\)
```  
**Algorithm 1** Network Data Collection and Initialization  
```
0: Current weights \(W\), prices \(P\), link capacities \(C\), service rates \(g_{s,i}\)
0: Updated \(W\) and \(P\)
1:for all nodes \(e\)do
2:for all links \(t\) connected to \(e\)do
3:for all services \(s\) using \(t\)do
4:\(g_{s}^{t}\leftarrow\max_{\{i|j\in T_{s,j}\}}g_{s,i}\) {Compute per-service max rate on link \(t\) (see Equation (10))}
5:endfor
6:\(g_{s}^{t}\leftarrow\sum_{s\in S}g_{s}^{t}\) {Compute total link load}
7:\(p^{t}\leftarrow\left[p^{t}+\lambda(g^{t}-c^{t})\right]^{+}\) {Update link price based on overload (ref. Equation (3))}
8:for all services \(s\) and consumers \(i\) on \(t\)do
9:\(w_{s,i}^{t}\leftarrow\left[w_{s,i}^{t}+\lambda(g_{s,i}-g_{s}^{t})\right]^{+}\) {Update allocation weight}
10:if\(g_{s,i}=g_{s}^{t}\)then
11:\(w_{s,i}^{t}\gets 1-\sum_{j\
eq i,t\in T_{s,i}}w_{s,i}^{t}\) {Normalize weight to preserve fairness}
12:endif
13:\(p_{s,i}^{t}\gets w_{s,i}^{t}\cdot p^{t}\) {Consumer-specific price (used in Equation (8))}
14: Update \(\tilde{W}\) and \(P\)
15:endfor
16:endfor
17:endfor
18:return\(W\),\(P\)
```  
**Algorithm 2** Price Computation and Weight Update  
These three algorithms operate in a closed loop. Initialization sets up baseline values; the pricing algorithm adjusts to live network conditions, while the rate adaptation phase ensures compliance with utility and latency constraints. In ML-enhanced deployments, prediction and feedback models can be called asynchronously between iterations to further improve responsiveness and decision quality. The design is modular and interpretable, allowing each algorithm to function independently while contributing to the end-to-end optimization cycle. The algorithms are tightly integrated with the analytical framework and leverage ML-generated insights for improved accuracy and responsiveness. Algorithm 1 is responsible for network setup and initialization. It collects the real-time parameters, including the set of services \(S\), network links \(T\), and capacities \(C\), and constructs the initial weight matrix \(W\) and price matrix \(P\). The weights are distributed evenly across consumer paths, and link prices are initialized to zero, as shown in Equation (16).