cs0605102/dp.tex
1: \subsection{A Dynamic Programming Solution for Small $L$}
2: \label{sec:dynam-progr-solut}
3: We give a dynamic program to answer the question: Is there a schedule $S$
4: such that $M(S)=T$ for a fixed $T$?  
5: %%
6: \ignore{%
7: Assume first there exists such a schedule.  Then at any
8: $x$-coordinate $i$, the set of sensors that are live at some $i'<i$ must
9: have a schedule of duration $T$ when considered only up to $i$.  This is
10: the principle of optimality we shall use as we progress left-to-right.  
11: }%%
12: In
13: the following, we ignore portions of sensors that extend above level $T$ in
14: any schedule.
15: 
16: Define $\CS_{\le i} = \bigcup_{0\leq k \le i} \CS_k$.  Consider some
17: schedules $S_{i-1}$ of $\CS_{i-1}$ and $S_i$ of $\CS_i$ such that
18: $M(S_{i-1},i-1) = M(S_i,i)=T$.  We say that $S_{i-1}$ and $S_i$ are {\em
19:   compatible} if (i) for all $s\in S_{i-1} \cap S_i,\ t_{S_{i-1}}(s) =
20: t_{S_i}(s)$; and (ii) for all $j\in[0,T)$, $(i,j)$ is covered by $S_{i-1}$
21: or $S_i$.  The first condition stipulates that any sensor in both schedules
22: must have the same start time in each; the second requires
23: a sensor in $S_i$ to be scheduled to cover each level at which coverage
24: stops at $i-1$ in $S_{i-1}$.  
25: For each $i$, we populate an array $C_i$ indexed by
26: possible schedules of $\CS_i$.  For any $S_i$, define
27: $C_i[S_i]=1$ if there is a schedule $S$ of $\CS_{\le i}$ that respects
28: $S_i$ and has $M(S,x)=T$ for $0\leq x\leq i$; and $C_i[S_i]=0$ otherwise.
29: Then $C_i[S_i] = 1$ if and only if $M(S_i,i)=T$ and there exists some
30: schedule $S_{i-1}$ of $\CS_{i-1}$ such that $C_{i-1}[S_{i-1}]=1$ and
31: $S_{i-1}$ is compatible with $S_i$.  For $i=0$, $C_0[S_0]=1$ for precisely
32: those schedules $S_0$ of $\CS_0$ that have $M(S_0,0)=T$.  The dynamic
33: program then populates the arrays $C_i$ in increasing order of $i$, by
34: checking all schedules of $\CS_i$ for each $i$.  Ultimately we check if
35: there is some schedule $S_{2n-1}$ of $\CS_{2n-1}$ such that
36: $C_{2n-1}[S_{2n-1}]=1$.
37: 
38: \newpar{First Analysis.}
39: %%
40: For a schedule $S_i$ of $\CS_i$, consider the union of the rectangles of
41: $S_i$, and denote by $\partial(S_i)$ the vertical boundaries of this union.
42: If $S_i$ is part of a minimal schedule $S$ of duration $T$, then
43: any rectangle of $S_i$ must cover some point on
44: $\partial(S_i)$ that is covered by no other rectangles in $S_i$.  
45: Thus $|S_i| \le 2T$, because $\partial(S_i)$ has total length
46: $2T$.  
47: 
48: Now we can analyze the dynamic program, which we restrict to consider only
49: minimal schedules.  The number of sensors in any schedule of $\CS_i$ is at
50: most $2T$, so there are at most $\binom{n}{2T}T^{2T}$ possible schedules of
51: $\CS_i$, as each potential set of $\eta$ sensors can be scheduled in
52: $T^\eta$ ways.  Each schedule of $\CS_i$ must be checked for compatibility
53: against each schedule of $\CS_{i-1}$, and checking compatibility of a pair
54: of schedules takes $O(T)$ time.  Hence the time to run the whole dynamic
55: program is $2n \left( \binom{n}{2T} T^{2T}\right)^2 O(T) = (nT)^{O(T)} =
56: (nL)^{O(L)} $.
57: To determine $\opt$, we run the dynamic program for each of the $L$
58: possible values of $T$, which does not affect the overall asymptotics.
59: 
60: \newpar{Partitioning the Dynamic Program.}
61: Now we restrict the $x$-coordinates on which we have to run the
62: dynamic program to those with relatively few live sensors.
63: Let $X = \{ i : |\CS_i| < 5T \}$.  
64: We claim that $\CS$ has a schedule of duration $T$ if and only if $\CS$ has
65: a schedule $S$ such that $M(S,i) \ge T$ for any $i\in X$.  We prove
66: the ``if'' part; the ``only if'' part is clear.
67: 
68: Assume  that there is a minimal schedule $S$ of duration $T$
69: that only covers $X$.  We show how to schedule the sensors not used
70: in $S$ to cover all $x$-coordinates.  Consider any maximal
71: interval $\bar{X}$ of $x$-coordinates not in $X$.  At most $4T$ sensors
72: from $S$ are live at any $i\in\bar{X}$, because any such sensor is also
73: live at either $\min(\bar{X})-1$ or $\max(\bar{X})+1$, and at most $2T$ are
74: live at either one.  By construction, there are at least $5T$ sensors live
75: at any $i\in\bar{X}$, so there are at least $5T-4T=T$ sensors live at $i$
76: that are not used by $S$ and hence are available, which suffice to cover
77: all the levels at $i$.  If such a sensor $s$ should also be live at another
78: $i'\in\bar{X}$ (or another $i'$ in another $\bar{X'}$), it reduces by one
79: both the number of potential uncovered levels and the number of available
80: sensors live at $i'$, so enough sensors will remain at $i'$.
81: 
82: Therefore we need only run the dynamic program on the $x$-coordinates in
83: $X$.  This takes only $2n\cdot T^{O(T)}$ time, because there are fewer than
84: $5T$ sensors live at any $i \in X$.  Thus we have:
85: 
86: \begin{theorem}
87: \label{thm:dp1}
88: \odspname~can be solved exactly in time $2n\cdot L^{O(L)}$.
89: \end{theorem}
90: 
91: \begin{corollary}
92:   \label{cor:dpc}
93:   \odspname~can be solved exactly in $\poly(n)$ time if $L< c \cdot \log
94:   n/\log\log n$ for some constant $c$ small enough.
95: \end{corollary}
96: 
97: Using a standard trick, a PTAS follows directly by truncating durations
98: appropriately. 
99: 
100: \begin{corollary}
101:   \label{thm:dp2}
102:   There is a PTAS for \odspname if $L < c \cdot \hmin \log n / \log\log n$
103:   for some sufficiently small constant $c$.
104: \end{corollary}
105: 
106: %%% Local Variables:
107: %%% mode: latex
108: %%% TeX-master: "main"
109: %%% End:
110: