• 沒有找到結果。

Scheduling of Plausible Task Sequences

Single-Machine Coupled-Task Scheduling

4.3 Scheduling of Plausible Task Sequences

ν : the corresponding first or second counterpart task of ν.

4.3 Scheduling of Plausible Task Sequences

Discussion in the previous section introduces the notion of n+11 (2n

n

)plausible task sequence

for a given job sequence. This section is dedicated to the development of a polynomial time algorithm for determining the makespan of a plausible task sequence, if it is feasible.

Given a plausible task sequence, it could be non-trivial to determine its feasibility and a schedule with the minimum makespan, if feasible.

Denote a plausible task sequence by π = (o1, o2, . . . , o2n), where oh stands for the task assigned to the h-th position in π. If no confusion would arise, hereafter this study simply mentions sequences to indicate plausible task sequences. Notice that in any schedule considered hereafter, the constraint of exact delays is satisfied. In other words, the interval between each pair of coupled tasks aj and bj in any schedule is exactly lj, j ∈ Nn. Denote the starting time and the completion time of job Jj in a schedule σ by sj(σ) and Cj(σ), respectively. It is obvious that Cj(σ) = sj(σ) + aj + lj + bj. A schedule σ is feasible if and only if at any time, at most one task is processed in σ, i.e. no overlap between tasks occurs. Sequence π is called feasible if and only if there exists a feasible schedule whose permutation of tasks agrees with π, i.e. a schedule in which the processing of any task oh

for h∈ N2n−1 completes earlier than or exactly at the starting time of task oh+1.

Consider first how to determine the feasibility of a given sequence π. For any feasible sequence π, the constraint of exact delays implies that the interval induced by the exact delay lj of any job Jj must accommodate all the tasks arranged between ajand bj. Namely, the following condition is necessary for the feasibility of a sequence π.

Condition (C): For any job Jj with o = aj and og = bj, the inequality ∑g−1

h=ℓ+1poh ≤ lj

must hold, where poh is the processing length of task oh.

Note that condition (C) is not sufficient to make sequence π feasible. Consider the

following instance: (a1, l1, b1) = (1, 2, 1), (a2, l2, b2) = (2, 5, 1), (a3, l3, b3) = (2, 4, 2), (a4, l4, b4) = (2, 3, 1). Condition (C) holds for sequence π = (a1, a2, b1, a3, a4, b2, b3, b4).

However, π is infeasible since an overlap between b3 and b4 (Figure 4.4(a)) or between a4

and b2 (Figure 4.4(b)) is inevitable in any attempt to create a feasible schedule of π.

0 1 2 3 4 5 6 7 8 9 10 11 12

a1 b3

a4 b4

b2 a2 b1 a3

(a) (b)

0 1 2 3 4 5 6 7 8 9 10 11 12 13

a1 b3

a4 b4

b2 a2 b1 a3

Figure 4.4: An inevitable task overlap happens (a) between b3 and b4 or (b) between a4 and b2.

Condition (C) only partially verifies the feasibility of π because in a schedule whether an idle time or overlap exists between oh and oh+1 cannot be detected before assigning each task a starting time. Therefore, we turn to develop a procedure for constructing a schedule for sequence π and prove that the feasibility of π can be determined by the constructed schedule. If sequence π is indeed feasible, it can be further proved that the constructed schedule attains the minimum makespan among those of feasible schedules.

Consider the subsequences of a particular permutation pattern

(ai1, ai1+1, . . . , ai2, bi1, bi1+1, . . . , bi2),

1 ≤ i1 ≤ i2 ≤ n, where all its first (respectively, second) tasks are consecutively se-quenced without any second (respectively, first) task inserted. A given sequence π is derived by merging several subsequences of this pattern. Consider the sequence π = (a1, a2, b1, a3, a4, a5, b2, b3, a6, b4, a7, a8, b5, b6, b7, b8) as an example. As shown in Figure 4.5, sequence π can be regarded as the outcome of four interleaved subsequences (a1, a2, b1, b2), (a3, a4, a5, b3, b4, b5), (a6, b6) and (a7, a8, b7, b8). Such particular subsequences are regarded as the maximal fundamental clusters of a given sequence π and these subsequences are scheduled individually. Scheduling these fundamental clusters is the first attempt to ex-amine the feasibility of sequence π. Later it will be elucidated that the infeasibility of

