sets ${\mathcal{B}}$ and ${\mathcal{N}}$ of, respectively, base stations and network nodes. This implies that [Alg. \[alg:design\]]{} makes [*per-category*]{} decisions, and is thus able to account for the fact that different categories of content, with different latency limits $L_{\max}$, might require different deployment strategies. Notice that with [*latency*]{} we indicate the time spent within the core network, which is itself a component of the total, end-to-end service time.

The algorithm starts ([Line \[line:init\]]{}) from a solution where each base station that ever serves at least one user requiring content category $k$ (i.e., $\max_{t\in{\mathcal{T}}}\delta(b,k,t)>0$) has its own server, i.e., $y(b)=1$. Then, as long as the latency resulting from our deployment does not exceed the threshold $L_{\max}$ ([Line \[line:while\]]{}), we select a pair of nodes $(n_1,n_2)$ to [*consolidate*]{} together, reducing the number of servers at the price of potentially increasing the service latency.

\[m\]\[c\][$n_1$]{} \[m\]\[c\][$n_2$]{} \[m\]\[c\][$n_3$]{} ![ The consolidation procedure. Circles represent nodes in $n\in{\mathcal{N}}$; black ones correspond to nodes that host a server, i.e., $y(n)=1$, white ones to nodes that do not, i.e., $y(n)=0$. If $n_1$ is $n_2$’s parent (top), the server at $n_2$ is removed and all base stations it served, are served by $n_2$’s parent $n_1$. If $n_1$ and $n_2$ 