cs0210024/paper.tex
1: \documentclass[11pt]{article}
2: 
3: % Make \epsilon and \varepsilon consistently \varepsilon
4: \let\epsilon=\varepsilon
5: 
6: \usepackage{fullpage}
7: \usepackage{epsfig}
8: \usepackage{amssymb}
9: 
10: \newtheorem{thm}{Theorem}
11: \newtheorem{lem}[thm]{Lemma}
12: \newtheorem{conj}[thm]{Conjecture}
13: \newtheorem{cor}[thm]{Corollary}
14: \newtheorem{dfn}[thm]{Definition}
15: \newtheorem{fact}[thm]{Fact}
16: \newtheorem{claim}[thm]{Claim}
17: 
18: \newenvironment{pf}{{\bf Proof:}}{\hfill $\Box$ \bigbreak}
19: 
20: \begin{document}
21: 
22: \title{The Lazy Bureaucrat Scheduling Problem\thanks{
23: Appears in preliminary form in
24: {\em Proceedings of the Workshop on Discrete Algorithms (WADS)},
25: Vancouver, BC, Canada, Aug 11--14, 1999, pages 
26: 122--133~\cite{ArkinBenderMitchellSkiena99}.}}
27: 
28: \author{Esther M. Arkin\thanks{estie@ams.sunysb.edu. 
29: Department of Applied Mathematics and Statistics.
30: State University of New York, Stony Brook, NY 11794-3600.
31: Partially supported by 
32: the National Science Foundation (CCR-9732220, CCR-0098172) and
33: grants from ISX Corp.\ and HRL Laboratories.}
34: \and
35: Michael A. Bender\thanks{bender@cs.sunysb.edu.
36: Department of Computer Science.
37: State University of New York, Stony Brook, NY 11794-4400.
38: Partially supported by 
39: grants from ISX Corp., HRL Laboratories, Sandia National 
40: Labs, and the National Science Foundation (EIA-0112849, CCR-0208670).}
41: %
42: \and
43: Joseph S. B. Mitchell\thanks{jsbm@ams.sunysb.edu.
44: Department of Applied Mathematics and Statistics.
45: State University of New York, Stony Brook, NY 11794-3600.
46: Supported in part by 
47: HRL Laboratories, Honda Fundamental Research Labs, ISX Corp., Metron Aviation, Inc., Sandia National 
48: Labs, Seagull Technologies, Sun Microsystems, and 
49: the National Science Foundation (CCR-9732220, CCR-0098172).}
50: %
51: \and
52: Steven S. Skiena\thanks{skiena@cs.sunysb.edu.
53: Department of Computer Science.
54: State University of New York, Stony Brook, NY 11794-4400.
55: Supported in part by
56: the National Science Foundation (CCR-9988112) and
57: by the Office of Naval Research (N00149710589).}
58: }
59: 
60: \maketitle
61: 
62: \begin{abstract}
63:   We introduce a new class of scheduling problems in which the
64:   optimization is performed by the worker (single ``machine'') who
65:   performs the tasks.  A typical worker's objective is to minimize the
66:   amount of work he does (he is ``lazy''), or more generally, to
67:   schedule as inefficiently (in some sense) as possible.  The worker
68:   is subject to the constraint that he must be busy when there is work
69:   that he {\em can\/} do; we make this notion precise both in the
70:   preemptive and nonpreemptive settings.  The resulting class of
71:   ``perverse'' scheduling problems, which we denote ``Lazy Bureaucrat
72:   Problems,'' gives rise to a rich set of new questions that explore
73:   the distinction between maximization and minimization in computing
74:   optimal schedules.
75: \end{abstract}
76: 
77: \noindent {\bf Keywords:}\quad
78: Scheduling, Approximation Algorithms,
79: Optimization, Dynamic Programming, NP-completeness, Lazy Bureaucrat.
80: 68M20, 68Q25, 90B35, 90B70.
81: 
82: \section{Introduction}
83: 
84: Scheduling problems have been studied extensively from the point of
85: view of the objectives of the enterprise that stands to gain from the
86: completion of a set of jobs.  We take a new look at the problem from
87: the point of view of the workers who perform the tasks that earn the
88: company its profits.  In fact, it is natural to expect that some
89: employees may lack the motivation to perform at their peak levels of
90: efficiency, either because they have no stake in the company's profits
91: or because they are simply lazy.  
92: 
93: The following example illustrates
94: the situation facing a ``typical'' office worker, who may be one small
95: cog in a large bureaucracy:
96: 
97: \begin{quote}
98: {\em Example.}\quad It is 3:00~p.m., and Dilbert goes home at
99: 5:00~p.m.  Dilbert has two tasks that have been given to him: one
100: requires 10 minutes, the other requires an hour.  If there is a task
101: in his ``in-box,'' Dilbert must work on it, or risk getting fired.
102: However, if he has multiple tasks, Dilbert has the freedom to choose
103: which one to do first.  He also knows that at~3:15, another task will
104: appear --- a 45-minute personnel meeting.  If Dilbert begins the
105: 10-minute task first, he will be free to attend the personnel meeting
106: at~3:15 and then work on the hour-long task from~4:00 until~5:00.  On
107: the other hand, if Dilbert is part way into the hour-long job at~3:15,
108: he may be excused from the meeting.  After finishing the 10-minute job
109: by~4:10, he will have 50~minutes to twiddle his thumbs, iron his tie,
110: or enjoy engaging in other mindless trivia.  Naturally, Dilbert
111: prefers this latter option.
112: \end{quote}
113: 
114: An historical example of a situation where it proved crucial to
115: schedule tasks inefficiently is documented in the book/movie {\em
116:   Schindler's List\/}~\cite{Keneally-82}.  It was essential for the
117: workers and management of Schindler's factory to appear to be busy at
118: all times in order for the factory to stay in operation, but they
119: simultaneously sought to minimize their contribution to the German war
120: effort.
121: 
122: These examples illustrate a general and natural type of scheduling
123: problem, which we term the ``Lazy Bureaucrat Problem'' (LBP); the goal
124: of the LBP is to schedule jobs as {\em inefficiently\/} (in some
125: sense) as possible.  There exists a vast literature on scheduling; see
126: e.g., some of the recent
127: surveys~\cite{KargerSteinWein:1997,LLKS-93,Pinedo-95}.  The LBP
128: studies these traditional problems ``in reverse.''  Several other
129: combinatorial optimization problems have also been studied in reverse,
130: leading, e.g., to maximum
131: TSP~\cite{BarvinokJWW1998,Fekete1999,HassinRubinstein1998,KosarajuParkStein1994},
132: maximum cut~\cite{GoemansWilliamson1995}, and longest
133: path~\cite{KargerMotwaniRamkumar1997}; such inquiries often lead to a
134: better understanding of the structure and algorithmic complexity of
135: the original optimization problem.
136: 
137: \subsection{The Model} 
138: \label{subsec-model}
139: 
140: In this paper we schedule a set of jobs $1 \ldots n$ having processing
141: times (lengths) $t_1 \ldots t_n$ respectively.  Job $i$ {\em
142:   arrives\/} at time $a_i$ and has its {\em deadline\/} at time $d_i$.
143: We assume throughout this paper that $t_i$, $a_i$, and $d_i$ have
144: nonnegative integral values.  The jobs have {\em hard deadlines,\/}
145: meaning that each job $i$ can only be executed during its allowed
146: interval $I_i = [a_i, d_i]$; we also call $I_i$ the job's {\em
147:   window\/}. We let $c_i=d_i-t_i$ denote the {\em critical time\/} of
148: job~$i$; job~$i$ must be started by time $c_i$ if there is any chance
149: of completing it on time.
150: 
151: The jobs are executed on a single processor, the (lazy) {\em
152: bureaucrat\/}.  The bureaucrat executes only one job at a time.  
153: 
154: \subsubsection{Busy Requirement}
155: 
156: The bureaucrat chooses a subset of jobs to execute.  Since the
157: bureaucrat's goal is to minimize his effort, he would prefer to remain
158: idle all the time and to leave all the jobs unexecuted.  However, this
159: scenario is forbidden by what we call the {\em busy requirement,\/}
160: which stipulates that the bureaucrat work on an {\em executable\/}
161: job, if any executable jobs exist.  A job is {\em executable\/} if the
162: constraints of the LBP allow the job to be run.  Thus, in the
163: nonpreemptive setting a job $j $ is executable as long as it begun
164: during the interval $[a_j, c_j]$, at which point it is run to
165: completion.  In the preemptive setting the constraints that govern
166: whether or not a job can be executed are more complicated; see
167: Section~\ref{sec:preempt}.
168: 
169: \subsubsection{Objective Functions}
170: 
171: In traditional scheduling problems, if it is impossible to complete
172: the set of all jobs by their deadlines, one typically optimizes
173: according to some objective, e.g., to maximize a weighted sum of
174: on-time jobs, to minimize the maximum lateness of the jobs, or to
175: minimize the number of late jobs.  For the LBP we consider three
176: different objective functions, which naturally arise from the
177: bureaucrat's goal of inefficiency:
178: %
179: \begin{enumerate}
180: 
181: \item
182: {\em Minimize the total amount of time spent working\/} ---
183: This objective naturally appeals to a ``lazy'' bureaucrat.
184: 
185: \item
186: {\em Minimize the weighted sum of completed jobs\/} ---  In this paper
187: we usually assume that the weight of job $i$ is its length, $t_i$;
188: however, other weights (e.g., unit weights) are also of interest.
189: This objective appeals to a ``spiteful'' bureaucrat whose goal it is
190: to minimize the fees that the company collects on the basis of his
191: labors, assuming that the fee (in proportion to the task length, or a
192: fixed fee per task) is collected only for those tasks that are
193: actually completed.
194: 
195: \item
196: {\em Minimize the {\em makespan}, the maximum completion
197: time of the jobs\/} ---  This objective appeals to an ``impatient''
198: bureaucrat, whose goal it is to go home as early as possible, at the
199: completion of the last job he is able to complete.  He cares about the
200: number of hours spent at the office, not the number of hours spent
201: doing work (productive or otherwise) at the office.
202: 
203: Note that, in contrast with standard scheduling problems on one
204: processor, the makespan in the LBP varies; 
205: it is a function of which jobs have passed their
206: deadlines and can no longer be executed.
207: 
208: \end{enumerate}
209: 
210: \subsubsection{Additional Parameters of the Model}
211: As with most scheduling problems, additional parameters of the model
212: must be set.  For example, we must explicitly allow or forbid {\em
213: preemption\/} of jobs.  When a job is {\em preempted\/}, 
214: it is interrupted and may be resumed later at no additional cost.  
215: If we forbid preemption, then once a job is begun, 
216: it must be completed without interruptions.
217: 
218: We must also specify whether scheduling occurs {\em on-line\/} or
219: {\em off-line.\/} A scheduling algorithm is 
220: off-line
221: if all the jobs are known to the scheduler at the outset; it is
222: on-line if the jobs are known to the scheduler only as they arrive.
223: In this paper we restrict ourselves to off-line scheduling; we leave
224: the on-line case as an 
225: open problem.
226: 
227: 
228: \begin{figure*}[bt] 
229: \def\RESULT#1{\vbox{\vskip 2pt\hbox{#1}\vskip 0.5pt}}
230: \begin{center}
231: \begin{tabular}{|l||c||c|}
232: \hline
233: {\bf Instance} & {\bf Metric} & {\bf Complexity} \\
234: \hline \hline
235: $\bullet$ Unit-length jobs: $t_1 =  \cdots = t_n = 1$  & \RESULT{1}
236: & \RESULT{Polynomial time} \\
237: \hline
238: $\bullet$ Short job intervals:  \mbox{$\forall i \, \, d_i - a_i < 2 t_i $} & 
239: \RESULT{1-3}  &
240: \RESULT{Pseudo-polynomial time} \\
241: \hline
242: $\bullet$ Ratios $R = O(1)$  and $\Delta = O(1)$ & 
243: \RESULT{1-3}  &
244: \RESULT{Pseudo-polynomial time} \\
245: \hline
246: $\bullet$ Same arrival times: $a_1 = \cdots = a_n$ & \RESULT{1-3}  
247: &
248: \RESULT{Pseudo-polynomial time} \\
249: \RESULT{~~~~}  & \RESULT{~~~~}  & 
250:  \RESULT{(Weakly) NP-complete} \\
251: \RESULT{~~~~} & 
252: \RESULT{~~~~~~} & 
253: \RESULT{Hard to approximate} \\
254: \hline
255: $\bullet$ Job size ratio $\Delta = O(1)$
256: & \RESULT{1-3}
257: &
258:  \RESULT{Strongly NP-complete} \\
259: \RESULT{~~~~}  & \RESULT{~~~~}  &
260:  \RESULT{Hard to approximate} \\
261: \hline
262: $\bullet$ General LBP
263: & \RESULT{1-3}
264: &
265:  \RESULT{Strongly NP-complete} \\
266: \RESULT{~~~~}  & \RESULT{~~~~}  &
267:  \RESULT{Hard to approximate} \\
268: \hline
269: \end{tabular}
270: \end{center}
271: \caption{
272:   Summary of our nonpreemptive results; see Section~\ref{nonpreempt}.}
273: \label{tab:nonpreemtive-results}
274: \end{figure*}
275: 
276: \subsection{Our Results}
277: 
278: In this paper, we introduce the Lazy Bureaucrat Problem and develop
279: algorithms and hardness results for several versions of the LBP.  {From}
280: these results, we derive some general characteristics of this new
281: class of scheduling problems and describe (1) situations in which
282: traditional scheduling algorithms extend to the LBP and (2)
283: situations in which these algorithms no longer apply.  
284: 
285: 
286: \subsubsection{No Preemption}
287: We prove that the LBP is NP-complete, as is often the case for
288: traditional scheduling problems. Thus, we focus on special cases to
289: study exact algorithms.  When all
290: jobs have unit size, optimal schedules can be found in polynomial
291: time.
292: The following three cases have pseudo-polynomial algorithms:
293: (1) when each job $i$'s interval $I_i$ is less 
294: than twice the processing time of job $i$;
295: (2) when the ratios of interval length to job length and longest job
296: to shortest job are both bounded; and (3) when all jobs arrive in the
297: system at the same time.
298: These last scheduling problems are solved using dynamic programming
299: both for Lazy Bureaucrat and traditional metrics.  Thus, in these
300: settings, the Lazy Bureaucrat metrics and traditional metrics are
301: solved using similar techniques.
302: 
303: {From} the point of view of approximation, however, the standard and
304: Lazy Bureaucrat metrics behave differently.  Standard metrics
305: typically allow polynomial-time algorithms having good approximation
306: ratios, whereas we show that the Lazy Bureaucrat metrics are difficult
307: to approximate.  This hardness derives more from the busy requirement
308: and less from the particular metric in question, that is the busy
309: requirement appears to render the problem substantially more
310: difficult.  (Ironically, even in standard optimization problems, the
311: management often imposes this requirement because it intuitively
312: appears desirable.)
313: 
314: \begin{figure*}[bt] %Htp
315: \def\RESULT#1{\vbox{\vskip 2pt\hbox{#1}\vskip 0.5pt}}
316: \begin{center}
317: \begin{tabular}{|c|c||l|}
318: \hline
319: {\bf Preemption} & {\bf Metrics} & {\bf Complexity}\\
320: \hline \hline
321: \RESULT{I} & \RESULT{1-3} &
322: \RESULT{Polynomial Time} \\
323: \hline
324: \RESULT{II} & \RESULT{1-3} &
325: \RESULT{(Weakly) NP-complete,  even when $a_0 = \cdots = a_n$} \\
326: \hline
327: \RESULT{III} & \RESULT{1-3} &
328: \RESULT{(Weakly) NP-complete,  even when \mbox{$a_0 = \cdots = a_n$}} \\
329: \RESULT{~~~} & \RESULT{~~~} & \RESULT{Hard to approximate} \\
330: \hline
331: \end{tabular}
332: \end{center}
333: \caption{Summary of our preemptive results; see Section~\ref{sec:preempt}.}
334: \label{tab:preemtive-results}
335: \end{figure*}
336: 
337: 
338: \subsubsection{Preemption}
339: 
340: The busy requirement dictates that the worker must stay busy while
341: work is in the system. If the model allows preemption we must specify
342: under what conditions a job can be interrupted or resumed. We
343: distinguish three versions of the preemption rules, which we list from
344: most permissive to most restrictive. In particular,
345: workers are constrained to execute the following jobs:
346: \begin{description}
347: \item[] (I) any job that has arrived and is before its deadline,
348: \item[] (II) any job that has arrived and for which there is still
349:   time to complete it before its deadline, or
350: \item[] (III) any job that has arrived, but with the constraint that
351:   if it is started, it must eventually be completed.
352: \end{description}
353: 
354: We consider all three metrics and all three versions of preemption. We
355: show that, for all three metrics, version~I is polynomially solvable,
356: and version~III is NP-complete. Many of the hardness results for no
357: preemption carry over to version~III. 
358: 
359: Our main results are for version~II. We show that the general problem
360: is NP-complete. Then, we focus on minimizing the makespan in two
361: complementary special cases: 
362: %
363: \begin{enumerate}
364: 
365: \item
366: All jobs have a common arrival time and arbitrary deadlines.
367: 
368: \item
369:  All jobs have a common deadline and arbitrary arrival times.  
370: \end{enumerate}
371: 
372: \noindent
373: We show that the first problem is
374: NP-complete, whereas the second problem can be solved in polynomial
375: time.
376: 
377: These last results illustrate a curious feature of the LBP. One can
378: convert one special case into the other by reversing the direction of
379: time. In the LBP, unlike many scheduling settings, this reversing of
380: time changes the complexity of the problem.
381: 
382: \begin{figure*}[bt] 
383: \def\RESULT#1{\vbox{\vskip 2pt\hbox{#1}\vskip 0.5pt}}
384: \begin{center}
385: \begin{tabular}{|l||c|c||c|}
386: \hline
387: {\bf Instance} & 
388: {\bf Preemption} & 
389: {\bf Metric} & 
390: {\bf Complexity}\\
391: \hline \hline
392: $\bullet $ Arbitrary deadlines  &
393: \RESULT{II} &
394: \RESULT{3} & 
395: \RESULT{(Weakly) NP-Complete} \\
396: %
397: $\bullet $ Identical job arrivals: &
398: \RESULT{~~~} & 
399: \RESULT{~~~} & 
400: \RESULT{Hard to approximate} \\
401: %
402: ~~~~$a_1 =  \cdots = a_n = 0$ & 
403: \RESULT{~~~} & 
404: \RESULT{~~~} & 
405: \RESULT{~~~} \\
406: \hline 
407: %
408: $\bullet $ Arbitrary job arrivals &
409: \RESULT{II} &
410: \RESULT{3} & \RESULT{Polynomial time} \\
411: $\bullet $ Identical deadlines: & 
412: \RESULT{~~~} &
413: \RESULT{~~~} &
414: \RESULT{~~~} \\
415: %
416: ~~~~$d_1 =  \cdots = d_n = D$  &
417: \RESULT{~~~} &
418: \RESULT{~~~} &
419: \RESULT{~~~} \\
420: \hline
421: \end{tabular}
422: \end{center}
423: \caption{
424:   Illustration that reversal of time changes complexity; see
425:   Section~\protect\ref{sec:pmtn-makespan}.}
426: \label{tab:time-reversal}
427: \end{figure*}
428: 
429: \subsection{Related Work on the LBP}
430: 
431: Recently Hepner and Stein~\cite{HepnerStein2002}
432: published a pseudo-polynomial-time algorithm
433: for minimizing the makespan subject to preemption constraint II,
434: thus resolving an open problem from
435: an earlier version of this paper~\cite{ArkinBenderMitchellSkiena99}.
436: They also extend the LBP to the parallel setting, 
437: in which there are multiple bureaucrats.
438: 
439: 
440: \section{LBP: No Preemption}
441: \label{nonpreempt}
442: 
443: 
444: In this section, we assume that no job can be preempted: if a job is
445: started, then it is performed without interruption until it completes.
446: We show that the Lazy Bureaucrat Problem (LBP) without preemption is
447: strongly NP-complete and is not approximable to within any factor for
448: the three metrics we consider.  These hardness results distinguish our
449: problem from traditional scheduling metrics, which can be approximated
450: in polynomial time, as proved in~\cite{BGNS-99}.  We show, however,
451: that several special cases of the problem have pseudo-polynomial-time
452: algorithms, using applications of dynamic programming.
453: 
454: \subsection{Hardness Results}
455: \label{sec:hard}
456: 
457: We begin by describing the relationship
458: between the three different objective functions 
459: from Section~\ref{sec:hard}
460: in the case of no preemption.  
461: 
462: The problem of minimizing the
463: total work (objective function 1) is a special case of the problem of 
464: minimizing the weighted sum of completed jobs 
465: (objective function 2), because without preemption 
466: every job that is
467: executed must be completed.  (The weights become the job lengths.)
468: Furthermore, if all jobs have
469: the same arrival time, say time zero, then the 
470: two objectives 
471: minimizing the total amount of time spent working
472: and minimizing  the makespan (go home early) are equivalent
473: (objective functions 1 and 3), since
474: no feasible schedule will have any gaps.
475: Our first hardness theorem
476: applies therefore to all three objective functions
477: from Section~\ref{sec:hard}.
478: 
479: \begin{thm}
480: \label{thm:hard1}
481: The Lazy Bureaucrat Problem with no preemption is (weakly) NP-complete
482: for objective functions (1)-(3), 
483: and is not approximable to within any fixed factor, even when all arrival
484: times are the same.
485: \end{thm}
486: 
487: \begin{pf}
488: We use a reduction from the {\sc Subset Sum} problem~\cite{GJ-79}:
489: Given a set of
490: integers $S=\{x_1,x_2,\ldots,x_n\}$ and a target integer $T$, does there 
491: exist a subset $S'\subseteq S$, such that $\sum_{x_i\in S'}x_i=T$?
492: 
493: We construct an instance of the LBP having $n+1$ jobs, each having
494: release time zero ($a_i=0$ for all $i$). For $i=1\ldots,n$, job $i$
495: has processing time $t_i=x_i$ and deadline $d_i=T$.  Job $n+1$ has
496: processing time $t_{n+1}=1+\sum_{x_i\in S}x_i$ and deadline
497: $d_{n+1}=T+t_{n+1}-1$; thus, job $n+1$ can be started at time $T-1$ or
498: earlier.  Because job $n+1$ is so long, the bureaucrat wants to avoid executing
499: it, but can do so if and
500: only if he selects a subset of jobs from $\{1,\ldots,n\}$ to execute
501: whose lengths sum to exactly~$T$.
502: In summary, the large job $n+1$ is executed if and only if
503: the subset problem is solved exactly and executing the long job
504: leads to a schedule whose makespan (i.e., total work executed)
505: is not within any fixed factor of the optimal solution.
506: \end{pf}
507: 
508: 
509: We now show that the LBP with no preemption
510: is strongly NP-complete.  
511: As we will show in Section~\ref{pseudo}, the LBP from Theorem~\ref{thm:hard1}
512: when all arrival times are equal,
513: has a pseudo-polynomial-time algorithm.
514: However, if arrival times and deadlines are arbitrary integers, the
515: problem becomes strongly NP-complete. 
516: Thus, the following theorem
517: subsumes Theorem~\ref{thm:hard1} when arrival times and deadlines
518: our unconstrained, whereas
519: Theorem~\ref{thm:hard1} is more generally applicable.
520: 
521: \begin{thm}
522: \label{thm:hard2}
523: The Lazy Bureaucrat Problem with no preemption is strongly
524: NP-complete for objective functions (1)--(3), and is not approximable to within any fixed factor.
525: \end{thm}
526: 
527: \begin{pf}
528: Clearly the problem is in NP, since any solution can be represented
529: by an ordered list of jobs, given their arrival times.
530: To show hardness,
531: we use a reduction from the {\sc 3-Partition} problem~\cite{GJ-79}:
532: Given a
533: set $S=\{x_1,\ldots,x_{3m}\}$ of $3m$ positive integers and a positive
534: integer bound $B$ such that $B/4<x_i<B/2$, for $i=1,\ldots,3m$ and
535: $\sum_i x_i=mB$, does there exist a partitioning of $S$ into $m$
536: disjoint sets, $S_1,\ldots,S_m$, such that for $i=1,...,m$,
537: $\sum_{x_j\in S_i} x_j=B$? (Note that, by the assumption that
538: $B/4<x_i<B/2$, each set $S_i$ must contain exactly 3 elements.)
539: 
540: Objective function (1)
541: is a special case of
542: objective function (2)
543: because without preemption, any job that is begun must be completed.
544: Furthermore, hard instances will be designed so that there are no gaps,
545: ensuring that the optimal solution for objective function (1)
546: is also the optimal solution for objective function (3).
547: 
548: 
549: We construct an instance of the LBP containing three classes of jobs:
550: 
551: \begin{itemize}
552: \item {\em Element jobs\/} --- We define one ``element job'' corresponding to
553: each element $x_i\in S$, having arrival time~$0$, deadline
554: $d_i=(m-1)+mB$, and processing time~$x_i$.
555: 
556: \item {\em Unit jobs\/} --- 
557:  We define $m-1$ ``unit'' jobs, each of length
558: $1$. The $i$-th unit job (for $i=1,\ldots,m-1$) has arrival time
559: $i(B+1)-1$ and deadline $i(B+1)$. Note that for these unit-length jobs
560: we have $d_j-a_j=1$; thus, these jobs must be processed immediately
561: upon their arrival, or not at all.
562: 
563: \item {\em Large job\/} --- 
564: We define one ``large'' job of length $L>(m-1)+mB$,
565: arrival time $0$, and deadline $L+(m-2)+mB$. Note that in order to
566: complete this job, it must be started at time $(m-2)+mB$ or before.
567: \end{itemize}
568: 
569: As in the proof of Theorem~\ref{thm:hard1}, the lazy bureaucrat wants
570: to avoid executing the long job, but can do so if and only if all
571: other jobs are actually executed.  Otherwise, there will be a time
572: when the large job is the only job in the system and the lazy
573: bureaucrat will be forced to execute it.  Thus, the unit jobs must be
574: done immediately upon their arrival, and the element jobs must fit in
575: the intervals between the unit jobs.  Each such interval between
576: consecutive unit jobs is of length exactly $B$.  Refer to
577: Figure~\ref{fig:no-preempt-hard}. In summary, the long job is not
578: processed if and only if all of the element and unit jobs can be
579: processed before their deadlines, which happens if and only if the
580: corresponding instance of {\sc 3-Partition} is a ``yes'' instance.
581: Note that since $L$ can be as large as we want, this also implies that
582: no polynomial-time approximation algorithm with any fixed
583: approximation bound can exist, unless P=NP.  
584: \end{pf}
585: 
586: \begin{figure}[htbp]
587: \begin{center}
588: \input{fig1.pstex_t}
589: \end{center}
590: \caption{
591:   Proof of hardness of LBP with no preemption and arbitrary arrival
592:   times.}
593: \label{fig:no-preempt-hard}
594: \end{figure}
595: 
596: 
597: \subsection{Algorithms for Special Cases}
598: \label{pseudo}
599: 
600: \subsubsection{Unit-Length Jobs}
601: 
602: Consider the special case of the LBP in which all
603: jobs have unit processing times.
604: (Recall that all inputs are assumed to be integral.)
605: The Latest Due Date (LDD) scheduling policy 
606: selects the job in the system having the latest deadline.
607: Note that this policy in nonpreemptive for unit-length jobs, since
608: all jobs have integral arrival times.
609: 
610: 
611: \begin{thm}
612: Consider the Latest Deadline First scheduling policy 
613: when jobs have unit lengths and all inputs are integral.
614: The LDD scheduling policy
615: minimizes the amount of executed work.
616: \end{thm}
617: 
618: \begin{pf}
619: Assume by contradiction that no optimal schedule is LDD.  We use an
620: exchange argument. 
621: Consider an optimal (non-LDD) schedule that has
622: the fewest pairs of jobs executed in non-LDD order.  
623: The schedule must have two neighboring jobs $i,j$ such that $i<j$ in the
624: schedule but $D_i<D_j$, and $j$ is in the system when
625: $i$ starts its execution. Consider the first such pair of jobs. 
626: There are two cases:
627: 
628: (1) The new schedule with $i$ and $j$ switched, is feasible. It
629: executes no more work than the optimal schedules, and is therefore
630: also optimal.
631: 
632: (2) The schedule with $i$ and $j$ switched is not feasible. This
633: happens if $i$'s deadline has passed.  If no job is in the system
634: to replace $i$, then we obtain a better schedule than the optimal schedule
635: and reach a contradiction.
636: Otherwise, we replace $i$ with the other job and repeat the switching
637: process.
638: 
639: We obtain a schedule executing no more work than an optimal
640: schedule, but with fewer pairs of jobs in non-LDD order, a contradiction.
641: \end{pf}
642: 
643: 
644: \subsubsection{Narrow Windows}
645: Consider now the version in which jobs are large in comparison with
646: their intervals,  that is, the intervals are ``narrow.''
647: Let $R$ be a bound on the ratio of window length to job length; i.e.,
648: for each job $i$, $d_i-a_i< R \cdot t_i$. 
649: We show that a pseudo-polynomial algorithm exists for the case of
650: sufficiently narrow windows, that is,  when $R \leq 2$.
651: 
652: \begin{lem}
653: \label{lem:unique-ordering}
654: Assume that for each job $i$, $d_i-a_i<2t_i$.
655: Then, if job $i$ can be
656: scheduled before job $j$, then job $j$ cannot be scheduled before
657: job~$i$.
658: \end{lem}
659: 
660: \begin{pf}
661: We rewrite the assumption: for each $i$, $d_i-t_i< t_i+a_i$.
662: The fact that job $i$ can be scheduled before job $j$ is equivalent to
663: the statement that $a_i+t_i\leq d_j-t_j$, since the earliest that job
664: $i$ can be completed is at time $a_i+t_i$ and the latest that job $j$
665: can be started is at time $d_j-t_j$.  Combining these inequalities,
666: we obtain
667: %
668: $$a_j+t_j> d_j-t_j\geq a_i+t_i > d_i-t_i,$$
669: %
670: which implies that job $j$ cannot be scheduled before job~$i$.
671: \end{pf}
672: 
673: \begin{cor}
674: Under the assumption that $d_i-a_i<2t_i$ for each $i$, the ordering
675: of any subset of jobs in a schedule is uniquely determined.
676: \end{cor}
677: 
678: \begin{thm}
679: Suppose that for each job $i$, $d_i-a_i< 2 t_i$.
680: Let $K=\max_i d_i$.
681: Consider the problem of minimizing 
682: objective functions~(1)-(3) 
683: from Section~\ref{subsec-model}, 
684: in the nonpreemptive setting.
685: Then the LBP can be solved in $O(n K \max(n,K))$ time.
686: \label{fixed-window-DP}
687: \end{thm}
688: 
689: \begin{pf}
690: We use dynamic programming to find the shortest path in a 
691: directed acyclic graph (DAG).
692: There are $O(nK^2)$ states the system can enter.
693: Let $(i,j,\tau)$ denote the state of the system when the processor
694: begins executing the $j$-th unit of work of job $i$ at time $\tau$.
695: Thus, $i=1,...,n$, $j=1,...,t_i$, and $\tau =0,...,K$. Transitions
696: from state to state are defined according to the following rules:
697: 
698: \begin{enumerate}
699: \item No preemption: once a job is begun, it must be completed without
700:   interruptions.
701: \item When a job is completed at time $\tau$, another job must begin
702:   immediately if one exists in the system. (By
703:   Lemma~\ref{lem:unique-ordering}, we know this job has not yet been
704:   executed.) Otherwise, the system is idle and begins executing a job
705:   as soon as one arrives.
706: \item State $(i,t_i,\tau)$ is an end state if and only if when job $i$
707:   completes at time $\tau$, no jobs can be executed subsequently.
708: \item The start state has transitions to the jobs $(i,1,0)$ that
709:   arrive first.
710: \end{enumerate}
711: 
712: The goal of the dynamic program is to find the length of a shortest
713: path from the start state to an end state.  Depending on how we assign
714: weights to the edges we can force our algorithm to minimize all three
715: metrics from Section~\ref{subsec-model}.  To complete the time
716: analysis, note that only $n K$ of the $nK^2$ states have more than
717: constant outdegree, and these states each have outdegree bounded
718: by~$n$.
719: \end{pf}
720: 
721: For $R>2$ we know of no efficient algorithm without additional
722: conditions.
723: Let $W$ be a bound on the ratio of longest window to shortest window, and let
724: $\Delta$ be a bound on the ratio of the longest job to the shortest job.
725: Note that bounds on $R$ and $\Delta$ imply a bound on $W$, and
726: bounds on $R$ and $W$ imply a bound on $\Delta$.
727: However, a bound on $\Delta$ alone is not sufficient for a 
728: pseudo-polynomial-time algorithm.
729: 
730: \begin{thm}
731: \label{thm:bounded-Delta}
732: Even with a bound on the ratio $\Delta$, the LBP with no preemption
733: is strongly NP-complete for objective functions~(1)-(3).
734: It cannot be approximated to within  a factor of $\Delta - \epsilon$, 
735: for any $\epsilon>0$, unless P=NP.
736: \end{thm}
737: 
738: \begin{pf}
739: Modify the reduction from 3-partition of Theorem~\ref{thm:hard2},
740: by changing all the fixed ``unit'' jobs to have length $B/3$,
741: and adjust the arrival times and deadlines accordingly.
742: 
743: Instead of one very long job
744: as in the proof from Theorem~\ref{thm:hard2},
745: we create a sequence of bounded-length jobs that serve the same purpose.
746: One unit before the deadline of the ``element'' jobs
747: (see Theorem~\ref{thm:hard2}) a sequence of longer jobs
748: $\ell_1,\ldots,\ell_m$ arrives.  Each job $\ell_i$ entirely fills its window
749: and so can only be executed directly when it arrives.  Job  $\ell_{i+1}$
750: arrives at the deadline of job  $\ell_i$.  In addition, a sequence of
751: shorter jobs $s_1,\ldots,s_m$ arrives, where each
752: shorter job $s_i$ also entirely fills its window and can only be executed 
753: when it arrives.  Shorter job $s_i$ overlaps $\ell_i$ and $\ell_{i+1}$; it
754: arrives one unit before the deadline of
755: job $\ell_i$. 
756: Jobs $s_i$ have length $B/4$ and jobs $\ell_i$ have length $\Delta\cdot B/4$.
757:  Thus, if all the jobs comprising the
758: $3$-partition problem can be executed, jobs $\ell_1,\ldots,\ell_m$
759: will be avoided by executing jobs $s_1,\ldots,s_m$.  Otherwise, jobs
760: $\ell_1,\ldots,\ell_m$ must be executed.  The index of $m$ can be adjusted
761: to any $\epsilon$.
762: \end{pf}
763: 
764: Bounds on both $\Delta$ and $R$ are sufficient to yield a
765: pseudo-polynomial algorithm:
766: 
767: \begin{thm}
768: Let $K = \max_i d_i$.
769: Given bounds on $R$ and $\Delta$,
770: the Lazy Bureaucrat Problem with no preemption
771: can be solved in $O(K\cdot n^{4 R\lg \Delta})$
772: for objective functions~(1)-(3).
773: \end{thm}
774: 
775: \begin{pf}
776: We modify the
777: dynamic programming algorithm of Theorem~\ref{fixed-window-DP}
778: for this more complex situation.
779: The set of jobs potentially available to work on in a given schedule
780: at time $\tau$ are the jobs $j$ that have not yet been executed, for which 
781: $d_j - t_j \geq \tau$.
782: Our state space will encode the {\em complement\/} of this set for each time 
783: $\tau$,
784: specifically, the set of jobs that were executed earlier but
785: could otherwise have been executed at time $\tau$.
786: 
787: The bounds on $R$ and $\Delta$ together imply an upper bound on 
788: the number of subsets of jobs active at time 
789: $\tau$ that could have been executed
790: prior to time $\tau$.
791: Let $d_{\min}$ be the length of the shortest job potentially 
792: active at time $\tau$.
793: We can partition all potentially active jobs into $\lg \Delta$ classes,
794: where the $j$th class consists of the jobs of size
795: greater than or equal to $2^{j-1} d_{\min}$
796: and less than  $2^j d_{\min}$.
797: The earliest possible arrival time of any class-$j$ job
798: is $\tau - 2^j d_{\min} R$, since each job has an $R$-bounded window.
799: Only $2^j d_{\min} R / 2^{j-1} d_{\min} = 2R$ jobs from class $j$
800: can be executed within this window.
801: Summing over all the classes implies that at most $2 R \lg \Delta$ jobs
802: potentially active at time $\tau$ could have been executed in a non-preemptive
803: schedule by time $\tau$.
804: As before the choice of weights on the edges
805: determines the metric that is optimized.
806: 
807: The time bound on the running time 
808: follows by observing that each of the $K n^{(2 R \lg \Delta)}$
809: states has outdegree at most $2 R \lg \Delta$.
810: \end{pf}
811: 
812: \subsubsection{Jobs Having a Common Release Time}
813: 
814: In the next version of the problem all jobs are released at time zero,
815: i.e., $a_i=0$ for all $i$.  This problem can be solved in
816: pseudo-polynomial time by dynamic programming, specifically, reducing
817: the problem to that of finding the shortest path in a directed acyclic
818: graph.  The dynamic programming works because of the following
819: structural result: There exists an optimal schedule that executes the
820: jobs Earliest Due Date (EDD).
821: 
822: In fact this problem is a special case of the following general
823: problem: Minimizing the weighted sum of jobs not completed by their
824: deadlines.  A similar problem was solved by~\cite{LawlerMoore69}, using the
825: same structural result.
826: 
827: 
828: \begin{thm}
829: The LBP can be solved in pseudo-polynomial time 
830: for all three metrics when all jobs have
831: a common release time.
832: Specifically, let $K = \max_i d_i$; then the running time is
833: $O(K\cdot n).$
834: \end{thm}
835: 
836: \section{LBP: Preemption}
837: \label{sec:preempt}
838: 
839: In this section we consider the Lazy Bureaucrat Problem in which 
840: jobs may be preempted: a job in progress can be set aside, while another
841: job is processed, and then possibly resumed later.  It is important to
842: distinguish among different constraints that specify which jobs
843: are available to be processed.  We consider three natural choices of such 
844: constraints:
845: 
846: \begin{description}
847: \item[Constraint I:] In order to work on job $i$ at time $\tau$, we
848: require only that the current time $\tau$ lies within the job's
849: interval $I_i$: $a_i\leq \tau\leq d_i$.
850: 
851: \item[Constraint II:] In order to work on job $i$ at time $\tau$, we
852: require not only that the current time $\tau$ lies within the job's
853: interval $I_i$, but also that the job has a {\em chance\/} to be
854: completed, e.g., if it is processed without interruption until
855: completion.
856: 
857: This condition is equivalent to requiring that $\tau\leq c'_i$, where
858: $c'_i=d_i-t_i+y_i$ is the {\em adjusted critical time\/} of job $i$:
859: $c'_i$ is the latest possible time to start job $i$, in order to meet
860: its deadline $d_i$, given that an amount $y_i$ of the job has already
861: been completed.
862: 
863: 
864: 
865: \item[Constraint III:] In order to work on job $i$, we require that
866: $\tau\in I_i$.  Further, we require that any job that is started
867: is eventually completed.
868: 
869: \end{description}
870: 
871: 
872: 
873: We divide this section into subsections,
874: where each subsection considers one of 
875: the three objective functions (1)--(3)
876: from Section~\ref{subsec-model}, in
877: which the goals are to minimize (1) the total time working (regardless of
878: which jobs are completed), (2) the weighted sum of completed jobs, or
879: (3) the makespan of the schedule (the ``go home'' time).
880: For each metric we see that the constraints on preemption
881: can dramatically affect the complexity of the problem.
882: 
883: Constraint III makes the LBP with preemption quite similar
884: to the LBP with no preemption. In fact, if all jobs arrive at the same
885: time ($a_i=0$ for all $i$), then the three objective functions are
886: equivalent, and the problem is hard:
887: 
888: \begin{thm}
889: \label{hard-pre-3}
890: The LBP with preemption, under constraint~III (one must complete any
891: job that is begun), is (weakly)
892: NP-complete and hard to approximate for all three objective
893: functions.
894: \end{thm}
895: 
896: \begin{pf}
897: We use the same reduction as the one given in the proof of
898: Theorem~\ref{thm:hard1}.  Note that any schedule for an instance given
899: by the reduction, in which all jobs processed must be completed
900: eventually, can be transformed into an equivalent schedule with no
901: preemptions. This makes the problem of finding an optimal schedule
902: with no preemption equivalent to the problem of finding an optimal
903: schedule in the preemptive case under constraint III.  
904: \end{pf}
905: 
906: Note that we
907: cannot use a proof similar to that of Theorem~\ref{thm:hard2} to show
908: that this problem is strongly NP-complete, since preemption can lead
909: to improved schedules in that instance.
910: 
911: \subsection{Minimizing Total Time Working}
912: 
913: \begin{thm}
914: \label{thm:preempt-I.1}
915: The LBP with preemption, under constraint~I (one can work on any job
916: in its interval) and objective~(1) (minimize total time
917: working), is polynomially solvable.
918: \end{thm}
919: 
920: \begin{pf}
921: The algorithm schedules jobs according to latest due date
922: (LDD), in which at all times the job in the system with the latest
923: deadline is being processed, with ties broken arbitrarily.  An
924: exchange argument shows that this is optimal.  Suppose there is an
925: optimal schedule that is not LDD. Consider the first time in which an
926: optimal schedule differs from LDD, and let OPT be an optimal schedule
927: in which this time is as late as possible. Let OPT be executing a
928: piece of job $i$, $p_i$ and LDD executes a piece of job $j$, $p_j$. We
929: know that $d_i<d_j$. We want to show that we can replace the first
930: unit of $p_i$ by one unit of $p_j$, contradicting the choice of OPT,
931: and thereby proving the claim. If in OPT, job $j$ is not completely
932: processed, then this swap is feasible, and we are done. On the other
933: hand, if all of $j$ is processed in OPT,  such a swap causes a unit of
934: job $j$ later on to be removed, leaving a gap of one unit. If this gap
935: cannot be filled by any other job piece, we get a schedule with less
936: work than OPT, which is a contradiction. Therefore assume the gap can
937: be filled, possibly causing a later unit gap. Continue this process,
938: and at its conclusion, either a unit gap remains contradicting the
939: optimality of OPT, or no gaps remain, contradicting the choice of OPT.
940: \end{pf}
941: 
942: 
943: 
944: \begin{thm}
945: The LBP with preemption, under constraint~II (one can only work on
946: jobs that can be completed) and objective~(1) (minimize total time
947: working), is (weakly) NP-complete.
948: \end{thm}
949: 
950: \begin{pf}
951: If all arrival times are the same, then this problem is equivalent to
952: the one in which the objective function is to minimize the makespan,
953: which is shown to be NP-complete in Theorem~\ref{thm:preempt-II.3}. 
954: \end{pf}
955: 
956: 
957: \subsection{Minimizing Weighted Sum of Completed Jobs}
958: 
959: \begin{thm}
960: The LBP with preemption, under constraint~I (one can work on any job
961: in its interval) and objective~(2) (minimize the weighted sum of
962: completed jobs), is polynomially solvable.
963: \end{thm}
964: 
965: \begin{pf}
966: Without loss of generality, assume that jobs $1,\ldots,n$ are
967: indexed in order of increasing deadlines. We show how to decompose the
968: jobs into separate components that can be treated independently.
969: Schedule the jobs according to EDD (if a job is executing and its
970: deadline passes, preempt and execute the next job).  Whenever there is
971: a gap (potentially of size zero), where no jobs are in the system, the
972: jobs are divided into separate components that can be scheduled
973: independently and their weights summed.  Now we focus on one such set
974: of jobs (having no gaps).  We modify the EDD schedule by preempting a
975: job $\epsilon$ units of time before it completes.  Then we move the
976: rest of the jobs of the schedule forward by $\epsilon$ time units and
977: continue to process.  At the end of the schedule, there are two
978: possibilities.  (1) the last job is interrupted because its deadline
979: passes; in this case we obtain a schedule in which no jobs are
980: completed; (2) the last job completes and in addition
981: all other jobs whose deadlines have not passed are also forced to
982: complete. 
983: 
984: The proof is completed by noting the following:
985: %
986: \begin{itemize}
987: \item There is an optimal schedule that completes all of its jobs at
988:   the end; and
989: \item The above schedule executes the maximum amount of work possible.
990:   (In other words, EDD (``minus $\epsilon$'') allows one to execute
991:   the maximum amount of work on jobs 1 through $i$ without completing
992:   any of them.)
993: \end{itemize}
994: \end{pf}
995: 
996: 
997: \begin{thm}
998: The LBP with preemption, under constraint~II (one can only work on
999: jobs that can be completed) and objective~(2) (minimize the weighted
1000: sum of completed jobs), is (weakly) NP-complete.
1001: \end{thm}
1002: 
1003: \begin{pf}
1004:   Consider the LBP under constraint~II, where the objective is to
1005:   minimize the makespan.  The proof of Theorem~\ref{thm:preempt-II.3}
1006:   will have hard instances where all jobs have the same arrival time,
1007:   and where the optimal solution completes any job that it begins.
1008:   Thus, for these instances the metric of minimizing the makespan is
1009:   equivalent to the metric of minimizing the weighted sum of completed
1010:   jobs, for weights proportional to the processing times.
1011: \end{pf}
1012: 
1013: 
1014: \subsection{Minimizing Makespan: Going Home Early}
1015: \label{sec:pmtn-makespan}
1016: 
1017: We assume now that the bureaucrat's goal is to go home as soon as
1018: possible.
1019: 
1020: We begin by noting that if the arrival times are all the same
1021: ($a_i=0$, for all $i$), then the objective (3) (go home as soon as
1022: possible) is in fact equivalent to the objective (1) (minimize total
1023: time working), since, under any of the three constraints I--III, the
1024: bureaucrat will be busy nonstop until he can go home.
1025: 
1026: Observe that if the {\em deadlines\/} are all the same
1027: ($d_i=D$, for all $i$), then the objectives (1) and (3) are quite
1028: different.  Consider the following example.  Job~1 arrives at time
1029: $a_1=0$ and is of length $t_1=2$, job~2 arrives at time $a_2=0$ and is
1030: of length $t_2=9$, job~3 arrives at time $a_3=8$ and is of length
1031: $t_3=2$, and all jobs have deadline $d_1=d_2=d_3=10$.  Then, in order
1032: to minimize total time working, the bureaucrat will do jobs 1 and 3, a
1033: total of 4 units of work, and will go home at time 10.  However, in
1034: order to go home as soon as possible, the bureaucrat will do job~2,
1035: performing 9 units of work, and go home at time 9 (since there is not
1036: enough time to do either job~1 or job~3).
1037: 
1038: \begin{thm}
1039: \label{thm:preempt-I.3}
1040: The LBP with preemption, under constraint~I (one can do any job in its
1041: interval) and objective~(3) (go home as early as possible), is
1042: polynomially solvable.
1043: \end{thm}
1044: 
1045: \begin{pf}
1046: The algorithm is to schedule by Latest Due Date (LDD). 
1047: The proof is similar to the one given in Theorem~\ref{thm:preempt-I.1}.
1048: \end{pf}
1049: 
1050: If instead of constraint~I we impose constraint~II, the problem becomes hard:
1051: 
1052: \begin{thm}
1053: \label{thm:preempt-II.3}
1054: The LBP with preemption, under constraint~II (one can only work on jobs that
1055: can be completed) and objective~(3) (go home as early as possible), is
1056: (weakly) NP-complete, even if all arrival times are the same.
1057: \end{thm}
1058: 
1059: \begin{pf}
1060:  We give a reduction from {\sc Subset Sum}.  Consider an
1061: instance of {\sc Subset Sum} given by a set $S$ of $n$ positive integers,
1062: $x_1$, $x_2,\ldots,x_n$, and target sum $T$.  We construct an instance
1063: of the required version of the LBP as
1064: follows.  For each integer $x_i$, we have a job $i$ that arrives at
1065: time $a_i=0$, has length $t_i=x_i$, and is due at time
1066: $d_i=T+x_i-\epsilon$, where $\epsilon$ is a small constant (it
1067: suffices to use $\epsilon={1\over 3n}$).  In addition, we have a
1068: ``long'' job $n+1$, with length $t_{n+1}>T$, that arrives at
1069: time $a_{n+1}=0$ and is due at time $d_{n+1}=T-2\epsilon+t_{n+1}$.
1070: We claim that it is possible for the bureaucrat to go home by time $T$
1071: if and only if there exists a subset of $\{x_1,\ldots,x_n\}$ that sums to
1072: exactly~$T$.
1073: 
1074: If there is a subset of $\{x_1,\ldots,x_n\}$ that sums to exactly~$T$,
1075: then the bureaucrat can perform the corresponding subset of jobs (of
1076: total length $T$) and go home at time $T$; he is able to avoid doing
1077: any of the other jobs, since their critical times fall at an earlier
1078: time ($T-\epsilon$ or $T-2\epsilon$), making it infeasible to begin
1079: them at time $T$, by our assumption.
1080: 
1081: If, on the other hand, the bureaucrat is able to go home at time $T$,
1082: then we know the following:
1083: 
1084: \begin{enumerate}
1085: \item {\em The bureaucrat must have just completed a job at time
1086:     $T$.\/}
1087:   
1088:   He cannot quit a job and go home in the middle of a job, since the
1089:   job must have been completable at the instant he started (or
1090:   restarted) working on it, and it remains completable at the moment
1091:   that he would like to quit and go home.
1092: 
1093: \item {\em The bureaucrat must have been busy the entire time from 0
1094:     until time $T$.\/}
1095:   
1096:   He is not allowed to be idle for any period of time, since he could
1097:   always have been working on some available job, e.g., job $J_{n+1}$.
1098:   
1099: \item {\em If the bureaucrat starts a job, then he must finish it.\/}
1100:   
1101:   First, we note that if he starts job $J_i$ and does at least
1102:   $\epsilon$ of it, then he must finish it, since at time $T$ less
1103:   than $x_i-\epsilon$ remains to be done of the job, and it is not due
1104:   until time $T-\epsilon+x_i$, making it feasible to return to the job
1105:   at time $T$ (so that he cannot go home at time $T$).
1106:   
1107:   Second, we must consider the possibility that he may perform very
1108:   small amounts (less than $\epsilon$) of some jobs without finishing
1109:   them.  However, in this case, the {\em total\/} amount that he
1110:   completes of these barely started jobs is at most $n\epsilon\leq
1111:   {1\over 3}$.  This is a contradiction, since his total work time
1112:   consists of this fractional length of time, plus the sum of the
1113:   integral lengths of the jobs that he completed, which cannot add up
1114:   to the integer $T$.  Thus, in order for him to go home at exactly
1115:   time $T$, he must have completed every job that he started.
1116:   
1117:   Finally, note that he cannot use job $J_{n+1}$ as ``filler'', and do
1118:   part of it before going home at time $T$, since, if he starts it and
1119:   works at least time $2\epsilon$ on it, then, by the same reasoning
1120:   as above, he will be forced to stay and complete it.  Thus, he will
1121:   not start it at all, since he cannot complete it before time $T$
1122:   (recall that $t_{n+1}>T$).
1123: 
1124: \end{enumerate}
1125: %
1126: We conclude that the bureaucrat must complete a set of jobs whose lengths
1127: sum exactly to~$T$.
1128: 
1129: Thus, we have reduced {\sc Subset Sum} to our problem, showing that it is
1130: (weakly) NP-complete.
1131: 
1132: Note that the LBP we have constructed has non integer data. However,
1133: we can ``stretch'' time to get an equivalent problem in which all the
1134: data is integral. Letting $\epsilon = \frac{1}{3n}$, we multiply all job
1135: lengths and due dates by~$3n$.
1136: 
1137: \end{pf}
1138: 
1139: \begin{figure}[htbp]
1140: \begin{center}
1141: \input{fig2.pstex_t}
1142: \end{center}
1143: \caption{
1144:   Proof of hardness of LBP with preemption, assuming that all arrival
1145:   times are at time 0.}
1146: \label{fig:preempt-hard}
1147: \end{figure}
1148: 
1149: \noindent {\em Remark.}\quad 
1150: Hepner and Stein~\cite{HepnerStein2002} recently published a
1151: pseudo-polynomial-time algorithm for this problem, thus resolving an
1152: open problem from an earlier version of this
1153: paper~\cite{ArkinBenderMitchellSkiena99}.  
1154: \medskip
1155: 
1156: We come now to one of the main results of the paper.  We emphasize
1157: this result because it uses a rather sophisticated algorithm and
1158: analysis in order to show that, in contrast with the case of identical
1159: arrival times, the LBP with identical deadlines is polynomially
1160: solvable.  Specifically, the problems addressed in
1161: Theorems~\ref{thm:preempt-II.3}~and~\ref{thm:preempt-II.3-same-dead}
1162: are identical except that the flow of time is reversed.  Thus, we
1163: demonstrate that in contrast to most classical scheduling problems, in
1164: the LBP, when time flows in one direction, the problem is NP-hard,
1165: whereas when the flow of time is reversed, the problem is
1166: polynomial-time solvable.
1167: 
1168: The remainder of this section is devoted to proving the following
1169: theorem:
1170: 
1171: \begin{thm}
1172: \label{thm:preempt-II.3-same-dead}
1173: The LBP with preemption, under constraint~II (one can only work on
1174: jobs that can be completed) and objective~(3) (go home as early as
1175: possible), is solvable in polynomial time if all jobs have the same
1176: deadlines ($d_i=D$, for all $i$).  
1177: \end{thm}
1178: 
1179: We begin with a definition a ``forced gap:'' There is a {\em forced
1180:   gap\/} starting at time $\tau$ if $\tau$ is the earliest time such
1181: that the total work arriving by time $\tau$ is less than $\tau$.  This
1182: (first) forced gap ends at the arrival time, $\tau'$, of the next job.
1183: Subsequently, there may be more forced gaps, each determined by
1184: considering the scheduling problem that starts at the end, $\tau'$, of
1185: the previous forced gap.  We note that a forced gap can have length
1186: zero.
1187: 
1188: Under the ``go home early'' objective, we can assume, without loss of
1189: generality, that there are no forced gaps, since our problem really
1190: begins only at the time $\tau'$ that the {\em last\/} forced gap ends.
1191: (The bureaucrat is certainly not allowed to go home before the end
1192: $\tau'$ of the last forced gap, since more jobs arrive after $\tau'$
1193: that can be processed before their deadlines.)  While an optimal
1194: schedule may contain gaps that are not forced, the next lemma implies
1195: that there exists an optimal schedule having no unforced gaps.
1196: 
1197: \begin{lem}
1198:   Consider the LBP of Theorem~\ref{thm:preempt-II.3-same-dead}, and
1199:   assume that there are no forced gaps.  If there is a schedule having
1200:   makespan $T$, then there is a schedule with no gaps, also having
1201:   makespan~$T$.
1202: \end{lem}
1203: 
1204: \begin{pf}
1205:   Consider the first gap in the schedule, which begins at time $g$.
1206:   Because the gap is not forced, there is some job $j$ that is not
1207:   completed, and whose critical time is at time $g'\leq g$.  This is
1208:   because there must be a job that arrived before $g$ that is not
1209:   completed in the schedule, and at time $g$ it is no longer feasible
1210:   to complete it, and therefore its critical time is before $g$.  The
1211:   interval of time between $g'$ and $T$ may consist of (1) gaps, (2)
1212:   work on completed jobs, and (3) work on jobs that are never
1213:   completed. Consider a revised schedule in which, after time $g'$,
1214:   jobs of type~3 are removed, and jobs of type~2 are deferred to the
1215:   end of the schedule. (Since a job of type~2 is completed and all
1216:   jobs have the same deadline, we know that it is possible to move it
1217:   later in the schedule without passing its critical time.  It may not
1218:   be possible to move a (piece of a) job of type~3 later in the
1219:   schedule, since its critical time may have passed.)  In the revised
1220:   schedule, extend job~$j$ to fill the empty space. Note that there is
1221:   enough work in job $j$ to fill the space, since a critical time of
1222:   $g'$ means that the job must be executed continuously until deadline
1223:   $D$ in order to complete it.
1224: \end{pf}
1225: 
1226: \begin{lem} 
1227:   Consider an LBP of Theorem~\ref{thm:preempt-II.3-same-dead} in which
1228:   there are no forced gaps.  Any feasible schedule can be rearranged
1229:   so that all completed jobs are ordered by their arrival times and
1230:   all incomplete jobs are ordered by their arrival times.
1231: \end{lem}
1232: 
1233: \begin{pf}
1234:   The proof uses a simple exchange argument as in the standard proof
1235:   of optimality for the EDD (Earliest Due Date) policy in traditional
1236:   scheduling problems.
1237: \end{pf}
1238: 
1239: Our algorithm checks if there exists a schedule having no gaps that
1240: completes exactly at time $T$. Assume that the jobs $1,\ldots,n$ are
1241: labeled so that $a_1\leq a_2\cdots\leq a_n$.  The main steps of the
1242: algorithm are as follows:
1243: 
1244: \subsection*{The Algorithm:}
1245: 
1246: \begin{enumerate}
1247:   
1248: \item Determine the forced gaps.  This allows us to reduce to a
1249:   problem having no forced gaps, which starts at the end of the last
1250:   forced gap.
1251:   
1252:   The forced gaps are readily determined by computing the partial
1253:   sums, $\tau_j=\sum_{i=1}^j t_i$, for $j=0,1,\ldots,n$, and comparing
1254:   them to the arrival times.  (We define $\tau_0=0$.) The first forced
1255:   gap, then, begins at the time $\tau=\tau_{j^*}=\min\{\tau_j: \tau_j
1256:   < a_{j+1}\}$ and ends at time $a_{j^*+1}$.  ($\tau=0$ if $a_1>0$;
1257:   $\tau=\infty$ if there are no forced gaps.)  Subsequent forced gaps,
1258:   if any, are computed similarly, just by re-zeroing time at~$\tau'$,
1259:   and proceeding as with the first forced gap.
1260:   
1261: \item Let $x=D-T$ be the length of time between the common deadline
1262:   $D$ and our target makespan $T$.  A job $i$ for which $t_i\leq x$ is
1263:   called {\em short\/}; jobs for which $t_i> x$ are called {\em
1264:     long\/}.
1265:   
1266:   If it is {\em not\/} possible to schedule the set of short jobs so
1267:   that each is completed and they are all done by time $T$, then our
1268:   algorithm stops and returns ``NO,'' concluding that going home by
1269:   time $T$ is impossible.  Otherwise, we continue with the next step
1270:   of the algorithm.
1271:   
1272:   The rationale for this step is the observation that any job of
1273:   length at most $x$ must be completed in any schedule that permits
1274:   the bureaucrat to go home by time $T$, since its critical time
1275:   occurs at or after time~$T$.
1276:   
1277: \item Create a schedule ${\mathcal S}$ of all of the jobs, ordered by
1278:   their arrival times, in which the amount of time spent on job $i$ is
1279:   $t_i$ if the job is short (so it is done completely) and is $t_i-x$
1280:   if the job is long.
1281:   
1282:   For a long job $i$, $t_i-x$ is the maximum amount of time that can
1283:   be spent on this job without committing the bureaucrat to completing
1284:   the job, i.e., without causing the adjusted critical time of the job
1285:   to occur after time~$T$.
1286:   
1287:   If this schedule ${\mathcal S}$ has no gaps and ends at a time after
1288:   $T$, then our algorithm stops and returns ``YES.'' A feasible
1289:   schedule that allows the bureaucrat to go home by time $T$ is
1290:   readily constructed by ``squishing'' the schedule that we just
1291:   constructed: We reduce the amount of time spent on the long jobs,
1292:   starting with the latest long jobs and working backwards in time,
1293:   until the completion time of the last short job exactly equals~$T$.
1294:   This schedule completes all short jobs (as it should), and does
1295:   partial work on long jobs, leaving all of them with adjusted
1296:   critical times that fall {\em before\/} time $T$ (and are therefore
1297:   not possible to resume at time $T$, so they can be avoided).
1298:   
1299: \item If the above schedule ${\mathcal S}$ has gaps or ends before
1300:   time $T$, then ${\mathcal S}$ is not a feasible schedule for the
1301:   lazy bureaucrat, so we must continue the algorithm.
1302:   
1303:   Our objective is to decide {\em which\/} long jobs to complete, that
1304:   is, is there a set of long jobs to complete that will make it
1305:   possible to go home by time~$T$.  This problem is solved using the
1306:   dynamic programming algorithm {\em Schedule-by-$T$\/}, which is
1307:   described in detail below.
1308: \end{enumerate}
1309: 
1310: \subsection*{Procedure Schedule-by-{$T$}:}
1311: 
1312: Let $G_i$ be the sum of the gap lengths that occur before time $a_i$
1313: in schedule ${\mathcal S}$. Then, we know that in order to construct a
1314: gapless schedule, at least $\lceil G_i/x\rceil$ long jobs (in addition
1315: to the short jobs) from $1,\ldots,i-1$ must be completed. For each $i$
1316: we have such a constraint; collectively, we call these the {\em gap
1317:   constraints\/}.
1318: 
1319: \begin{claim}
1320:   If for each gap in schedule ${\mathcal S}$, there are enough long
1321:   jobs to be completed in order to fill the gap, then a feasible
1322:   schedule ending at $T$ exists.
1323: \end{claim}
1324: 
1325: We devise a dynamic programming algorithm as follows.  Let $T(m,k)$ be
1326: the earliest completion time of a schedule that satisfies the
1327: following:
1328: %
1329: \begin{enumerate}
1330: \item
1331: It completes by time $T$;
1332: 
1333: \item
1334: It uses jobs from the set $\{1,\ldots,k\}$;
1335: 
1336: \item
1337: It completes exactly $m$ jobs and does no other work (so it
1338: may have gaps, making it an infeasible schedule);
1339: 
1340: \item
1341: It satisfies the gap constraints; and
1342: 
1343: \item
1344: It completes all short jobs (of size $\leq x$).
1345: 
1346: \end{enumerate}
1347: %
1348: The boundary conditions on $T(m,k)$ are given by:
1349: %
1350: \begin{description}
1351: 
1352: \item[] $T(0,0)=0$; 
1353: 
1354: \item[] $T(0,n)=\infty$, which implies that at least one of the jobs
1355: must be completed;
1356: 
1357: \item[] $T(m,0)=\infty$ for $m>0$;
1358: 
1359: \item[] $T(m,k)=\infty$ if there exist constraints such that at least
1360: $m+1$ jobs from $1,\ldots,k$ must be completed, some of the jobs from
1361: $1,\ldots,k$ must be completed because they are short, and some
1362: additional jobs may need to be completed because of the gap
1363: constraints.  Note that this implies that $T(0,k)$ is equal to zero or
1364: infinity, depending on whether gap constraints are disobeyed.
1365: 
1366: \end{description}
1367: 
1368: In general, $T(m,k)$ is given by selecting the better of two options:
1369: %
1370: $$T(m,k)=\min\{\alpha ,\beta\},$$
1371: %
1372: where $\alpha$ is the earliest completion time if we choose not to
1373: execute job $k$ (which is a legal option only if job $k$ is long),
1374: giving
1375: %
1376: $$\alpha= \cases{T(m,k-1) & if  $t_k>x$ \cr
1377: \infty & otherwise,}$$
1378: %
1379: and $\beta$ is the earliest completion time if we choose to execute
1380: job $k$ (which is a legal option only if the resulting completion time
1381: is by time $T$), giving
1382: %
1383: $$\beta= \cases{\max (a_k+t_k,T(m-1,k-1)+t_k) & if this quantity is $\leq T$  \cr
1384: \infty & otherwise.}$$
1385: 
1386: \begin{lem}
1387:   There exists a feasible schedule completing at time $T$ if and only
1388:   if there exists an $m$ for which $T(m,n)<\infty$.
1389: \end{lem}
1390: 
1391: \begin{pf}
1392:   If $T(m,n)=\infty$ for all $m$, then, since the gap constraints
1393:   apply to any feasible schedule, and it is not possible to find such
1394:   a schedule for any number of jobs $m$, there is no feasible schedule
1395:   that completes on or before~$T$.
1396:   
1397:   If there exists an $m$ for which $T(m,n)<\infty$, let $m^*$ be the
1398:   smallest such $m$.  Then, by definition, $T(m^*,n)\leq T$. We show
1399:   that the schedule ${\mathcal S^*}$ obtained by the dynamic program
1400:   can be made into a feasible schedule ending at $T$. Consider jobs
1401:   that are not completed in the schedule ${\mathcal S}^*$; we wish to
1402:   use some of them to ``fill in'' the schedule to make it feasible, as
1403:   follows.
1404:   
1405:   Ordered by arrival times of incomplete jobs, and doing up to $t_i-x$
1406:   of each incomplete job, fill in the gaps. Note that by the gap
1407:   constraints, there is enough work to fill in all gaps. There are two
1408:   things that may make this schedule infeasible: (i) Some jobs are
1409:   worked on beyond their critical times, and (ii) the last job to be
1410:   done must be a completed one.
1411:   
1412:   (i). {\em Fixing the critical time problem:}\quad Consider a job $i$
1413:   that is processed at some time, beginning at $\tau$, after its
1414:   critical time, $c_i$.  We move all completed job pieces that fall
1415:   between $c_i$ and $T$ to the end of the schedule, lining them up to
1416:   end at $T$; then, we do job $i$ from time $c_i$ up until this batch
1417:   of completed jobs. This is legal because all completed jobs can be
1418:   pushed to the end of the schedule, and job $i$ cannot complete once
1419:   it stops processing.
1420:   
1421:   (ii). {\em Fixing the last job to be a complete one:}\quad Move a
1422:   ``sliver'' of the last completed job to just before time $T$. If
1423:   this is not possible (because the job would have to be done before
1424:   it arrives), then it means that we {\em must\/} complete one
1425:   additional job, so we consider $m^*+1$, and repeat the process.
1426:   
1427:   Note that a technical difficulty arises in the case in which the sum
1428:   of the gap lengths is an exact multiple of $x$: Do we have to
1429:   complete an additional job or not? This depends on whether we can
1430:   put a sliver of a completed job at $T$. There are several ways to
1431:   deal with this issue, including conditioning on the last completed
1432:   job, modifying the gap constraint, or ignoring the problem and
1433:   fixing it if it occurs (that is if we cannot put a sliver, then add
1434:   another job which must be completed to the gap constraint).
1435: \end{pf}
1436: 
1437: This completes the proof of our main theorem,
1438: Theorem~\ref{thm:preempt-II.3-same-dead}.
1439: 
1440: 
1441: \noindent {\em Remark.}\quad Even if all arrival times are the same,
1442: and deadlines are the same, and data is integer, an optimal solution
1443: may not be integer. In fact, there may not be an optimal solution,
1444: only a limiting one, as the following example shows: Let $a_i=0$ and
1445: $d_i=100$, for all $i$.  Jobs $1,\ldots,n-1$ have length 51, while job
1446: $n$ has length $t_{n}=48$.  A feasible schedule executes $\epsilon$ of
1447: each of the first $n-1 $ jobs, where $\epsilon >1/(n-2)$, and all of
1448: job~$n$, so the total work done is $(n -1) \epsilon
1449: +48>(n-1)/(n-2)+48$. Note that each of the first $n-1$ jobs have
1450: $51-\epsilon$ remaining to do, while there is only time
1451: $52-(n-1)\epsilon$ left before the deadline.  Now, by making
1452: $\epsilon$ arbitrarily close to $1/(n-2)$, we can make the schedule
1453: better and better.
1454: 
1455: 
1456: \section*{Acknowledgements}
1457: 
1458: We thank the referees for constructive comments and suggestions
1459: that improved the presentation of the paper.
1460: 
1461: \begin{thebibliography}{00}
1462: 
1463: \bibitem{ArkinBenderMitchellSkiena99}
1464: E.~M. Arkin, M.~A. Bender, J.~S.~B. Mitchell, and S.~S. Skiena.
1465: \newblock The Lazy Bureaucrat Scheduling Problem.
1466: \newblock {\em Proc.~6th Workshop on Discrete Algorithms (WADS)},
1467:   pages 80--85, 1999.
1468: 
1469: \bibitem{BGNS-99}
1470: A.~Bar-Noy, S.~Guha, J.~Naor, and B.~Schieber.
1471: \newblock Approximating the throughput of real-time multiple machine
1472:   scheduling.
1473: \newblock In {\em Proc.~31st ACM Symp. Theory of Computing (STOC)}, 
1474: pages 622--631, 1999.
1475: 
1476: \bibitem{BarvinokJWW1998}
1477: A.~ I.~Barvinok, D.~S.~Johnson, G.~J.~Woeginger, and R.~Woodroofe.
1478: \newblock The maximum traveling salesman problem under
1479: polyhedral norms. 
1480: \newblock In
1481: {\em Proc.~6th Conference on
1482: Integer Programming and Combinatorial Optimization (IPCO)\/},
1483: {\em Lecture Notes in Computer Science}, vol.~1412, 
1484: pages 195--201, 1998.
1485: 
1486: \bibitem{Fekete1999}
1487: S.~P.~Fekete.
1488: \newblock Simplicity and hardness of the maximum traveling 
1489: salesman problem under geometric distances. 
1490: \newblock {\em Proc.~10th {ACM-SIAM} 
1491: Symposium on Discrete Algorithms (SODA)}, pages
1492: 337--345, 1999.
1493: 
1494: \bibitem{GJ-79}
1495: M.~R. Garey and D.~S. Johnson.
1496: \newblock {\em Computers and Intractability: A Guide to the Theory of
1497:   {NP}-Completeness}.
1498: \newblock W. H. Freeman, San Francisco, 1979.
1499: 
1500: \bibitem{GoemansWilliamson1995}
1501: M.~X.~Goemans and D.~P.~Williamson.
1502: \newblock Improved approximation algorithms for maximum
1503: cut and satisfiability problems using semidefinite programming.
1504: \newblock {\em J. ACM}, 42:1115--1145, 1995.
1505: 
1506: \bibitem{HassinRubinstein1998}
1507: R.~Hassin and S.~Rubinstein. 
1508: \newblock An approximation algorithm for the maximum
1509: traveling salesman problem. 
1510: \newblock {\em Information Processing Letters}, 67(3):125-130, 1998.
1511: 
1512: \bibitem{HepnerStein2002}
1513: C.~Hepner and C.~Stein.
1514: \newblock Minimizing makespan for the lazy bureaucrat problem.
1515: \newblock In  {\em Proc.~8th
1516: Scandinavian Workshop on Algorithm Theory (SWAT)},
1517: pages 40--50, 2002.
1518: 
1519: \bibitem{KargerMotwaniRamkumar1997}
1520: D. Karger, R. Motwani, and G. Ramkumar. 
1521: \newblock On approximating the longest path in a graph. 
1522: \newblock {\em Algorithmica}, 18(1):82-98, 1997.
1523: 
1524: \bibitem{KargerSteinWein:1997}
1525: D.~Karger, C.~Stein, and J.~Wein.
1526: \newblock Scheduling algorithms.
1527: \newblock 
1528: In {\em Algorithms and Theory of Computation Handbook}, 
1529: CRC Press, 1999.
1530: 
1531: \bibitem{Keneally-82}
1532: T.~Keneally.
1533: \newblock {\em Schindler's List}.
1534: \newblock Touchstone Publishers, New York, 1993.
1535: 
1536: \bibitem{KosarajuParkStein1994}
1537: S.~R.~Kosaraju, J.~ K.~Park, and C.~Stein. 
1538: \newblock Long tours and short superstrings (preliminary version). 
1539: \newblock In {\em Proc.~35th Annual Symposium on Foundations of
1540: Computer Science (FOCS)}, pages 166--177, 1994. 
1541: 
1542: \bibitem{LLKS-93}
1543: E.~L.~Lawler, J.~K. Lenstra, A.~H.~G. Rinnooy Kan, and D.~B.~Shmoys.
1544: \newblock Sequencing and scheduling: Algorithms and complexity.
1545: \newblock S.C. Graves, P.H. Zipkin, and A.H.G. Rinnooy Kan (eds.) 
1546: \newblock In {\em Logistics of
1547:  Production and Inventory: Handbooks in Operations Research and Management Science},
1548:   volume~4, pages 445--522.  North-Holland, Amsterdam, 445-522, 1993.
1549: 
1550: \bibitem{LawlerMoore69}
1551: E.~L. Lawler and J.~M. Moore.
1552: \newblock A functional equation and its application to resource allocation and
1553:   sequencing problems.
1554: \newblock {\em Management Science}, 16:77--84, 1969.
1555: 
1556: \bibitem{Pinedo-95}
1557: M.~Pinedo.
1558: \newblock {\em Scheduling: {Theory}, Algorithms, and Systems}.
1559: \newblock Prentice Hall, 1995.
1560: 
1561: \end{thebibliography}
1562: 
1563: \end{document}
1564: 
1565: