Minimum cost of "signal" cover in a tree with DP
Let $T$ be your tree, and root it in an arbitrary vertex $r$.
Given a vertex $v$, let $T_v$ denote the subtree of $T$ rooted at $v$.
For simplicity, let $f(0, v) = 0$.
For $i \ge 0$, define $D[v,i]$ as the minimum cost needed to cover the subtree rooted at $v$ if all the nodes at distance smaller than $i$ from $v$ are always considered as covered.  Intuitively this means that the signal &quot;coming into $T_v$&quot; is strong enough to cover all vertices of $ T_v$ at distance at most $i-1$ from $v$.
For $i \ge 0$, define $U[v,i]$ as the minimum cost needed to cover the subtree $T_v$ rooted at $v$ with the constraint that the selected signal strengths should also be a feasible solution for the tree obtained by appending a path of $i$ vertices to $v$. Intuitively this means that the signal &quot;outgoing from $T_v$&quot; is strong enough to cover all vertices of $T \setminus T_v$ at distance at most $i$ from $v$.
Notice that, by definition, $D[v,i] = U[v,i]$.
If $v$ is a leaf of $T$, then
$$
D[v, i] =
\begin{cases}
f(v, 0) &amp; \mbox{if } i=0 \\
0 &amp; \mbox{if } i&gt;0 \\
\end{cases},
$$
and
$$
U[v, i] = f(v, i).
$$
If $v$ is not a leaf of $T$, then let $C_v$ be the set of children of $v$.
For $i=0, \dots, n-1$:
$$
U[v, i] = \min
\begin{cases} 
U[v, i+1] &amp; \mbox{only if $i \neq n-1$}\\
f(v,i) +  \sum_{u \in C_v} D[u, i]    \\
\min_{z \in C_v} \left\{ U[z, i+1] +  \sum_{u \in C_v \setminus {z}} D[u, i] \right\}  &amp; \mbox{only if $i \neq n-1$}
\end{cases},
$$
and, for $i=1,\dots,n$:
$$
D[v, i] =
\min
\begin{cases} 
D[v, i-1] \\
\sum_{u \in C_v} D[u, i-1]
\end{cases} 
$$
You can then compute all values $U[v, i]$ and $D[v,i]$ where $v$s are considered in postoder w.r.t. $T$ and the order of subproblems for a fixed vertex $v$ is $U[v,n-1], \dots, U[v,1], U[v,0] = D[v,0], D[v,1], \dots, D[v,n]$.
As far as the computational complexity is concerned notice that there are $O(n^2)$ subproblems.
The overall time needed to evaluate the second argument of the minimum of $U[v,i]$ and $D[v,i]$ is $O(n^2)$ since, for each value of $i$, computing $\sum_{u \in C_v} D[u, i]$ takes time proportional to $|C_v|$ and $\sum_v |C_v| = O(n)$.
Suppose then that all the values $\sum_{u \in C_v} D[u, i]$ are known for free (since the time needed to compute them has already been accounted for).
The overall time needed to evaluate the third argument of the minimum of $U[v,i]$ is again $O(n^2)$ since, for each value of $i$, $\sum_{u \in C_v \setminus {z}} D[u, i]$ can be found in time $O(1)$ by difference, and the inner minimum ranges over $|C_v|$ elements. Once again  $\sum_v |C_v| = O(n)$.