## 5 Successive Approximation Using CS-WSNs
### Successive Approximation Table Construction  
Given that \(M_{i}\) coefficients have been already transmitted, one can define the set of new possible quantities of CS coefficients as \(\{M_{k}\}_{k\in\mathcal{K}}\), \(M_{k}>M_{i}\). From Equation (15), one can compute the corresponding possible bit-depths \(\{B_{k}\}_{k\in\mathcal{K}}\), for a predefined target increment \(\Delta R_{i}\). Dividing both sides of Equation (15) by \(\Delta M_{i}=M_{k}-M_{i}\), one obtains  
\[\frac{\Delta R_{i}}{\Delta M_{i}} =\frac{M_{i}\Delta B_{i}}{\Delta M_{i}}+B_{i}+\Delta B_{i},\text{ thus } \Delta B_{i} =\frac{\frac{\Delta R_{i}}{\Delta M_{i}}-B_{i}}{1+\frac{M_{i}}{ \Delta M_{i}}}. \tag{17}\]  
Consequently, to build the successive approximation encoding table (the one that provides the increments \(\Delta M_{i}\) and \(\Delta B_{i}\) for moving to the next RD-optimal point subject to the operational point \((M_{i},B_{i})\) increment in rate \(\Delta R_{i}\)), one may use Algorithm 1. In this procedure, \((M_{i},B_{i})\) is the current RD-optimal pair of node \(S_{i}\); \(d_{R}\) is the proportional increment in the rate; \(c_{n}\) is the amount of \((M_{i},B_{i})\) points generated in each operational curve; \(d_{N}\) is a factor that limits the amount of operational curves that are tested. The value of \(c_{n}\) defines the possible increments in \(M_{i}\), stored in \(\Delta M_{j}\). For each of them, the correspondent bit-depth increase is computed in lines 7-9. The best choice among them (leading to the same increment \(\Delta R_{j}\) bits in rate) is evaluated in the eleventh line. This provides an \"incremental path\" (or successive approximation) for encoding and transmission of CS quantized measurements. If this process is performed off-line, it does not impact the energy consumption of the sensor nodes; however, sensor nodes either need to be aware of the table or be informed about the new operational setup. Table construction complexity is controlled by \(d_{R}\) and \(c_{n}\), that limits the quantity of CS reconstructions that are evaluated for the training data. The input factor \(d_{R}\) defines the rate increment  
that is evaluated while \(c_{n}\) defines the number of possible operational points to be tested at a given \((M_{i},B_{i})\) to choose the next operational point \((M_{i+1},B_{i+1})=(M_{i}+\Delta M_{i},B_{i}+\Delta B_{i})\). In other words, \(c_{n}\) defines the amount of candidate setups for the given percent increment in rate \(d_{R}\). Note that the larger \(c_{n}\) is, the more trials are required, i.e., more \((\Delta M_{i},\,\Delta B_{i})\) are generated and analyzed. Suppose that one starts at a rate \(R_{i}\) and wants to increment it to \(R_{i}+\Delta R_{i}\), as \(d_{R}\) increases, the sensor traverses less operational points to go from a rate \(R_{i}\) to a rate \(R_{i}+\Delta R_{i}\). Therefore, \(d_{R}\) restricts the amount of generated curves that have to be tested. The smaller that \(d_{R}\) is, the more precisely the rate can be adjusted, at expenses of a more complex training process. ```
input :\(N\), \(d_{R}\), \(d_{N}\), \(c_{n}\) output :\((M_{j},B_{j})\)
1\(M_{j}\gets M_{i}\);
2\(B_{j}\gets B_{i}\);
3\(\Delta M_{j}\leftarrow[1:c_{n}]\);
4 while\(M_{j}\leq Nd_{N}\)do
5\(\Delta R_{j}\gets M_{j}B_{j}d_{R}\);
6 for\(n\gets 1\)to\(c_{n}\)do
7\(M_{k}[n]\gets M_{j}+\Delta M_{j}[n]\);
8\(\Delta B_{j}[n]\leftarrow\frac{\frac{\Delta R_{j}}{\Delta M_{j}[n]}-B_{j}}{1+ \frac{\Delta R_{j}[n]}{\Delta M_{j}[n]}}\);
9\(B_{k}[n]\gets B_{j}+\Delta B_{j}[n]\);
10
11 end for
12\((M_{j},B_{j})\leftarrow\min_{k\in K}\mathcal{D}\left(M_{k}[n],B_{k}[n]\right)\);
13
14 end for
```  
**Algorithm 1**Construction of the successive approximation table  
To illustrate the procedure, assume that the initial RD-optimal point is \((M_{0},B_{0})=(8,4)\), the next point (the first refinement point) is chosen from at most ten \((M,B)\) pairs, i.e., \(c_{n}=10\), for a fixed rate increment defined by \(d_{R}\). Each one of the 10 candidates produces a distortion.