## Journal of the Brazilian Computer Society

##
*Print version* ISSN 0104-6500*On-line version* ISSN 1678-4804

### J. Braz. Comp. Soc. vol.7 no.3 Campinas 2001

#### http://dx.doi.org/10.1590/S0104-65002001000200004

**ARTICLES**

**A note on the complexity of scheduling coupled tasks on a single processor ^{*}**

**Jacek Blazewicz ^{I}; Klaus Ecker^{II}; Tamás Kis^{III}; Michal Tanas^{I}**

^{I}Institute of Computing Science, PoznanUniversity of Technology, Poznan, Poland

^{II}Institute of Computing Science, Technical University Clausthal, Germany

^{III}University of Siegen, Germany

**ABSTRACT**

This paper considers a problem of coupled task scheduling on one processor, where all processing times are equal to 1, the gap has exact length *h,* precedence constraints are strict and the criterion is to minimise the schedule length. This problem is introduced e.g. in systems controlling radar operations. We show that the general problem is NP-hard.

**Keywords:** Scheduling, coupled tasks, NP-hardness.

**1 Introduction**

A scheduling problem is, in general, a problem answering a question of how to allocate some resources over time in order to perform a given set of tasks [1]. In practical applications resources are processors, money, manpower, tools, etc. Tasks can be described by a wide range of parameters, like ready times, due dates, relative urgency factors, precedence constraints and many more. Different criteria can be applied to measure the quality of a schedule. The general formulation of scheduling problems and the commonly used notation can be found in books such as [5], [16], [2], [15], [3] and [4]. A survey of the most important results is given in [11].

One branch of scheduling theory is concerned with scheduling of coupled tasks. A task is called *coupled *if it contains two operations where the second has to be processed some time after a completion of the first one. This problem, described in [17] and [18], often appears in radar-like devices, where the first operation is the transmission of an electromagnetic pulse and the second is the reception of its echo. Several algorithms designed to solve the problem of radar pulse scheduling can be found in [9] and [12].

The complexity of various scheduling problems with coupled tasks has been studied in [13]. Although most of the cases are NP-hard [13], some polynomial algorithms were found in [14].

A coupled task scheduling problem with variable length gap is surveyed in [10] and [7]. NP-hardness of this case is proved in [19], where some interesting connections between coupled tasks and flow shops are also given.

In this note, we complement the above results by presenting the NP-completeness proof for the problem of scheduling coupled tasks on a single processor, with all processing times equal to 1, exact, integer gap length, general strict precedence constraints and the optimisation criteria of minimising the schedule length.

An organisation of the paper is as follows. The problem is formulated in Section 2. The NP-hardness proof is presented in Section 3. We conclude in Section 4.

**2 Problem formulation**

We consider the problem of scheduling *n *coupled tasks on a single machine, where each coupled task *T _{i}* consists of two operations

*T*

_{i1}and

*T*

_{i}_{2}and a

*gap*between them. During the gap, another task can be processed. Let

*p*

_{i1}and

*p*

_{i}_{2}denote the processing times of operations

*T*

_{i}_{1}and

*T*

_{i}_{2}, respectively.

The gap is exact when operation *T _{i}*

_{2}has to start exactly

*h*units of time after the end of operation

_{i}*T*

_{i}_{1}, where

*h*denotes a length of the gap. In this paper, the only cases considered are those where all

_{i}*h*are equal, i.e.

_{i}*h*l, 2,...,

_{i}= h, i =*n.*

*Precedence constraints *of coupled tasks can be strict or weak. *T _{i}*

*T*means that

_{j}*T*

_{i}_{2}

*T*

_{j}_{1}if precedence constraints are

*strict,*and

*T*

_{i}_{1}

*T*

_{j}_{1}L

*T*

_{i}_{2}

*T*

_{J}_{2}if they are

*weak.*

The special case of a coupled task problem involves identical tasks. Commonly, such tasks are denoted by (*p*_{1}*, h,p*_{2})*, *where *p*_{1}* = p _{i}*

_{1}

*, p*

_{2}

*= p*

_{i}_{2}

*, h = h*for all 1

_{i}__<__

*i*

