**8. Construction of Compact Preschedules for Problem** 1|*pj* : *divisible*,*rj*|*L*max

This section starts Part 2, in which our basic task is to develop an auxiliary algorithm that deals with an IA(b2) occurred at Phase 1 (recall that if no IA(b2) occurs, PROCEDURE MAIN with PROCEDURE AUGMENTED(*K*, *δ*) using Phase 1 already solves problem 1|*rj*|*L*max). A compact feasible schedule, one without any redundant gap, has properties that are helpful for the establishment of the existence or the non-existence of a complete *L*-schedule whenever during the construction of a kernel preschedule at Phase 1 an instance of Alternative (b2) arises. In this section, we study the compactness properties for instances of problem 1|*pj* : *divisible*,*rj*|*L*max.

Since the basic construction components of a complete feasible schedule are the secondary blocks, it suffices to deal with compact secondary blocks. A secondary block B is *compact* if there is no feasible *L*-schedule containing all the jobs of that block with the total length of all the gaps in it no-less than that in block B.

We can keep the secondary blocks compact if the processing times of some non-kernel jobs are mutually divisible. For the commodity and without loss of generality, we assume that the processing times of the non-kernel jobs are powers of 2 (precisely, we identify the specific non-kernel jobs for which mutual divisibility is required on the fly). Below, we give a basic property of a set of divisible numbers and then we give another useful property of a kernel preschedule with divisible job processing times, which are used afterwards.

**Lemma 6.** *For a given job x, let J*−(*x*) *be the set of jobs J*−(*x*) = {*i*|*pi* < *px*} *such that p*(*J*−(*x*)) > *px and the processing times of jobs in set J*−(*x*) ∪ {*x*} *are mutually divisible. Then, there exists a proper subset J of set J*−(*x*) *with p*(*J* ) = *px (that can be found in an almost liner time).*

**Proof.** The following simple procedure finds subset *J* . Sort the jobs in set *J*−(*x*) in non-increasing order of their processing times, say {*x*1, ... , *xk*}. It is straightforward to see that, because of the divisibility of the processing times of the jobs in set *J*−(*x*) ∪ {*x*}, there exists integer *l* < *k* such that ∑*l <sup>ι</sup>*=<sup>1</sup> *x<sup>ι</sup>* = *px*, i.e., *J* = {*x*1,..., *xk*}.

**Lemma 7.** *Preschedule PreS*(*K*, *y*, *x*)*, constructed at Pass 2 of Phase 1 for an instance of* 1|*pj* : *divisible*,*rj*|*L*max*, contains no gap except one that may possibly arise immediately before time moment ψL*(*K*)*.*

**Proof.** By the way of contradiction, suppose *I* is an internal gap in schedule *PreS*(*K*, *y*) of Pass 1. Note that initially, gap *I* was completely occupied in bin *B*−(*K*) in schedule *σ*, and that it is succeeded by at least one y-job in preschedule *PreS*(*K*, *y*). That is, the x-jobs with the total length of at least |*I*| should have been available while scheduling the interval of gap *I* in PROCEDURE DEF at Pass 2. Then, an idle time interval within the interval of gap *I* in preschedule *PreS*(*K*, *y*, *x*) of Pass 2 may potentially occur only at the end of that interval, say at time moment *τ*, due to the non-permitted interference in schedule *PreS*(*K*, *y*, +*x*) of an available (and not yet discarded) x-job with a succeeding y-job, say *y* (Step (B)). Note that job *y* is a Type (a) y-job (if it were of Type (b), then it would have been included ahead any x-job in bin *B*−(*K*)) and that the lateness of that job did not exceed *L* before kernel *K* was detected in schedule Σ(C(*δ*, *K*)). Let *X* be the set of the x-jobs preceding job *y* in the interval of gap *I* in the latter schedule, and *X* be the corresponding set of the x-jobs in preschedule *PreS*(*K*, *y*, *x*) (by our construction, *P*(*X*) > *P*(*X* )). In PROCEDURE DEF, during the construction of schedule *PreS*(*K*, *y*, *x*), at time moment *τ* there must have been no job with processing time *p*(*X*) − *p*(*X* ) or less available. However, this is not possible since, because of the divisibility of job processing times, set *X* must contain such a job (and that job must have been available and yet unscheduled). The existence of a gap from time moment *τ* in the interval of gap *I* in schedule *PreS*(*K*, *y*, *x*) has led to a contradiction and hence it cannot exist.

