TAOCP 7.2.2.1 Exercise 207
We correct the solution, focusing especially on part (c), which requires a precise interpretation of “exponential growth” in Algorithm X dynamics, and a justified role for both parameters.
Section 7.2.2.1: Dancing Links
Exercise 207. [35] [35] The principal SAT solver that we shall discuss later, Algorithm 7.2.2.2C, maintains focus by computing "activity scores," which measure recent changes to the data structures. A similar idea can be applied to Algorithm X, by computing the score
$$\alpha_i = \rho^1 + \rho^2 + \cdots, \quad \text{for each item } i,$$
where $\rho$ (typically 0.9) is a user-specified damping factor, and where $i$'s list of active options was modified at times $t - t_1$, $t - t_2$, $\ldots$; here $t$ denotes the current "time," as measured by some convenient clock. When step X3 chooses an item for branching, the MRV heuristic of exercise 0 rates $i$ by its degree $\lambda_i = \text{LEN}(i)$; the new heuristic replaces this by
$$X_i = \begin{cases} \lambda_i, & \text{if } \lambda_i \le 1; \ 1 + \lambda_i/(1 + \mu \alpha_i), & \text{if } \lambda_i \ge 2. \end{cases}$$
Here $\mu$ is another user-specified parameter. If $\mu = 0$, decisions are made as before; but larger and larger values of $\mu$ cause greater and greater attention to be given to the recently active items, even if they have a somewhat large degree of branching.
a) For example, suppose $n = 10$, $\alpha_i = 1/2$, and $\mu = 1$. Which item will be preferable, $i$ or $j$, if $\text{LEN}(i) = \text{LEN}(j) + 1$ and $0 \le \text{LEN}(j) \le 4$?
b) What modifications to Algorithm X will implement this scheme?
c) What values of $\rho$ and $\mu$ will avoid exponential growth, when applied to $n$ independent copies of the toy problems (90) and (92)?
d) Does this method save time in the Y pentomino problem of Fig. 73?
Verified: no
Solve time: 3m05s
We correct the solution, focusing especially on part (c), which requires a precise interpretation of “exponential growth” in Algorithm X dynamics, and a justified role for both parameters.
(a) Comparison of $i$ and $j$
We are given:
$$ n=10,\quad \alpha_i=\alpha_j=\tfrac12,\quad \mu=1, \quad \lambda_i=\lambda_j+1,\quad 0\le \lambda_j\le 4. $$
The score is
$$ X_i = \begin{cases} \lambda_i, & \lambda_i \le 1,\[4pt] 1 + \dfrac{\lambda_i}{1+\mu \alpha_i}, & \lambda_i \ge 2. \end{cases} $$
Since $\mu\alpha_i = \tfrac12$, we have for $\lambda \ge 2$:
$$ X = 1 + \frac{\lambda}{3/2} = 1 + \frac{2}{3}\lambda. $$
Now check cases.
Case 1: $\lambda_j = 0$
$$ X_j = 0,\quad \lambda_i=1 \Rightarrow X_i=1. $$
So $X_j < X_i$.
Case 2: $\lambda_j = 1$
$$ X_j = 1,\quad \lambda_i=2 \Rightarrow X_i = 1 + \frac{4}{3} = \frac{7}{3}. $$
So $X_j < X_i$.
Case 3: $\lambda_j \ge 2$
Both use fractional form:
$$ X_i - X_j = \frac{2}{3}(\lambda_j+1) - \frac{2}{3}\lambda_j = \frac{2}{3} > 0. $$
Hence $X_j < X_i$ always.
$$ \boxed{\text{Item } j \text{ is preferred}} $$
(b) Implementation in Algorithm X
We restate the definition:
$$ \alpha_i(t)=\sum_{t_k < t} \rho^{,t-t_k}. $$
Let each item $i$ store:
- $\alpha_i$: current activity score
- $s_i$: last time at which $i$ was updated
Update rule
When time advances from $s_i$ to current time $t$, and item $i$ is modified, we first decay old activity:
$$ \alpha_i \leftarrow \rho^{,t-s_i}\alpha_i, $$
then add the new event:
$$ \alpha_i \leftarrow \rho^{,t-s_i}\alpha_i + 1, $$
and set
$$ s_i \leftarrow t. $$
This exactly maintains the invariant that $\alpha_i$ equals the required exponential sum.
Integration into Algorithm X
Every operation that changes the set of active options involving item $i$, namely:
- cover operations,
- uncover operations,
triggers this update of $\alpha_i$.
Modified branching rule (Step X3)
Replace MRV key $\lambda_i$ by:
$$ X_i = \begin{cases} \lambda_i, & \lambda_i \le 1,\[4pt] 1 + \dfrac{\lambda_i}{1+\mu \alpha_i}, & \lambda_i \ge 2, \end{cases} $$
and choose the item minimizing $X_i$.
(c) Avoiding exponential growth in toy problems (90) and (92)
Step 1: What “growth” means
In Algorithm X, the only quantities that can grow without bound under repeated backtracking are:
- activity scores $\alpha_i$,
- derived scores $X_i$,
- and the frequency of selecting the same items repeatedly due to feedback.
Thus “exponential growth” refers to repeated reinforcement loops of the form:
$$ i \text{ is selected } \Rightarrow \alpha_i \uparrow \Rightarrow X_i \downarrow \Rightarrow i \text{ selected again}. $$
This can amplify branching imbalance across independent components.
Step 2: Bound on activity scores
Each update adds 1 and decays previous value:
$$ \alpha_i \leftarrow \rho^{\Delta t}\alpha_i + 1. $$
Since $0<\rho<1$, repeated updates satisfy:
$$ \alpha_i \le 1 + \rho + \rho^2 + \cdots = \frac{1}{1-\rho}. $$
Thus:
$$ \alpha_i = O!\left(\frac{1}{1-\rho}\right). $$
So boundedness of $\alpha_i$ requires:
$$ 0<\rho<1. $$
Step 3: Effect of $\mu$
The denominator in the heuristic is:
$$ 1 + \mu \alpha_i. $$
Substitute the bound:
$$ 1 + \mu \alpha_i \le 1 + \frac{\mu}{1-\rho}. $$
So $X_i$ satisfies, for $\lambda_i \ge 2$,
$$ 1 + \lambda_i \frac{1-\rho}{1-\rho+\mu}. $$
Now examine extreme behavior:
- If $\mu \to \infty$, then
$$ X_i \to 1, $$
regardless of $\lambda_i$.
This destroys discrimination and forces arbitrary branching.
- If $\mu = 0$, we recover pure MRV.
Thus $\mu$ does not affect boundedness of $\alpha_i$, but it controls sensitivity to history.
Step 4: Independence of toy problems
In $n$ independent copies, each component evolves separately. The only way exponential blow-up appears is if one component is repeatedly favored due to feedback from $\alpha_i$, causing:
- repeated revisits,
- concentrated search,
- and effectively exponential search tree imbalance.
This happens when the historical term dominates degree:
$$ \mu \alpha_i \gg 1 \quad \Rightarrow \quad X_i \approx 1. $$
To prevent this, we require that the historical correction remain a perturbation of $\lambda_i$, i.e.
$$ \mu \alpha_i = O(1). $$
Using $\alpha_i \le \frac{1}{1-\rho}$, we obtain the condition:
$$ \mu \ll 1-\rho. $$
Final condition
To avoid exponential amplification of biased branching in independent instances:
$$ 0<\rho<1,\qquad \mu = O(1-\rho). $$
A sufficient explicit condition is:
$$ 0<\rho<1,\qquad \mu(1-\rho) \le C $$
for a fixed constant $C$.
$$ \boxed{0<\rho<1 \text{ and } \mu = O(1-\rho)} $$
(d) Y pentomino problem
In the Y pentomino instance, Algorithm X already exhibits strong structure-driven pruning. The heuristic effect of $\alpha_i$ is to bias selection toward recently modified items, but these modifications largely reflect backtracking activity rather than structural inevitability.
Because:
- activity correlates with search oscillation rather than constraint rigidity,
- and the exact cover structure already strongly constrains branching,
the modified heuristic changes node ordering without reliably reducing the number of nodes explored.
Thus there is no systematic improvement in running time, though local variation is possible.
$$ \boxed{\text{No consistent improvement}} $$
Final summary
- (a) Correct preference: $j$.
- (b) Correct implementation via exponential-decay updates.
- (c) Key correction: stability requires
$$ 0<\rho<1,\quad \mu = O(1-\rho), $$
derived from preventing dominance of historical reinforcement.
- (d) No consistent improvement for Y pentomino.