__<__n.Adapting the commonly accepted notation for scheduling problems [8], the scheduling problem considered in this paper can be denoted by 1|(1,h, 1) – *coupled, strict prec, exact gap*|*C _{max}, *which means:

- There is one processor in a system.
- Tasks are coupled and identical, with processing times
*p*_{i}_{1}*= p*_{i}_{2}*=*1, ''_{1<i<n} - Gaps are exact and have uniform length
*h.* - Precedence constrains are strict.
- The optimisation criterion is to minimise the schedule length
*C*max{_{max}=*t*_{j}_{2}}, where*t*_{j}_{2}is a completion time of*T*(its second operation)._{j}

**3 NP-hardness of the general case**

In case where precedence constraints are general the problem of scheduling coupled tasks on a single processor is NP-hard even for unit processing times. We will prove this by a series of lemmae showing NP-hardness of some intermediate problems.

**Lemma 1 **Problem of *Balanced Colouring of Graphs with Partially Ordered Vertices *is NP-hard.

**Proof: **The problem of *Balanced Colouring of Graphs with Partially Ordered Vertices *(*BCGPOV *for short) can be stated as follows: *Instance: *A directed, acyclic graph *G = *(*V,E*) where |*V*|* = q. *(It is clear that the arcs define a partial order in set *V.*)

*Question: *Can the vertices of *G *be coloured with *l* colours such that no pair of adjacent vertices shares the same colour and exactly *q/l *vertices are coloured with the same colour. (We will call such a colouring the *balanced colouring.*) Without loss of generality we can assume that *q/l *Î ^{+}.

Firstly, we prove that *BCGPOV *belongs to *class NP. *To verify a solution of *BCGPOV *is enough to verify that

No pair of adjacent vertices is monochromatic. Because each vertex has no more than (*q– *1) adjacent vertices the complexity of this step is *O*(*q ^{2}*)

*.*

Exactly *q/l *vertices are coloured with each colour. Complexity of this step is *O*(*q*)*.*

A solution of *BCGPOV can *be verified in polynomial time, which means that the problem *BCGPOV *belongs to *class NP.*

In order to prove NP-completeness of the problem *BCGPOV we *will use the *3-Partition *problem, which is NP-complete in the strong sense according to [6] . The *3-Partition *problem is defined as follows: *Instance: *A collection *A *of 3*r* items, bound *B *Î ^{+}, and size *s*(*aj*) Î ^{+}, ''_{}* _{eA} *such that B/4 <

*s*(

*aj*)

*< B/2*and such that S

_{ÎA}

*s*(

*a*)

_{j}*= rB.*

*Question: *Can *A *be partitioned into *r *disjoint sets *AI, . . . ,A _{r} *such that for 1

__<__

*i*S

__<__r,*s*(

*a*)

_{j}*= B*(note that each

*A*must contain exactly three elements from

_{i}*A*)?

*The transformation: *For any instance of the *3-Partition *problem let us define the corresponding instance of the *BCGPOV *problem as follows:

*q =*3*r*^{2}+*r B**l = r*- For each item
*a*Î_{j}*A,*1__<__*j*__<__3*r*let us construct graph*G*in the following way:_{j}1. Construct complete graph

*K .*on*r*vertices. Denote one vertex of*K .*by*V*_{j}.2. Construct set

*D*of*s*(*a*) independent vertices._{j}3. Create all possible edges (

*v*) such that_{x}, v_{y}*v*Î_{x }*K ,v*¹_{x}*V*and_{j}*v*Î_{y}*D*.

It is clear that edges of graph *G _{j} *can be directed to define a partial order in the set of vertices of

*G*

_{j}.An example of such a graph is shown in Fig 1.

- G =

It is clear that *G _{j} *can be coloured with

*r*colours only in the following way: each vertex from Ka04img05.gif has a different colour and all vertices from

*D*are coloured with the same colour as vertex

*v*.

_{j}No two vertices of any subgraph *K*, 1 __<__ *j < *3r can share the same colour, so after colouring of all

*K*, exactly 3r vertices are coloured with the same colour. All vertices of

*D*are connected with all but

*V*vertices of

_{j}*K*, so all vertices of

*D*have to be coloured with the same colour as vertex

*V*So, the set of vertices of any

_{j}.*D*has to be monochromatic.

Let *A*_{1}*, . . . , A _{j} *be a solution for the given instance of