In the rest of this section, we assume that preschedule *PreS*(*K*) contains a gap; i.e., it ends with a gap (Lemma 7). Our objective is to verify if that gap can be reduced. To this end, we define two kinds of jobs such that their interchange may possibly be beneficial.

The first type of jobs are formed from set *EP*(*K*, *L*), the set of the passive emerging jobs for kernel *K* in the current configuration with threshold *L* = *Lδ*. Recall that a job from set *EP*(*K*, *L*) is included after kernel *<sup>K</sup>* in schedule <sup>Σ</sup>C(*δ*,*K*) but it may feasibly be included (as an x-job) in a preschedule of kernel *K* (in bin *B*−(*K*)).

Recall at the same time, that a job from preschedule *PreS*(*K*) which may be rescheduled after all jobs of kernel *K* without surpassing the *L*-boundary is one from set *E*(*K*, *L*), the set of emerging jobs for kernel *K* at the current configuration (such a job was included as an x-job in preschedule *PreS*(*K*)).

A vulnerable component of a secondary block is a preschedule in it, in the sense that we can maintain a secondary block compact if every *preschedule* that it contains is also *compact*, i.e., there exists no other preschedule (for the same kernel) with the total length of the gaps less than that in the former preschedule (see Corollary 4 at the end of this section). A key informal observation here is that, if a preschedule for kernel *K* is not compact, then a compact one can only be obtained from the former preschedule by replacing some jobs from set *E*(*K*, *L*) with some jobs from set *EP*(*K*, *L*), whereas nothing is to be gained by substituting any jobs from a compact preschedule by any jobs from set *EP*(*K*, *L*) (Proposition 14 below).

Let *A* ⊆ *E*(*K*, *L*) and *B* ⊆ *EP*(*K*, *L*). Consider *A* and *B* as potential "swap" subsets and denote by *PreS*(*K*, −*A*, +*B*) the preschedule for kernel *K* obtained by interchanging the roles of jobs from sets *A* and *B* while reconstructing the current preschedule *PreS*(*K*) by the procedure of Phase 1. Technically, preschedule *PreS*(*K*, −*A*, +*B*) can be constructed at Phase 1 for the restricted problem instance PI(*PreS*(*K*), −*A*, +*B*) that contains all jobs from preschedule *PreS*(*K*) and set *B* but does not contain ones in set *A* (so jobs from set *A* are activated for kernel *K*). Note that a job from set *A* belongs to *PreS*(*K*, −*A*, +*B*), and, along with the remaining jobs from preschedule *PreS*(*K*), some job(s) from set *B* may also be included in *PreS*(*K*, −*A*, +*B*).

**Proposition 14.** *If an L-preschedule PreS*(*K*) *is not compact then there exist sets A and B such that an L-preschedule PreS*(*K*, −*A*, +*B*) *is compact.*

**Proof.** Among the jobs included in schedule <sup>Σ</sup>C(*δ*,*K*) after preschedule *PreS*(*K*), the available room (the gap) from preschedule *PreS*(*K*) may only potentially be used by job(s) from set *EP*(*K*, *L*). By the construction of Phase 1, this will not be possible unless some emerging job(s) from preschedule *PreS*(*K*) is (are) rescheduled after kernel *K*. Then, this kind of the interchange of the jobs from set *E*(*K*, *L*) with the jobs from set *EP*(*K*, *L*) yields the only potentially improving rearrangement of the jobs in preschedule *PreS*(*K*), and the proposition follows.

Let us say that set *A covers* set *B* if preschedule *PreS*(*K*, −*A*, +*B*) includes all jobs from problem instance PI(*PreS*(*K*), −*A*, +*B*). Since we wish to reduce the total gap length in preschedule *PreS*(*K*), *p*(*A*) < *p*(*B*) must hold, which is our assumption from now on (we use *p*(*A*) for the total processing time in job-set *A*; below, we use *pmin*{*A*} for the minimum job processing time in *A*).

Let *<sup>γ</sup>*(*K*) the total gap length in preschedule *PreS*(*K*) ∈ <sup>Σ</sup>C(*δ*,*K*). We call

$$ST(K) = \gamma(K) + \beta\_L(K^\*)\tag{13}$$

