1 Correction to: Algorithmica (2017) 79:886–908 https://doi.org/10.1007/s00453-016-0211-2

Abstract This erratum fixes a technical problem in the paper published in Algorithmica, Volume 79, Number 3, November 2017, pp. 886–908. Theorem 1 of this paper gives upper bounds on both worst testing cost and expected testing cost of the decision tree built by Algorithm 1. Although the statement is correct, the proof presented in the paper has a problem. The proof relies on the analysis of a nonlinear program (NLP) given by Eqs. (5)–(9), which is not convex as mistakenly proved in Appendix A.2. In this erratum we present a correct proof of Theorem 1. Instead of analyzing the NLP we analyze a related linear program.

2 Notation and Algorithm 1

For the sake of self containment we present some notations and the description of Algorithm 1 introduced in [1].

We define cost(Ds) as the sum of the tests’ cost on the path from the root of D to the leaf associated with object s. Then, the worst testing cost and the expected testing cost of D are, respectively, defined as

$$\begin{aligned} cost_W(D) = \max _{s \in S}\{cost(D,s)\} \,\,\, \text{ and } \,\,\, cost_E(D) = \sum _{s \in S} cost(D,s) p(s). \end{aligned}$$
(1)

Given a positive number j and two decision trees \(D_E\) and \(D_W\) for instance I, the procedure CombineTrees(\(D_E\),\(D_W\),j) (see Algorithm 1) constructs a new decision tree \(D^j\) for I whose worst testing cost is increased by at most j w.r.t the worst testing cost of \(D_W\), i.e., \(cost_W(D^j) \le j + cost_W(D_W).\) Our algorithm uses the definition of a j-replaceable node, by which we mean a node v in D such that the total cost of the tests on the path from the root of D to v (including v) is larger than j and the cost of the path from the root of D to the parent of v is smaller than or equal to j. The procedure Trade-Off repeatedly uses CombineTrees to create several decision trees (one of these trees being \(D_W\)) with increasingly worst testing cost and chooses the one with the best expected testing cost. We will show that this way it can guarantee the best possible trade-off.

figure a

Proposition 1

The decision tree \(D^j\) returned by CombineTrees has worst testing cost at most \(j+cost_W(D_W)\).

3 Correct Analysis of Algorithm 1

Now we analyze the decision tree \(D = D^{j^*}\) output by Trade-Off(\(D_E, D_W, C\)), where C is an integer parameter. Notice that D is the decision tree with minimum expected testing cost among the decision trees \(D^0,D^{1},D^{2},\ldots ,D^{C}\), where \(D^j\) is the decision tree returned by CombineTrees(\(D_E,D_W,j\)). It follows from the previous proposition that \(cost_W(D) \le C+ cost_W(D_W).\)

The analysis of the expected testing cost of D is more involved. In order to simplify the notation we will let \(W = cost_W(D_W).\) We also assume for simplicity in the following that test costs are integers. Given a decision tree \(D'\) and an object/leaf \(s \in S\) with \(cost(D',s) = \kappa \) we will say that s has cost \(\kappa \) in \(D'\).

Let \(p_i\), with \(i=1,\ldots ,C\), be the sum of the probabilities of objects with cost i in \(D_E\) and \(p_{C+1}\) be the sum of the probabilities of the objects with cost larger than C in \(D_E\). Clearly:

$$\begin{aligned} cost_E(D_E) \ge \sum _{i=1}^{C+1} p_i \cdot i. \end{aligned}$$

Furthermore, for \(j=0,\ldots ,C\), we have that:

$$\begin{aligned} cost_E(D^j) \le \sum _{i=1}^j p_i \cdot i + \left( ( j+W) \sum _{i=j+1}^{C+1} p_i \right) \end{aligned}$$

because the objects whose cost in \(D_E\) is larger than j have cost at most \(j+W\) in \(D^j\). Moreover, for a probability distribution \(\mathbf{q}=(q_1,\ldots ,q_{C+1})\), let

$$\begin{aligned} f(\mathbf {q}) =\min _{j=0,\ldots ,C} \left\{ \frac{\sum _{i=1}^j q_i \cdot i +( j+W) \sum _{i=j+1}^{C+1} q_i}{\sum _{i=1}^{C+1} q_i \cdot i} \right\} , \end{aligned}$$

and let \(\mathbf {p}=(p_1,\ldots ,p_{C+1})\). Thus, we have

$$\begin{aligned} \frac{ cost_E(D)}{ cost_E(D_E)} = \min _{j=0,\ldots ,C} \left\{ \frac{ cost_E(D^j)}{ cost_E(D_E)} \right\} \le f(\mathbf {p}) \le \max _{\mathbf {q \in \mathcal{P} }} f(\mathbf {q}) , \end{aligned}$$
(2)

where \(\mathcal{P}=\{ (q_1,q_2,\ldots ,q_{C+1}) | \sum _{i=1}^{C+1} q_i=1 \text{ and } q_1,q_2,\ldots ,q_{C+1}\ge 0\}\). The next lemma gives the exact value of \(\max _{\mathbf {q \in \mathcal{P} }} f(\mathbf {q}) \).

Lemma 1

Let \(\mathbf{p^*}=(p^*_i,\ldots ,p^*_{C+1})\), with

$$\begin{aligned} p^*_i= & {} {\left\{ \begin{array}{ll} \frac{(W-1)^{i-1}}{W^i}, &{} i = 1, \dots , C \\ \\ \frac{(W-1)^{C}}{W^C}, &{} i = C+1. \end{array}\right. } \end{aligned}$$
(3)

We have that \(\mathbf{p^*} \in \mathcal{P}\) and

$$\begin{aligned} f(\mathbf {p}^*) = \frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) } =\max _{\mathbf {q \in \mathcal{P} }} f(\mathbf {q}) . \end{aligned}$$