*3-Partition*problem and let

*Ai =*{

*a*

_{i}_{(1)},

*a*

_{i}_{(2)},

*a*

_{i(3)}}. Let us denote

*S*

_{i}= G_{i}_{(1)}U

*G*

_{i(2)}U

*G*

_{i}_{(3)}.

*G*can be coloured such that sets

*D*and

_{i}*D*share the same colour if and only if both

_{j}*D*and

_{i}*D*are in the same

_{j}*S*. It means that for all

_{i}*i*exactly

*s*=

*B*vertices of sets

*D, so*exactly

*3r + B*vertices of graph

*G,*are coloured with each colour.

On the other hand, let *S*_{1},*S*_{2},...,*S _{r}* be a disjoint sets of vertices of graph

*G,*such that

*V*(

*G*)

*=*

*S*, each vertex in

_{i}*S*is coloured with

_{i}*i*-th colour and ''

_{i}|

*S*| =

_{i}*3r + B.*Let

*S*be a subset of

*Si*that contains only vertices belonging to

*D*subgraphs.

*S*has to contain 3r vertices belonging to

_{i}*K,*so |

*S*|

*– B*for each

*i.*For each feasible colouring each

*D*is monochromatic, so ''

_{1<j<3r}$

_{1<i<r}

*D*Î

*S*. Because ''

_{i}_{1<j<3r}

*B*/4 <

*s*(

*a*) <

_{j}*B*/2 each

*S*has to contain exactly 3 subgraphs

_{i}*D*,

*J*= 1,2,3. So, we candenote

*A*= {

_{i}^{}:

*j = 1,*2,3},

*i =*1, 2,...,

*r*and this is the solution of the

*3-Partition*problem.

The complexity of this transformation is *O*(*r ^{2} + rB*)

*.*Let us note that this is a pseudopolynomial transformation. On the other hand,

*3-Partition*is NP-complete, thus, we have the desired result.

Now, we will show that proplem *BCGPOV* polynomially transforms to our scheduling problem.

**Lemma 2** The problem of *Balanced Colouring of Graphs with Partially Ordered Vertices* polynomially transforms to 1ô (1,*h*,1) - *coupled, strict prec, exact gap* | *C _{max}*.

**Proof: **Let *G =* (*V, E*) be an instance of problem *BCGPOV. *Let it contain all transitive arcs. Let us define a corresponding instance of 1|(1, *h*, 1) – *coupled, strict prec, exact gap*|*C _{max} *problem in the following way:

*n = q**h*=*q/l -*1- For each vertex
*Vi*of graph*G*define the coupled task*T*_{Í}. - For each arc (
*v*) of graph_{i},V_{j}*G*define an arc*T*_{i}*T*of precedence constraints in the scheduling problem._{j} *y = C*= 2_{max}*n*.

Let us assume that a balanced colouring of *G *exists. Let *S*_{1}, *S _{2}, ... , S_{I} *be subsets of

*V*(

*G*) such that

*S*(

_{i}= V*G*)

*,*and all vertices that belong to

*S*are coloured with the

_{i}*i-*thcolour and ''

_{1<i<I}|

*S*|

_{i}*= q/I.*Sets

*S*are partially ordered because vertices of

_{i}*G*are partially ordered and

*G*contains all transitive arcs. Schedule sets

*S*in accordance to the partial order using the following algorithm:

_{i}*Algorithm 1*

**begin**

s:=0

repeatGet a task

TÎ_{j}S._{i}Let s be the starting time of the task

T._{j}

S\_{i}:= S_{i}T_{j}

s1_{i}:=s +

untilS_{i}¹

** end;**

The schedule generated in such way is shown in Fig. 2.

This procedure guarantees that no precedence constraint will be violated. The schedule contains no idle intervals, so its length is *y.*