the *store* of kernel *K* in the current configuration C(*δ*, *K*). It is easily seen that *ST*(*K*) is the maximum available vacant room in preschedule *PreS*(*K*) ∈ <sup>Σ</sup>C(*δ*,*K*):

**Proposition 15.** *The total length of the jobs (the gaps, respectively) in preschedule PreS*(*K*) ∈ <sup>Σ</sup>C(*δ*,*K*) *might be increased (decreased, respectively) by at most ST*(*K*) *time units in any L-preschedule for kernel K. If set A covers set B, then the store of kernel K in an updated configuration with preschedule PreS*(*K*, −*A*, +*B*) *is*

$$ST(K) - (P(B) - P(A)).$$

**Lemma 8.** *If ST*(*K*) < *pmin*{*E*(*K*, *L*)}*, then preschedule PreS*(*K*) *is compact. If preschedule PreS*(*K*) *is not compact, then ST*(*K*) ≥ *pmin*{*A*}*, for any A* ⊆ *E*(*K*, *L*)*.*

**Proof.** By the condition in lemma, the gap in preschedule *PreS*(*K*) (see Lemma 7) can potentially be occupied only by a job *j* with *pj* ≤ *pmin*{*E*(*K*, *L*)}/2 (see Proposition 15). There may exist no such job in set *EP*(*K*, *L*) as otherwise it would have been included in preschedule *PreS*(*K*) as an x-job at Pass 2. Now, it can be straightforwardly seen that no interchange of jobs in set *E*(*K*, *L*) from preschedule *PreS*(*K*) with jobs from set *EP*(*K*, *L*) may reduce the gap, because of the divisibility of the processing times of the jobs in sets *E*(*K*, *L*) and *EP*(*K*, *L*), and the first claim in lemma follows from Proposition 14.

Now, we show the second claim. Suppose preschedule *PreS*(*K*) is not compact. Then, there exist sets *A* and *B* such that *A* covers *B* and preschedule *PreS*(*K*, −*A*, +*B*) results in the reduction of the store of kernel *K* by *p*(*B*) − *p*(*A*) (see Equation (13) and Propositions 14 and 15). Because of the divisibility of job processing times in sets *A* and *B*, *p*(*B*) − *p*(*A*) is a multiple of *pmin*{*A* ∪ *B*}. Hence, if *ST*(*K*) < *pmin*{*A* ∪ *B*}, then preschedule *PreS*(*K*) is compact; *ST*(*K*) ≥ *pmin*{*A* ∪ *B*} must hold if *PreS*(*K*) is not compact. *ST*(*K*) ≥ *pmin*{*B*} is not possible, as otherwise a job from set *B* with processing time *pmin*{*B*} would have been included in preschedule *PreS*(*K*) at Pass 2 of Phase 1. It follows that *ST*(*K*) ≥ *pmin*{*A*}.

Due to Lemma 8, from here on, assume that *ST*(*K*) ≥ *pmin*{*A*}. It is not difficult to see that not all *ST*(*K*) time units may potentially be useful. In particular, let *ν* ≥ 1 be the maximum integer such that *ST*(*K*) ≥ *νpmin*{*A*}, and let *p* = *νpmin*{*A*}.

**Lemma 9.** *A feasible L-preschedule PreS*(*K*, −*A*, +*B*) *contains gap(s) with the total length of at least ST*(*K*) − *p ; hence, <sup>p</sup>*(*B*) <sup>≤</sup> *<sup>p</sup>*(*A*) + *<sup>p</sup> when set <sup>A</sup> covers set B. Furthermore, pmin*(*EP*(*K*, *<sup>L</sup>*)) = <sup>2</sup>*<sup>κ</sup> pmin*{*A*}*, for some integer <sup>κ</sup>* <sup>≥</sup> <sup>1</sup>*, and p* <sup>≤</sup> <sup>2</sup>*<sup>κ</sup> pmin*{*A*}*.*

**Proof.** The first claim easily follows from the definitions and the mutual divisibility of the processing times of jobs in sets *A* and *B*, and inequality *p*(*B*) ≤ *p*(*A*) + *p* immediately follows. As to the second claim, first we note that, for any *π* ∈ *EP*(*K*, *L*), *p<sup>π</sup>* > *ST*(*K*), as otherwise job *π* would have been included in preschedule *PreS*(*K*) at Pass 2 of Phase 1. Then, *pmin*(*EP*(*K*, *L*)) > *p* , whereas *p* ≥ *pmin*{*A*}. Hence, *pmin*(*EP*(*K*, *L*)) > *pmin*{*A*}. Now, the second claim follows from the fact that the processing times of jobs in sets *EP*(*K*, *L*) and *A* are powers of 2.

**Example 3.** *Suppose pmin*{*A*} = 4 *and ST*(*K*) = 23*. Then, p* = 5*pmin*{*A*} = 20*, hence a gap of length 3 is unavoidable. Let pmin*(*EP*(*K*, *<sup>L</sup>*)) = 23 *pmin*{*A*} <sup>=</sup> <sup>32</sup>*. Since the shortest job that set <sup>B</sup> may contain has processing time 32, the most we may expect is to form set A of three jobs of (the minimal) length 4, set B being formed by a single job with the length 32. Then, after swapping sets A and B, we have a residue* 32 − 3 × 4 = 20*. Because of these extra 20 units, the available idle space of length 23 is reduced to 3 in schedule <sup>S</sup>L*(*K*, <sup>−</sup>*A*, <sup>+</sup>*B*) *in which set A covers set B. In that schedule, a gap of (the minimal possible) length* 23 − 20 = 3 *occurs.*

We may restrict our attention to sets *A* and *B* which do not contain equal-length jobs, as otherwise we may simply discount the corresponding jobs from both sets. In particular, for given *A* and *B* with *i* ∈ *A* and *j* ∈ *B* with *pi* = *pj*, we obtain sets *A*(−*i*) and *B*(−*j*) by eliminating job *i* and job *j*, respectively, from sets *A* and *B*, respectively. Let *A*(−*all*\_*equal*, *B*) and *B*(−*all*\_*equal*, *A*) be the reduced sets *A* and *B*, respectively, obtained by the repeated application of the above operation for all equal-length jobs. Sets *A*(−*all*\_*equal*, *B*) and *B*(−*all*\_*equal*, *A*) contain no equal-length jobs. We have proved the following lemma.

**Lemma 10.** *If set A covers set B, then set A*(−*all\_equal*, *B*) *covers set B*(−*all\_equal*, *A*)*, where p*(*B*) − *p*(*A*) = *p*(*B*(−*all\_equal*, *A*)) − *p*(*A*(−*all\_equal*, *B*))*.*

**Theorem 4.** *If set A covers set B, then there are also (reduced) sets A* ⊆ *A and B* ⊆ *B, where set B contains a single element π* ∈ *EP*(*K*, *L*) *with the minimum processing time in set B and with P*(*B* ) − *p* ≤ *P*(*A* ) < *P*(*B* ) *such that set A covers set B and P*(*B* ) − *P*(*A* ) = *P*(*B*) − *P*(*A*)*.*

**Proof.** Let *A* and *B* be the reduced sets that contain no equal-length jobs and such that *A* covers *B* (see Lemma 10). We can further reduce sets *A* and *B* by discounting, similarly, for each job *j* ∈ *B*, jobs from set *A*, for which processing times sum up to *pj*. In particular, take a longest job *j* ∈ *B* and longest jobs from set *A* that sum up to *pj*. Due to the divisibility of job processing times and the inequalities *<sup>p</sup>*(*B*) <sup>&</sup>gt; *<sup>p</sup>*(*A*) and *pmin*(*EP*(*K*, *<sup>L</sup>*)) = <sup>2</sup>*<sup>κ</sup> pmin*{*A*} (see Lemma 9), this will be possible as long as the total processing time in *A* is no smaller than *pj*. The sets *A* and *B* are reduced respectively, and the same operation for these reduced sets is repeated until the total processing time of the remaining jobs in the reduced set *A* is less than *pj*. Then, we are left with a single job *j* ∈ *B* (one with the minimum processing time in *B*) and the jobs in set *A* with the total processing time less than *pj*, and such that *pj* − *p*(*A*) ≤ *p* (see Lemma 9).

Let *A* and *B* be the reduced sets obtained from sets *A* and *B*, respectively. By the construction of set *A* and *B* and the fact that set *A* covers set *B*, it immediately follows that *P*(*B* ) − *P*(*A* ) = *P*(*B*) − *P*(*A*) and that set *A* covers set *B* .

Now, we show that the current secondary block B*<sup>K</sup>* will be kept compact if we merely unify the compact preschedules in schedule <sup>Σ</sup>C(*δ*,*K*).