any fundamental cluster leads to the infeasibility of π. If all these fundamental clusters are feasible, then we proceed to schedule π by interleaving those obtained subschedules.

π= (a1, a2, b1, a3, a4, a5, b2, b3, a6, b4, a7, a8, b5, b6, b7, b8)

ß

(a1,a2,b1, a3, a4, a5,b2, b3, a6, b4, a7, a8, b5, b6, b7, b8) (a1, a2, b1,a3,a4,a5, b2,b3, a6,b4, a7, a8,b5, b6, b7, b8) (a1, a2, b1, a3, a4, a5, b2, b3,a6, b4, a7, a8, b5,b6, b7, b8) (a1, a2, b1, a3, a4, a5, b2, b3, a6, b4,a7,a8, b5, b6,b7,b8)

( )

( )

( )

( )

Figure 4.5: Four subsequences of a particular pattern in sequence π.

Now some notations for collating fundamental clusters from sequence π are defined.

Given a sequence π, a segment is defined as a maximal, by inclusion, subsequence of tasks {aj} without inserted tasks {bi}. Assume that the task sequence (a1, a2, . . . , an) is parti-tioned into k disjoint segments for 1≤ k ≤ n. To facilitate discussion, we denote by X the sequence of subscripts (1, 2, . . . , n) and by H a k-subsequence partition of X corresponding to the k-segment partition of (a1, a2, . . . , an). Partitioning X into k disjoint subsequences, we have H ={X1, X2, . . . , Xk} and X = X1⊕X2⊕· · ·⊕Xk, where Xrdenotes the r-th sub-sequence in X and⊕ is a sequence concatenation operator. For r ∈ Nk, the last element of subsequence Xr is denoted by nr, and we have Xr = (nr−1 + 1, . . . , nr), where n0 = 0 and nk= n. Denote by ˜Xr the set of elements in sequence Xr. |Xr| = nr− nr−1 indicates the length of Xr. Denote by bn

r the immediate predecessor of anr+1 in π for r ∈ Nk−1 and nr−1+ 1≤ nr ≤ nr, where n0 = 0. Notice that any single task anr−1+1 = anr, which is sur-rounded by two tasks bn

r−1 and bn

r−1+1 in π, forms a segment, i.e. |Xr| = 1. According to the assumption of k segments, sequence π consists of k fundamental clusters in which the r-th one contains jobs{Jj| j ∈ ˜Xr}, r ∈ Nk. Denote the r-th fundamental cluster in π by πr= (anr−1+1, . . . , anr, bnr−1+1, . . . , bnr), r∈ Nk. The subsequence obtained by eliminating the jobs of{Jj| j ∈ ˜Xr+1∪· · ·∪ ˜Xk} from π is denoted by χr, r ∈ Nk−1. Note that χk = π.

To construct a schedule of fundamental cluster πr, we proposes a recursive procedure to augment the subschedule job by job, instead of task by task. Namely, coupled tasks aj

and bj are simultaneously added into the subschedule of jobs (Jnr−1+1, Jnr−1+2, . . . , Jj−1), j ∈ {nr−1 + 2, . . . , nr}, in each recursion step. In the proposed procedure, job Jj is interleaved with job Jj−1 by conjoining two first tasks aj−1 and aj (Figure 4.6(a)) or two second tasks bj−1 and bj (Figure 4.6(b)). The obtained schedule is denoted by σr, and the recursive formula for the job starting times is given as follows:

sjr) =







0, j = nr−1+ 1;

sj−1r) + aj−1

+ max{0, lj−1+ bj−1− aj− lj}, nr−1+ 2 ≤ j ≤ nr.

(4.1)

aj-1 aj bj-1 bj aj-1 aj bj-1 bj

(a) (b)

lj-1

lj

lj-1

lj

Figure 4.6: Jj is interleaved with Jj−1 by conjoining (a) aj−1 and aj or (b) bj−1 and bj. Eq. (4.1) implies that in σr task aj (respectively, bj) is started later than or exactly at the completion of aj−1 (respectively, bj−1). Schedule σr is a feasible schedule of πr if task anr completes earlier than or exactly at the start of task bnr−1+1. The following lemma gives structural properties of fundamental clusters.

Lemma 4.1. Given a subsequence πr = (anr−1+1, . . . , anr, bnr−1+1, . . . , bnr), the following three properties hold: (i) If snrr)+anr > Cnr−1+1r)−bnr−1+1, then πr is infeasible. (ii) If snrr) + anr ≤ Cnr−1+1r)− bnr−1+1, then πr is feasible and σr is a feasible schedule attaining the minimum makespan among those of all feasible schedules of πr. (iii) The feasibility and the shortest schedule, if feasible, can be determined in O(|Xr|) time.

Proof. If snrr)+anr > Cnr−1+1r)−bnr−1+1, then task anr completes later than the start of task bnr−1+1 in σr. The only possible way to find a feasible schedule of πr is to process anr earlier or process bnr−1+1later. In schedule σr, task aj starts exactly at the completion of aj−1, or task bj starts exactly at the completion of bj−1, j ∈ {nr−1+ 2, . . . , nr}. Starting Jnr earlier or Jnr−1+1 later finally results in the shifting of the whole schedule, which is

futile. Therefore, a feasible schedule of πr does not exist and πr is infeasible. Property (i) is proved.

Property (ii) is concerned about the feasibility of πr and the optimality of σr. As for the feasibility of πr, the inequality snrr) + anr ≤ Cnr−1+1r)− bnr−1+1 indicates that task anr completes earlier than or exactly at the starting time of task bnr−1+1 in σr. Therefore, a feasible schedule of πr, i.e. σr, exists and πr is feasible. Next, we will show that schedule σr attains the minimum makespan for sequence πr, i.e. Cnrr)≤ Cnrπr), where σπr denotes any feasible schedule of πr. This inequality can be proved by induction on nr. We derive the following recursive equation for Cjr) by adapting Eq. (4.1).

Cjr) =







anr−1+1+ lnr−1+1+ bnr−1+1, j = nr−1+ 1;

Cj−1r) + bj

+ max{0, aj+ lj − lj−1− bj−1}, nr−1+ 2 ≤ j ≤ nr.

(4.2)

Consider the induction base nr = nr−1+ 2 and πr = (anr−1+1, anr−1+2, bnr−1+1, bnr−1+2).

If anr−1+2 + lnr−1+2 > lnr−1+1 + bnr−1+1, then it is impossible to interleave Jnr−1+1 and Jnr−1+2 with a completion time less than anr−1+1 + anr−1+2 + lnr−1+2 + bnr−1+2. On the other hand, if anr−1+2+ lnr−1+2 ≤ lnr−1+1+ bnr−1+1, then there exists no feasible schedule σπr where Jnr−1+2 completes earlier than anr−1+1 + lnr−1+1 + bnr−1+1 + bnr−1+2. Since Cnr−1+2r) = anr−1+1+ anr−1+2+ lnr−1+2+ bnr−1+2 for anr−1+2+ lnr−1+2 > lnr−1+1+ bnr−1+1 and Cnr−1+2r) = anr−1+1 + lnr−1+1+ bnr−1+1+ bnr−1+2 for anr−1+2+ lnr−1+2 ≤ lnr−1+1+ bnr−1+1 from Eq. (4.2), we have the induction base Cnr−1+2r)≤ Cnr−1+2πr).