On the other hand, let us assume that a schedule of length *y *for the given instance of the coupled tasks problem exists. The schedule does not contain idle intervals, so it has to be a sequence of segments as shown in Fig. 2. Each segment contains* h*+1 independent tasks, which means that the corresponding vertices in *G *are also independent. So, the vertices from one segment can be coloured with the same colour, which means *G *can be coloured with *n/*(*h + *1) colours such that exactly *h + 1 *vertices shares the same colour.

Now we can conclude.

**Theorem 1** Problem 1 | (1, *h*, 1) _ *coupled,strict prec, exact gap*|*C _{max} *is NP-hard.

**Proof: **Follows immediately Lemmae 1 and 2.

**4 Conclusions**

In the paper, scheduling of coupled tasks has been considered. General precedence constraints resulted in a strong NP-hardness of the problem, even for unit processing times and equal gap lengths for all the tasks. The other cases, especially where precedence constraints are chain-like or tree-shaped are still open.

**References**

[1] K. Baker, *Introduction to Sequencing and Scheduling, *J. Wiley, New York, 1974 [ Links ]

[2] J. Blazewicz, W. Cellary, R. Stowinski and J. Weglarz, *Scheduling under Resource Constraints: Deterministic Models, *J. C. Baltzer, Basel, 1986. [ Links ]

[3] J. Blalzewicz, K. H. Ecker, E. Pesch, G. Schmidt and J. Weglarz, *Scheduling Computer and Manufacturing Processes *(2nd edition), Springer, Berlin, New York, 2001. [ Links ]

[4] J. Blazewicz, K. H. Ecker, B. Plateu, D. Trys-tam, *Handbook of Parallel and Distributed Processing, *Springer, Berlin, New York, 2000. [ Links ]

[5] R. W. Conway, W. L. Maxwell and L. W. Miller, *Theory of Scheduling, *Addison-Wesley, Reading, Mass. 1967. [ Links ]

[6] M. R. Garey, D. S. Johnson, *Computers and Intractability: A Guide to the Theory of NP-Completeness, *W.H. Freeman, San Francisco, 1979. [ Links ]

[7] J. N. D. Gupta *Single facility scheduling with two operations per job and time-lags, *preprint, 1994. [ Links ]

[8] L. R. Graham, E. L. Lawler, J. K. Lenstra, A. H. G. Rinnooy Kan, Optimization and approximation in deterministic sequencing and scheduling theory: a survey, *Ann. Discrete Math. 5, *1979, 287-326. [ Links ]

[9] A. Farina, P. Neri, Multitarget interleaved tracking for phased radar array, *IEE Proceedings F ***27**, 1980, 312-318. [ Links ]

[10] W. Kern, W. M. Nawijn, *Scheduling multi-operations jobs with time lags on a single machine, *preprint, 1991. [ Links ]

[11] E. L. Lawler, J. K. Lenstra, A. H. G. Rin-noy Kan, D. B. Shmoys, Sequencing and scheduling: algorithms and complexity, in S. C. Graves et al, *Handbooks in Operations Research and Management Science ***4**, North-Holland, Amsterdam, 1993 [ Links ]

[12] D. J. Milojevic, B. M. Popovic, Improved algorithm for the interleaving of radar pulses, *IEE Proceedings F ***139**, 1992, 98-104.. [ Links ]

[13] A. J. Orman, C. N. Potts, On the complexity of coupled tasks scheduling, *Discrete Applied Mathematics ***72**, 1997, 141-154. [ Links ]

[14] A. J. Orman, C. N. Potts, A. K. Shahani, A. R. Moore, Scheduling for the control of a multifunctional radar system, *European Journal of Operational Research ***90**, 1996, 13-25. [ Links ]

[15] M. Pinedo, *Scheduling: Theory, Algorithms and Systems, *Prentice Hall, Englewood Cliffs, N. J., 1995. [ Links ]

[16] A. H. G. Rinnooy Kan, *Machine Scheduling Problems: Classification, Complexity and Computations, *Martinus Nijhoff, The Hague, 1976. [ Links ]

[17] R. D. Shapiro, Scheduling coupled tasks, *Naval. Res. Logist. Quart. ***27**, 1980, 477-481. [ Links ]

[18] A. J. Orman, A. K. Shahani and A. R. Moore, Modelling for the control of a complex radar system, *Computers Ops Res. ***25**, 1998, 239-249. [ Links ]

[19] W. Yu, *The Two-machine Flow Shop Problem with Delays and the One-machine Total Tardiness Problem, *Ph. D. Thesis, Technische Uni-versiteit Eindhoven, 1996. [ Links ]

* Partially supported by the KBN grant.