Proof

The statements \(\mathbf{p^*} \in \mathcal{P}\) and

$$\begin{aligned} f(\mathbf {p}^*) = \frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) } \end{aligned}$$

can be verified through simple calculations (see Appendix A).

To prove that \(f(\mathbf {p}^*)=\max _{\mathbf {q \in \mathcal{P} }} f(\mathbf {q})\), we first show that

$$\begin{aligned} \max _{\mathbf {q \in \mathcal{P} }} f(\mathbf {q})= & {} \max _{\mathbf{q'}} \min _{j=0,\ldots ,C} \left\{ \sum _{i=1}^j q'_i \cdot i +( j+W) \sum _{i=j+1}^{C+1} q'_i \right\} \text{ s. } \text{ t. } \end{aligned}$$
(4)
$$\begin{aligned}&\sum _{i=1}^{C+1} i \cdot q'_i = 1 \end{aligned}$$
(5)
$$\begin{aligned}&q'_i \ge 0, \,\,\, i=1,\ldots ,C+1 . \end{aligned}$$
(6)

In fact, let \(\mathbf{r}={{\mathrm{argmax}}}_{\mathbf {q \in \mathcal{P} }} f(\mathbf {q})\) and let \(K=\sum _{i=1}^{C+1} i \cdot r_i\). Then, \(\mathbf{r } / K\) is a solution for the problem defined by Eqs. (4)–(6) and its objective value is \(f(\mathbf{r })\). Conversely, let \(\mathbf{r' }\) be the optimal solution of the problem defined by Eqs. (4)–(6) and let \(z'\) be the corresponding objective function value. Moreover, let

$$\begin{aligned} K'=\frac{1}{ \sum _{i=1}^{C+1} r'_i }. \end{aligned}$$

Then, \(K' \mathbf{r' } \in \mathcal{P}\) and \(f( K' \mathbf{r' } ) = z'\),

Therefore, we can analyze the optimum value of the optimization problem defined by Eqs. (4)–(6). This problem can be formulated as a linear program as follows:

$$\begin{aligned}&\max z&\text{ s. } \text{ t. } \end{aligned}$$
(7)
$$\begin{aligned}&z - \sum _{i=1}^j i \cdot q_i - (j+W) \left( \sum _{i=j+1}^{C+1} q_i \right) \le 0, \,\,\, j=0,\ldots ,C \end{aligned}$$
(8)
$$\begin{aligned}&\sum _{i=1}^{C+1} i \cdot q_i = 1 \end{aligned}$$
(9)
$$\begin{aligned}&q_i \ge 0, \,\,\, i=1,\ldots ,C+1. \end{aligned}$$
(10)

Thus, to show that

$$\begin{aligned} \max _{\mathbf {q} \in \mathcal{P}} f(\mathbf {q}) = \frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) }, \end{aligned}$$

it suffices to exhibit a feasible solution for the dual of the above LP with objective value \(\frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) }.\)

The dual of the LP defined by Eqs. (7)–(9) is given by

$$\begin{aligned}&\min \lambda _E \text{ s. } \text{ t. } \end{aligned}$$
(11)
$$\begin{aligned}&k \cdot \lambda _E -\sum _{j=0}^{k-1} (j+W) \lambda _j -\sum _{j=k}^{C} k \lambda _j \ge 0, \,\,\, k=1,\ldots ,C+1 \end{aligned}$$
(12)
$$\begin{aligned}&\sum _{j=0}^{C} \lambda _j \ge 1 \end{aligned}$$
(13)
$$\begin{aligned}&\lambda _j \ge 0, \,\,\, j=0,\ldots ,C . \end{aligned}$$
(14)

It is possible to show (see Appendix B for calculations) that \(\lambda ^*=(\lambda ^*_E,\lambda ^*_0,\ldots ,\lambda ^*_C),\) where

$$\begin{aligned} \lambda ^*_j= \frac{ W^j (W-1)^{C-j}}{W^{C+1} -(W-1)^{C+1}}, \end{aligned}$$

for \(j=0,...,C\) and \(\lambda ^*_E = \frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) }\) is a feasible solution for the dual problem, which establishes the lemma. \(\square \)

Thus, by setting \(C = \lfloor \rho W \rfloor \) we get the following theorem.

Theorem 1

Fix an instance I of the decision tree optimization problem and let \(D_E\) be a decision tree such that \(cost_E(D_E) = OPT_E(I).\) For every \(\rho > 0\) there exists a decision tree D such that

$$\begin{aligned} cost_W(D) \le (1+\rho )OPT_W(I) \quad \text{ and } \quad cost_E(D) \le \left( \frac{1}{1- e^{-\rho }} \right) OPT_E(I). \end{aligned}$$

Proof

Let \(W = OPT_W(I)\) and \(C = \lfloor \rho W \rfloor \). Let \(D_W\) be a decision tree such that \(cost_W(D_W) = W.\) It follows from the analysis above that the decision tree D output by Trade-Off(\(D_E, D_W, C\)) has worst testing cost at most \(C+W < (1+\rho )W\) and expected testing cost smaller than

$$\begin{aligned} \frac{ 1}{ \left( 1- \left( \frac{W-1}{W} \right) ^{C+1} \right) } OPT_E(I) \le \left( \frac{1}{ 1- \left( \frac{W-1}{W} \right) ^{\rho W}} \right) OPT_E(I) \le \left( \frac{1}{1- e^{-\rho }} \right) OPT_E(I). \end{aligned}$$