Assume, as the induction hypothesis, that the inequality holds for nr= i > nr−1+ 2, i.e. Cir) ≤ Ciπr). If ai+1+ li+1 > li + bi, then the minimum time span from the completion time of Ji to that of Ji+1 is ai+1+ li+1+ bi+1− li− bi. In case of ai+1+ li+1 li+ bi, the minimum aforementioned time span is bi+1. By Eq. (4.2), we have Ci+1r) = Cir) + bi+1+ ai+1+ li+1− li− bi for ai+1+ li+1 > li+ bi and Ci+1r) = Cir) + bi+1 for ai+1+ li+1 ≤ li + bi. Hence, Ci+1r) is less than or equal to the completion time of Ji+1 in any feasible schedule σπr, i.e. Ci+1r) ≤ Ci+1πr). By induction, the inequality Cnrr)≤ Cnrπr) is established. The proof of property (ii) is done.

For schedule πr, the feasibility and the shortest schedule, if feasible, can be obtained by the values of sjr) for j = nr−1+ 1, . . . , nr. By virtue of Eq. (4.1), the calculation involves |Xr| − 1 iterations, each of which requires constant time. Therefore, either a feasible schedule with the minimum makespan or the infeasibility of sequence πr can be determined in O(|Xr|) time.

The infeasibility of fundamental cluster πr implies that there exists no feasible sub-schedule whose task permutation agrees with subsequence πr, r ∈ Nk. Since the sub-sequence πr is a part of complete sequence π, no feasible complete schedule of π exists either. We therefore have the following property.

Property 4.1. If any fundamental cluster πr, r ∈ Nk, is infeasible, then sequence π is infeasible.

Before presenting a step-wise procedure for determining the infeasibility or the shortest feasible schedule of sequence π, we define some notations. For each schedule σr (r ∈ Nk), denote by αr the time span from the start of anr−1+1 to the completion of anr, and γr the idle time between anr and bnr−1+1. Sr denotes a subschedule constructed by arranging the first r subschedules, σ1, . . . , σr. Note that Sk is the constructed complete schedule of sequence π, which consists of k clusters. Denote by βr1 the idle time between bn

r and bn r+1

in subschedule Sr, and by βr2 the time span from the start of bn

r+1to the completion of bnr.

Algorithm Plausible-Task-Sequence

Step 1. Scan π to obtain the partition H = (X1, . . . , Xk) and keep track of nr, nr and χr for each r = 1, . . . , k− 1.

Step 2. Schedule πr by Eq. (4.1) for each r = 1, . . . , k. If any πr is infeasible, then go to Step 7. Otherwise, set I = 1 and SI = σ1.

Step 3. If nI = nI, then merge SI with σI+1 by appending anI+1 to the end of bnI and go to Step 6.

Step 4. If βI1 ≥ αI+1∧ βI2 ≤ γI+1, then go to Step 4(a). If βI1 < αI+1∧ βI2 ≤ γI+1, then go to Step 4(b). If βI1 ≥ αI+1∧ βI2 > γI+1, then go to Step 4(c). Otherwise, go to Step 4(d).

Step 4(a). If βI1+ βI2 ≤ αI+1+ γI+1, then merge SI with σI+1 by appending anI+1 to the end of bn

I. Otherwise, merge SI with σI+1 by appending bnI+1 to the end of bnI. Go to Step 6.

Step 4(b). Shift bn

I+1 (and an

I+1 will be simultaneously shifted, i.e. shift Jn I+1) to extend βI1 such that βI1 = αI+1 and merge SI with σI+1 by appending anI+1 to the end of bn

I. Go to Step 5.

Step 4(c). Shift Jn

I+1 to shorten βI2 such that βI2 = γI+1 and merge SI with σI+1 by appending bnI+1 to the end of bnI. Go to Step 5.

Step 4(d). If βI1+ βI2 ≤ αI+1+ γI+1, then shift Jn

I+1 to extend βI1 such that βI1 = αI+1 and merge SI with σI+1 by appending anI+1 to the end of bn

I. Otherwise, shift Jn I+1

to shorten βI2 such that βI2 = γI+1 and merge SI with σI+1 by appending bnI+1 to the end of bnI. Go to Step 5.

Step 5. Call Checking routine with input bn

I+1. Call Checking routine with input an

I+1.

Step 6. Let SI+1 be the obtained schedule. If I = k− 1, then output the schedule SI+1

and stop. Otherwise, set I = I + 1 and go to Step 3.

相關文件