12
Discrete Optimization Scheduling two agents with controllable processing times Guohua Wan a, * , Sudheer R. Vakati b , Joseph Y.-T. Leung b , Michael Pinedo c a Antai College of Economics and Management, Shanghai Jiao Tong University, 535 Fahuazhen Road, Shanghai 200052, China b Department of Computer Science, New Jersey Institute of Technology, Newark, NJ 07102, USA c Stern School of Business, New York University, 44 West Fourth Street, New York, NY 10012, USA article info Article history: Received 3 December 2008 Accepted 5 January 2010 Available online 1 February 2010 Keywords: Agent scheduling Controllable processing times Availability constraints Imprecise computation Total completion time Maximum tardiness Maximum lateness abstract We consider several two-agent scheduling problems with controllable job processing times, where agents A and B have to share either a single machine or two identical machines in parallel while process- ing their jobs. The processing times of the jobs of agent A are compressible at additional cost. The objec- tive function for agent B is always the same, namely a regular function f max . Several different objective functions are considered for agent A, including the total completion time plus compression cost, the max- imum tardiness plus compression cost, the maximum lateness plus compression cost and the total com- pression cost subject to deadline constraints (the imprecise computation model). All problems are to minimize the objective function of agent A subject to a given upper bound on the objective function of agent B. These problems have various applications in computer systems as well as in operations manage- ment. We provide NP-hardness proofs for the more general problems and polynomial-time algorithms for several special cases of the problems. Ó 2010 Elsevier B.V. All rights reserved. 1. Introduction We consider several two-agent scheduling problems where two sets of jobs N 1 and N 2 (belonging to agents A and B, respectively) have to be processed on one or more machines. Agent A has to schedule the n 1 jobs of N 1 and agent B has to schedule the n 2 jobs of N 2 . Let n denote the total number of jobs, i.e., n ¼ n 1 þ n 2 . The processing time, release date and due date of job j 2 N 1 ðN 2 Þ are denoted by p a j ; r a j and d a j (p b j ; r b j and d b j ), respectively. In classical deterministic scheduling models, all processing times are fixed and are known in advance. In the models considered here, the job processing times are controllable and can be chosen by the decision maker. Furthermore, due to symmetry of the two agents (see Agnetis et al., 2004), we assume that processing times of agent A’s jobs are controllable, while processing times of agent B’s jobs are not. Formally, for each job j 2 N 1 , there is a maximum value of the processing time " p a j which can be compressed to a minimum value p a j ð p a j 6 " p a j Þ. Compressing " p a j to some actual processing time p a j p a j ; " p a j may decrease the job completion time, but entails an additional cost c a j x a j , where x a j ¼ " p a j p a j is the amount of compres- sion of job j 2 N 1 and c a j is the compression cost per unit time. The total compression cost is represented by a linear function P j2N 1 c a j x a j . Given a schedule r, the completion time of job j of agent A (B) is denoted by C a j ðrÞðC b j ðrÞÞ. If there is no ambiguity, we omit r and use C a j ðC b j Þ. The two agents may have either the same objec- tive function or two different objective functions. We consider the optimization problem in which the value of the objective function of agent A has to be minimized, while the value of the objective function of agent B must be kept at less than or equal to a fixed va- lue Q. The classical notation for machine scheduling is based on a trip- let ajbjc. Agnetis et al. (2004) extend this notation for the two- agent problem to ajbjc a : c b . Their optimization problems can be described as follows: Given that agent B keeps the value of its objective function c b less than or equal to Q, agent A has to mini- mize the value of its objective function c a . In this paper, we may assume that either one set or both sets of jobs have different re- lease dates and that either one set or both sets of jobs are subject to preemption. If the jobs of both agents are subject to the same processing restrictions and constraints (as in Agnetis et al. (2004)), then the two-agent problem will be referred to as ajbjc a : c b : If the processing restrictions and constraints of agent A’s jobs are different from the processing restrictions and constraints of agent B’s jobs, we refer to the two-agent problem as ajb a : b b jc a : c b : For example, 1jr a j ; pmtn a : r b j jc a : c b refers to two sets of jobs to be scheduled on a single machine with objectives c a and c b , respec- tively. The first set of jobs are released at different times, i.e., r a j , 0377-2217/$ - see front matter Ó 2010 Elsevier B.V. All rights reserved. doi:10.1016/j.ejor.2010.01.005 * Corresponding author. E-mail address: [email protected] (G. Wan). European Journal of Operational Research 205 (2010) 528–539 Contents lists available at ScienceDirect European Journal of Operational Research journal homepage: www.elsevier.com/locate/ejor

Scheduling two agents with controllable processing times

Embed Size (px)

Citation preview

Page 1: Scheduling two agents with controllable processing times

European Journal of Operational Research 205 (2010) 528–539

Contents lists available at ScienceDirect

European Journal of Operational Research

journal homepage: www.elsevier .com/locate /e jor

Discrete Optimization

Scheduling two agents with controllable processing times

Guohua Wan a,*, Sudheer R. Vakati b, Joseph Y.-T. Leung b, Michael Pinedo c

a Antai College of Economics and Management, Shanghai Jiao Tong University, 535 Fahuazhen Road, Shanghai 200052, Chinab Department of Computer Science, New Jersey Institute of Technology, Newark, NJ 07102, USAc Stern School of Business, New York University, 44 West Fourth Street, New York, NY 10012, USA

a r t i c l e i n f o a b s t r a c t

Article history:Received 3 December 2008Accepted 5 January 2010Available online 1 February 2010

Keywords:Agent schedulingControllable processing timesAvailability constraintsImprecise computationTotal completion timeMaximum tardinessMaximum lateness

0377-2217/$ - see front matter � 2010 Elsevier B.V. Adoi:10.1016/j.ejor.2010.01.005

* Corresponding author.E-mail address: [email protected] (G. Wan).

We consider several two-agent scheduling problems with controllable job processing times, whereagents A and B have to share either a single machine or two identical machines in parallel while process-ing their jobs. The processing times of the jobs of agent A are compressible at additional cost. The objec-tive function for agent B is always the same, namely a regular function fmax. Several different objectivefunctions are considered for agent A, including the total completion time plus compression cost, the max-imum tardiness plus compression cost, the maximum lateness plus compression cost and the total com-pression cost subject to deadline constraints (the imprecise computation model). All problems are tominimize the objective function of agent A subject to a given upper bound on the objective function ofagent B. These problems have various applications in computer systems as well as in operations manage-ment. We provide NP-hardness proofs for the more general problems and polynomial-time algorithms forseveral special cases of the problems.

� 2010 Elsevier B.V. All rights reserved.

1. Introduction

We consider several two-agent scheduling problems where twosets of jobs N1 and N2 (belonging to agents A and B, respectively)have to be processed on one or more machines. Agent A has toschedule the n1 jobs of N1 and agent B has to schedule the n2 jobsof N2. Let n denote the total number of jobs, i.e., n ¼ n1 þ n2. Theprocessing time, release date and due date of job j 2 N1 ðN2Þ aredenoted by pa

j ; raj and da

j (pbj ; rb

j and dbj ), respectively. In classical

deterministic scheduling models, all processing times are fixedand are known in advance. In the models considered here, thejob processing times are controllable and can be chosen by thedecision maker. Furthermore, due to symmetry of the two agents(see Agnetis et al., 2004), we assume that processing times of agentA’s jobs are controllable, while processing times of agent B’s jobsare not. Formally, for each job j 2 N1, there is a maximum valueof the processing time �pa

j which can be compressed to a minimumvalue pa

j ðpaj 6

�paj Þ. Compressing �pa

j to some actual processing timepa

j 2 ½paj ; �p

aj � may decrease the job completion time, but entails an

additional cost caj xa

j , where xaj ¼ �pa

j � paj is the amount of compres-

sion of job j 2 N1 and caj is the compression cost per unit time. The

total compression cost is represented by a linear functionPj2N1

caj xa

j . Given a schedule r, the completion time of job j of agentA (B) is denoted by Ca

j ðrÞ ðCbj ðrÞÞ. If there is no ambiguity, we omit

ll rights reserved.

r and use Caj ðC

bj Þ. The two agents may have either the same objec-

tive function or two different objective functions. We consider theoptimization problem in which the value of the objective functionof agent A has to be minimized, while the value of the objectivefunction of agent B must be kept at less than or equal to a fixed va-lue Q.

The classical notation for machine scheduling is based on a trip-let ajbjc. Agnetis et al. (2004) extend this notation for the two-agent problem to ajbjca : cb. Their optimization problems can bedescribed as follows: Given that agent B keeps the value of itsobjective function cb less than or equal to Q, agent A has to mini-mize the value of its objective function ca. In this paper, we mayassume that either one set or both sets of jobs have different re-lease dates and that either one set or both sets of jobs are subjectto preemption. If the jobs of both agents are subject to the sameprocessing restrictions and constraints (as in Agnetis et al.(2004)), then the two-agent problem will be referred to as

ajbjca : cb:

If the processing restrictions and constraints of agent A’s jobsare different from the processing restrictions and constraints ofagent B’s jobs, we refer to the two-agent problem as

ajba : bbjca : cb:

For example, 1jraj ; pmtna : rb

j jca : cb refers to two sets of jobs tobe scheduled on a single machine with objectives ca and cb, respec-tively. The first set of jobs are released at different times, i.e., ra

j ,

Page 2: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 529

and are subject to preemption; the second set of jobs are alsoreleased at different times but are not subject to preemption. Weput ctrl in the second field when the processing times arecontrollable.

Scheduling models with controllable processing times have re-ceived considerable attention in the literature since the originalstudies by Vickson (1980a,b). The scheduling problem of minimiz-ing total (weighted) completion time plus compression cost has at-tracted much attention (see, for example, van Wassenhove andBaker, 1982; Nowicki and Zdrzalka, 1995; Janiak and Kovalyov,1996; Wan et al., 2001; Hoogeveen and Woeginger, 2002; Janiaket al., 2005; Shakhlevich and Strusevich, 2005). Shabtay and Stei-ner (2007) survey relevant results up to 2007.

Scheduling models with multiple agents have already receivedsome attention in the literature. Baker and Smith (2003) and Agne-tis et al. (2004) consider scheduling models with two agents inwhich all jobs of the two sets are released at time 0 and both setsof jobs are subject to the same processing restrictions and con-straints. The objective functions considered in their models includethe total weighted completion time (

PwjCj, where wj is the weight

of job j), the number of tardy jobs (P

Uj, where Uj ¼ 1 if Cj > dj andUj ¼ 0 otherwise) and the maximum of regular functions (fmax,where fmax ¼ maxjðfjðCjÞÞ and fjðCjÞ is a nondecreasing function withrespect to Cj). Cheng et al. (2007) consider scheduling models withmore than two agents and each agent has as an objective the totalweighted number of tardy jobs. Cheng et al. (2008) consider sched-uling models with more than two agents and with precedence con-straints. Leung et al. (2010) consider a scheduling environmentwith m P 1 identical machines in parallel and two agents, and gen-eralize the results of Baker and Smith (2003) and Agnetis et al.(2004) by including the total tardiness objective, allowing for pre-emption, and considering jobs with different release dates.

Scheduling models with controllable processing times are moti-vated by numerous applications in production and operationsmanagement as well as in computing systems. The main issue ofconcern is the trade-off between job completion times and thecosts of compression. Two-agent models have also importantapplications in practice. In the remaining part of this section wediscuss some of the applications of our models.

For an application of controllable processing times in manufac-turing and production management, assume the values �pj repre-sent the processing requirements under normal situations. Theseprocessing requirements can be controlled by the allocation levelof the resources (e.g., people and/or tools). When additional re-sources are allocated to job j, its regular processing time �pj canbe reduced by an amount xj to some value pj 2 ½pj; �pj� at a cost ofcjxj (i.e., the cost of the additional resources), where cj is the unitcost of additional resources allocated (cf., Cheng and Janiak,1994; Cheng et al., 1998, 2001; Grabowski and Janiak, 1987; Janiak,1986, 1987a,b, 1988, 1989, 1998; Janiak and Kovalyov, 1996; Now-icki and Zdrzalka, 1984; Shakhlevich and Strusevich, 2005). In theproject management literature the compression of activities is usu-ally referred to as crashing.

In supply chain management, firms often have to make decisionswith regard to outsourcing, i.e., they have to decide which part of anorder to process in-house and which part of the order to outsourceto a third party since it may be profitable for a firm to process only apart of an order internally for pj time units and outsource theremainder (xj ¼ �pj � pj time units) to a third party (see, e.g., Chaseet al., 2004). A good strategy here is to process the order in-houseas much as possible by setting the lower bound pj (representingthe minimum amount of in-house production) close to the ordersize �pj, and to minimize the payment to the third party

Pcjxj (see

also Shakhlevich and Strusevich, 2005).Another application of controllable processing times occurs in

computer programming. An iterative algorithm typically involves

some initial setup that takes pj time units. After the initial setup,the algorithm typically goes through many iterations that take anadditional �pj � pj time units. Ideally, the program should be runfor exactly �pj time units, but because of deadline constraints, itmay not be possible to run the program in its entirety. However,we can still get some useful (though not exact) result if the pro-gram is run for pj time units, where pj 6 pj 6 �pj. In the computerscience community, this mode of operation is called imprecisecomputation (see Blazewicz, 1984; Blazewicz and Finke, 1987;Leung, 2004; Leung et al., 1994; Liu et al., 1991; Potts and van Was-senhove, 1992; Shih et al., 1989, 1991). In the imprecise computa-tion model, the total weighted error is equivalent to the totalcompression cost

Pcjxj, where xj ¼ �pj � pj.

Two-agent models have various important applications in prac-tice as well. For example, consider a machine that has to undergomaintenance at regular intervals. One can imagine the mainte-nance process to be the responsibility of, say, agent B. There area number of maintenance tasks that have to be performed in giventime windows, each one specified by a release date and a due date.In order to ensure that the maintenance tasks do not deviate toomuch from the specified time windows, agent B tries to minimizean objective fmax. Agent A has the responsibility of scheduling thereal jobs and may be allowed to do some compression of thesejobs. A machine scheduling problem that is subject to availabilityconstraints can often be modeled as a two-agent problem.

This paper is organized as follows. The description of the prob-lems and their applications is presented in Section 2. In Section 3,we consider the problem of minimizing the compression cost, sub-ject to the constraint that agent A’s jobs have to meet their dead-lines. In Section 4, we consider the total completion time plusthe compression cost as the objective function of agent A. In Sec-tion 5, we consider the maximum tardiness (or lateness) plus thecompression cost as the objective function of agent A. Both Sec-tions 3 and 5 consider a single machine only, while Section 4 con-siders a single machine as well as two identical machines inparallel. We conclude in Section 6 with a discussion of future re-search opportunities.

2. Problem description

In the scheduling problems considered in this paper, each job jof agent B has a penalty function f b

j ðCbj Þ, where f b

j ðCbj Þ is a nonde-

creasing function with respect to Cbj ðj ¼ 1; . . . ;n2Þ, and the objec-

tive function of agent B is simply f bmax ¼maxðf b

1 ðCb1Þ; . . . ; f b

n2ðCb

n2ÞÞ.

Given that agent B keeps the value of f bmax less than or equal to Q,

agent A has to minimize the value of one of the following objectivefunctions:

(1) In the first problem each job j of agent A must meet a dead-line �da

j . The goal is to determine the actual processing timesof agent A’s jobs so that the total compression cost is mini-mized. Using the notation introduced above, we denote theproblems by 1jctrla; ra

j ;�da

j ; pmtna : pmtnbjP

caj xa

j : f bmax and

1jctrla; raj ;

�daj ; pmtna : �bj

Pca

j xaj : f b

max. In Section 3, we show

that 1jctrla; raj ;

�daj ; pmtna : �bj

Pca

j xaj : f b

max is unary NP-hard,

while 1jctrla; ra

j ;�da

j ; pmtna : pmtnbjP

caj xa

j : f bmax is solvable in

polynomial time. We also consider the case where all jobsof both agents are released at time 0 (i.e., 1jctrla; �da

j ;

pmtna : �bjP

caj xa

j : f bmax), and show that this problem is solv-

able in polynomial time.(2) The second problem is to minimize the total completion

time plus job compression costs. Again, the jobs of agent Amay be preempted. We show in Section 4 that when the jobs

Page 3: Scheduling two agents with controllable processing times

530 G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539

of agent A have different release dates, the problem is unaryNP-hard; i.e., the problem 1jctrla; ra

j ; pmtna : �bjPðCa

j þ caj xa

j Þ :

f bmax is unary NP-hard. However, if the jobs of agent A all have

the same release date, then the computational complexitiesof the nonpreemptive and preemptive cases are the same;i.e., the problems 1jctrla

: �bjPðCa

j þ caj xa

j Þ : f bmax and

1jctrla; pmtna : �bjPðCa

j þ caj xa

j Þ : f bmax have the same compu-

tational complexity. Although we do not know the exact sta-tus of computational complexity of these two problems, weare able to provide polynomial-time algorithms for the spe-cial cases of a single machine and of two identical machinesin parallel with

�pa1 6 �pa

2 6 � � � 6 �pan1

and

ca1 6 ca

2 6 � � � 6 can1:

We call this the ‘‘agreeability property”. In fact, the problemswith equal job processing times or equal job compressioncosts are both special cases of the problems with ‘‘agreeabil-ity property”. In some practical situations, a long job process-ing time means processing of the job is complicated thus it isdifficult to compress and incurs large unit job compressioncost. In Sections 4.1 and 4.2, we develop polynomial-timealgorithms for the problems of a single machine and of twoidentical machines in parallel with ‘‘agreeability property”,respectively.

(3) The third and fourth problems concern the minimization ofthe maximum tardiness plus job compression cost and theminimization of the maximum lateness plus job compres-sion cost, respectively. The jobs of agent A may again be pre-empted. We show in Section 5 that if the jobs of agent Ahave arbitrary release dates, then both problems are unaryNP-hard; i.e., the problems 1jctrla

; raj ; pmtna : �bjðTmaxþP

caj xa

j Þ : f bmax and 1jctrla

; raj ; pmtna : �bjðLmax þ

Pca

j xaj Þ : f b

max

are both unary NP-hard. When the jobs of agent A havethe same release date, then the computational complexitiesof the nonpreemptive and preemptive cases are identical.Although we do not know the exact status of computationalcomplexity of these two problems, we are again able to pro-vide a polynomial-time algorithm for the special case when

da1 6 da

2 6 � � � 6 dan1

and

ca1 6 ca

2 6 � � � 6 can1:

Again, we call this the ‘‘agreeability property” and the prob-lems with equal due dates or equal job compression costsare both special cases of the problems with ‘‘agreeabilityproperty”. In some practical situations, a job with large duedate means the processing of the job can be done later thusits compression cost should be large so that the jobs withsmall due dates can be processed earlier. In Section 5, we de-velop polynomial-time algorithms for the problem with‘‘agreeability property”.

Note that in all these problems, the objective functions for agentB are always fmax. It is regular, i.e., it is a nondecreasing functionwith respect to job completion times. To make the description ofthe algorithms more concise, we first describe a procedure to sche-dule the jobs of agent B.

Procedure: Scheduling-Agent-BFor each job j of agent B, compute its ‘‘deadline” �db

j via f bmax 6 Q

(assuming f�1 can be computed in constant time). Starting from

max16j6n2f�dbj g, schedule the jobs of agent B backwards so that each

job is scheduled as close to its deadline as possible.The problems described above may find various applications in

computing systems as well as in operations management. For in-stance, in computer networks a server may have to process severalclasses of jobs such as file downloading, voice messaging and webbrowsing, where one class of jobs may have a high priority and an-other class may have a lower priority. A request to the server forvoice messaging, file downloading, or web browsing, constitutesa job. Jobs may have various characteristics such as release dates,due dates, and/or preemption. The server may put the jobs intotwo classes, say, one for file downloading and the other for voicemessaging. In order to provide a satisfactory quality of service, itis necessary to keep on the one hand the maximum penalty of jobsfor file downloading less than or equal to some fixed value, whileon the other hand, meet the deadlines of the voice messaging pack-ages. To keep the voice quality at a satisfactory level, it is desirableto discard as few packages as possible, i.e., to minimize the totalamount of compression of jobs for voice messaging. This applica-tion can be modeled by (1).

In manufacturing, a facility may process orders from two types ofcustomers. Jobs from customer B have a common deadline, whilejobs from customer A are penalized according to the maximum tar-diness of his/her jobs. It is easy to see that the objective of customer Bis to keep the makespan of his/her jobs less than or equal to the dead-line, and the objective of customer A is to minimize maximum tardi-ness of his/her jobs. If the jobs from customer A can be sped up withadditional resources, then this application can be modeled by (3).

3. Imprecise computation

We first consider the problem 1jctrla; raj ;

�daj ; pmtna : �bj

Pca

j xaj :

f bmax. We show that it is unary NP-hard via a reduction from 3-PAR-

TITION (see Garey and Johnson, 1979).3-PARTITION: Given positive integers a1; . . . ; a3q and b with

b4 < aj <

b2 ; j ¼ 1; . . . ;3q and

P3qj¼1aj ¼ qb, do there exist q pairwise

disjoint three element subsets Si � f1; . . . ;3qg such thatPj2Si

aj ¼ b; i ¼ 1; . . . ; q?

Theorem 1. The problem 1jctrla; raj ;

�daj ; pmtna : �bj

Pca

j xaj : f b

max isunary NP-hard.

Proof. The proof is done via a reduction from 3-PARTITION to1jctrla; ra

j ;�da

j ; pmtna : �bjP

caj xa

j 6 Q a : f bmax 6 Q b. Given an instance

of 3-PARTITION, we construct an instance of the scheduling problem

as follows. Let f bmax be Cb

max. For agent B, there are n2 ¼ 3q jobs withjob j having a processing time aj ðj ¼ 1; . . . ;n2Þ. For agent A, thereare n1 ¼ q� 1 jobs with a processing time of 1 time unit and noneof these jobs can be compressed; i.e., �pa

j ¼ paj ¼ 1. Job j has a release

date raj ¼ j � bþ ðj� 1Þ and a deadline �da

j ¼ j � bþ j; j ¼ 1; . . . ; q� 1.

The threshold value for f bmax is Qb ¼ qbþ q� 1 and the threshold

value forP

caj xa

j is Qa ¼ 0.It is easy to see that there is a solution to the 3-PARTITION

instance if and only if there is a schedule for the constructedinstance of the scheduling problem. h

However, if preemption is allowed for the jobs of agent B, thenthe problem is solvable in polynomial time. That is,1jctrla; ra

j ;�da

j ; pmtna : pmtnbjP

caj xa

j : f bmax is solvable in polynomial

time. The algorithm is based on the polynomial-time algorithmfor minimizing the total weighted error in the imprecise computa-tion model that is due to Leung et al. (1994). The algorithm of Leu-ng–Yu–Wei solves the problem 1jctrl; rj;

�dj; pmtnjP

cjxj inOðn log nþ knÞ time, where n is the number of jobs and k is thenumber of distinct values of fcjg. For completeness, we will de-scribe the algorithm of Leung–Yu–Wei in Appendix A.

Page 4: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 531

Algorithm 1. A polynomial-time algorithm for 1jctrla; raj ;

�daj ;

pmtna : pmtnbjP

caj xa

j : f bmax

Step 1: For each job j of agent B, compute a ‘‘deadline” �dbj via

f bmax 6 Q (assuming f�1 can be computed in constant

time). Let the release date of job j of agent B be rbj ¼ 0

and the cost be cbj ¼ þ1, for j ¼ 1; . . . ;n2 (since the jobs

of agent B are uncompressible, i.e., �pbj ¼ pb

j ).Step 2: Use the algorithm of Leung–Yu–Wei to generate a sche-

dule for all jobs of agents A and B together.

Remark 1. The time complexity of Algorithm 1 is Oððn1 þ n2Þlogðn1 þ n2Þ þ ðkþ 1Þðn1 þ n2ÞÞ, where k is the number of distinctjob costs of agent A.

Remark 2. Algorithm 1 can be generalized to solve the problem1jctrla

; raj ;

�daj ; pmtna : rb

j ; pmtnbjP

caj xa

j : f bmax, where agent B’s jobs

have release dates. In Step 1 of Algorithm 1, we simply let therelease date of job j of agent B be rb

j . It can even solve1jctrla

; raj ;

�daj ; pmtna : rb

j ;�db

j ; pmtnbjP

caj xa

j : f bmax, where agent B’s jobs

have deadlines as well.

Property 1. For the problem 1jctrla; ra

j ;�da

j ; pmtna : pmtnbjP

caj xa

j :

f bmax, if ra

j ¼ 0 for all j, then there exists an optimal schedule in whichjobs of agent B are scheduled as late as possible, i.e., the jobs of agentB are scheduled to complete exactly at their ‘‘deadlines”, computed viaf bmax 6 Q, or completed at the starting time of another job of agent B.

Proof. First, note that in an optimal schedule, all the jobs of agentB must satisfy f b

max 6 Q . Suppose that for a job k of agent B, f bk < Q .

We can then always move it backwards so that f bk ¼ Q (or reaching

the starting time of a scheduled job of agent B) and at the sametime move some pieces of jobs of agent A forward. Clearly, this willnot violate the constraint f b

max 6 Q and will not increaseP

caj xa

j . h

Using Property 1, we can develop our algorithm as follows. Weschedule all the jobs of both agents together using the Leung–Yu–Wei algorithm. Although in the schedule created jobs of agent Bmay be preempted, we can always combine the pieces of a job ofagent B together and move it towards its ‘‘deadline” �db

j , by Property1. In this way, we can always convert a schedule where jobs ofagent B may be preempted into one where jobs of agent B arenot preempted.

Remark 3. Because of Property 1, Algorithm 1 can be used to solvethe problem 1jctrla; �da

j ; pmtna : �bjP

caj xa

j : f bmax as well.

Remark 4. Algorithm 1 can be used to solve the problem 1jctrla;

�daj : �bj

Pca

j xaj : f b

max as well. We first solve the problem 1jctrla; �da

j ;

pmtna : �bjP

caj xa

j : f bmax. We then merge the preempted pieces of

jobs of agent A by moving the jobs of agent B forward. Clearly, thisdoes not violate the constraints of the jobs of either agent.

4. Total completion time plus compression cost

We now turn to the problem 1jctrla; raj ; pmtna : �bj

PðCa

j þ caj xa

j Þ :

f bmax. It can be shown that the problem is unary NP-hard via a

reduction from 3-PARTITION. We will omit the proof here since itis very similar to the proof of Theorem 1.

Theorem 2. The problem 1jctrla; raj ; pmtna : �bj

PðCa

j þ caj xa

j Þ : f bmax is

unary NP-hard.

We now consider the problem when the jobs of agent A are allreleased at time 0; i.e., 1jctrla

; pmtna : �bjPðCa

j þ caj xa

j Þ : f bmax. At the

present time, the complexity of this problem is not known. In fact,for single agent problem 1jctrlj

PðCj þ cjxjÞ, there exists an optimal

schedule in which a job is either fully compressed or uncom-pressed (see Vickson, 1980a). However, this property does not holdfor two-agent problem 1jctrla

; pmtna : �bjPðCa

j þ caj xa

j Þ : f bmax. This

can be seen from the following counterexample.

Example. Consider the problem 1jctrla; pmtna : �bjPðCa

jþca

j xaj Þ : Cb

max, where there are two jobs, one belonging to agent Aand one belonging to agent B, with pa

1 ¼ 4; ca1 ¼ 2; pb

1 ¼ 2 andQ ¼ 5. It is easy to see that the job of agent A is partiallycompressed (by one time unit) in the optimal schedule.

Nevertheless, we do know that the complexities of the nonpre-emptive case and the preemptive case are identical for a single ma-chine; i.e., 1jctrla

; pmtna : �bjPðCa

j þ caj xa

j Þ : f bmax and 1jctrla

:

�bjPðCa

j þ caj xa

j Þ : f bmax have the same complexity. This is because

preemption of agent A’s jobs does not help. In fact, (1) preemptionof an agent A’s job by another agent A’s job dose not reduce the to-tal flow time of agent A; (2) preemption of an agent A’s job by anagent B’s job can be eliminated by moving the job of agent B earlierso that the preempted job of agent A can be processedcontiguously.

Although the complexity of the general case is not known, weare able to provide a polynomial-time algorithm for the specialcase of a single machine with the ‘‘agreeability property”, i.e., with

�pa1 6 �pa

2 6 � � � 6 �pan1

and

ca1 6 ca

2 6 � � � 6 can1:

In Section 4.1, we develop an algorithm for 1jctrla;pmtna :

�bjPðCa

j þ caj xa

j Þ : f bmax (and hence for 1jctrla

: �bjPðCa

j þ caj xa

j Þ : f bmax

as well) with the ‘‘agreeability property”.In Section 4.2, we present an algorithm for the problem with

two identical machines in parallel and the ‘‘agreeability property”,and the jobs of agent B are preemptable; i.e., P2jctrla;pmtna : pmtnbj

PðCa

j þ caj xa

j Þ : f bmax. (For two machines, the complex-

ity of P2jctrla; pmtna : pmtnbj

PðCa

j þ caj xa

j Þ : f bmax may not be the

same as the complexity of P2jctrla : pmtnbjPðCa

j þ caj xa

j Þ : f bmax, see

Fig. 5 for illustration.)

4.1. A single machine with agreeable costs

The idea of the algorithm is as follows. We schedule the jobs ofagent B first and then the jobs of agent A. For each job j of agent B,we compute its ‘‘deadline” �db

j via f bmax 6 Q . The jobs of agent B will

be scheduled backwards so that each job is scheduled as close to itsdeadline as possible. After the jobs of agent B have been scheduled,the time line will be partitioned into a number of blocks, whereeach block is an idle time interval. We then schedule the jobs ofagent A.

Assume that the jobs of agent A have been ordered so that

�pa1 6 �pa

2 6 � � � 6 �pan1

and

ca1 6 ca

2 6 � � � 6 can1:

Initially, the jobs of agent A will be scheduled fully (i.e., the jobsare not compressed at all) into the idle machine intervals, usingthe preemptive SPT (Shortest Processing Time first) rule. That is,the jobs are scheduled in the idle time intervals using SPT rule,and they are preempted if jobs of agent B are already scheduledthere. We then iteratively compress agent A’s jobs in ascending or-der of the job indexes; i.e., the first job will be fully compressedbefore the second job, and so on. Suppose we are considering

Page 5: Scheduling two agents with controllable processing times

532 G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539

the ith job, having fully compressed the first i� 1 jobs. We con-sider compressing the ith job by an amount d, where d is the min-imum of three quantities: (1) the amount that the ith job can becompressed, (2) the amount by which we can compress job i sothat job i’s processing time becomes less than or equal to one ormore of the previous i� 1 jobs, and (3) the minimum amountwe can compress job i so that one or more of the subsequent jobscan jump over the jobs of agent B and finish earlier. We then com-pute the cost of compressing job i by an amount d and the benefitthat we can obtain in terms of reduction of

PCj. If the cost is less

than the benefit, we compress job i. Otherwise, we accrue the re-sults till the total cost is less than the total benefit, at which timewe do the actual compression.

We use the following terminology in the algorithm. Job j ofagent A is referred to as ‘‘compressed” if pa

j ¼ paj , i.e., it is fully

compressed and cannot undergo any additional compression.Job j of agent A is referred to as ‘‘compressible” if pa

j > paj ; it

can undergo some (additional) compression. Job 0 withpa

0 ¼ 0 is a dummy job that belongs to agent A and that isscheduled all the way at the beginning. Job 0 is considered‘‘compressed”.

Algorithm 2. A polynomial-time algorithm for the problem1jctrla; pmtna : �bj

PðCa

j þ caj xa

j Þ : f bmax with the ‘‘agreeability

property”

Step 1: Call Scheduling-Agent-B.Step 2: Define block i as the ith set of contiguously processed

jobs of agent B. Let there be k2 6 n2 blocks, and let hi

be the length of block i, 1 6 i 6 k2.Step 3: For each job j of agent A, let pa

j ¼ �paj and mark job j as

‘‘compressible”. Let pa0 ¼ 0.

Step 4: Let P ¼ fpaj j1 6 j 6 n1g (P is the current set of processing

times of agent A’s jobs). Set Cost = 0 and Benefit = 0.Step 5: Schedule the jobs of agent A by the preemptive SPT rule,

skipping the time slots occupied by jobs of agent B. Let li,1 6 i 6 k2, be the length of the job piece of agent Aimmediately following block i. If there is no job followingblock i, we let li be zero.

Step 6: Let z be the first ‘‘compressible” job; i.e., the first z� 1jobs are ‘‘compressed”. If every job is ‘‘compressed” thengo to Step 9. Let q be the first block of agent B’s jobs thatappears after the start time of job z. If lq; lqþ1; . . . ; lk2 are allzero, then let lmin ¼ 1. Otherwise, let lmin ¼minq6i6k2flijli > 0g. Let xz ¼ pa

z � paz and yz ¼ pa

z � paz0 ,

where z0 is the index of the largest job such thatpa

z0 < paz . Let d ¼minfxz; yz; lming.

Step 7: Compress job z by an amount d; i.e., paz ¼ pa

z � d. We con-sider the following three cases, in the order they arepresented:

Case 1. ðd ¼ lminÞ Cost ¼ Cost þ cz � d, Benefit ¼ Benefit þ ðn1�zþ 1Þ � dþ

Pq6i6k2

uihi, where ui is the number of jobsthat jump over block i (meaning that before compressing job z,they are completed after block i, and are completed before blocki afterwards).

Case 2. ðd¼ xzÞ Cost¼ Costþ cz � d; Benefit¼ Benefitþðn1� zþ1Þ�d, mark job z as ‘‘compressed”.

Case 3. ðd¼ yzÞ Cost¼ Costþ cz � d; Benefit¼ Benefitþðn1� zþ1Þ�d. Reindex the jobs of agent A in ascending order of theirprocessing times, where job z will appear before any jobwith the same processing time as job z.

Step 8: If Cost < Benefit, then go to Step 4 else go to Step 5.Step 9: Using P (which has the last recorded processing times of

the jobs), we schedule the jobs of agent A by the preemp-tive SPT rule, skipping the time slots occupied by jobs ofagent B. This is the final schedule.

Theorem 3. Algorithm 2 correctly solves 1jctrla; pmtna : �bj

PðCa

jþca

j xaj Þ : f b

max with agreeable costs in Oðn2ðn1 þ n2Þn21 log n1Þ time.

Proof. The proof of correctness consists of two parts. The first partis concerned with the correctness and the second part the compu-tational complexity of the algorithm.

The correctness of the algorithm is based on the following twoassertions:

1. The ‘‘agreeability property” of jobs holds while jobs are under-going compression. That is, among the uncompressed jobs, thejob with the smallest compression cost is compressed fullybefore any other job is compressed.

2. In each iteration, if the algorithm compresses by an amount d,Then there exists no c < d such that the benefit obtained by acompression of c is greater than the benefit obtained by a com-pression of d.

We prove the first assertion by contradiction. Let S be anoptimal schedule. Let i and j be the jobs violating the property ofagreeability, i.e., in schedule S,

cai < ca

j and hence pai < pa

j ; xaj > 0 and xa

i < �pai � pa

j :

That is, job i has not been compressed fully but j has beencompressed.

Job i is scheduled earlier than job j. Compress job i bya ¼minfxa

j ; �pai � pa

i � xai g > 0. Job i becomes smaller and creates

additional space. Decompress job j by an amount of a. This causesjob j to become larger. Move a amount of job j to the space createdby the compression of job i. Then the completion time of job jremains the same and the completion time of job i decreases by a.Thus, the total flow time

PCa

j decreases. Furthermore, the total jobcompression cost decreases as well since ca

i < caj . Thus the total

cost of schedule S can be decreased. This contradicts the fact that Sis optimal.

We now prove the second assertion. Let d be the compressiontime determined by the algorithm in a certain iteration and d bebroken into two parts: c and d� c. Assume that the benefit for thefirst part of c units is positive and that the benefit for the next partof d� c units of compression is negative. This is possible only whenthere are two different sets of profit instances where the first set isrealized for a compression of c units and the second set is realizedfor the next d� c units. If that is the case, the algorithm wouldchoose a compression of c units, instead of d units. We thus endwith a contradiction of the initial assumption that the compressionamount was d units.

We now consider the time complexity of the algorithm. Steps 1and 2 take at most Oðn2 log n2Þ time. Steps 3 and 4 take Oðn1Þ time.Steps 5 and 6 take Oðn1 log n1Þ time. Step 7 takes at most Oðn1Þtime and Step 8 takes constant time. The most expensive time ofthe algorithm is the loop consisting of Steps 5–8. In the worst case,the algorithm will terminate when every job is ‘‘compressed”. InStep 7, Case 2 will compress a job, while Cases 1 and 3 will not.Thus, if we can determine the number of steps Cases 1 and 3 takebefore Case 2 is executed, then we can determine the running timeof the algorithm. Case 3 takes at most r ¼ Oðn1Þ steps. Case 1 takesat most Oðn2ðn1 þ n2ÞÞ steps. This is because there could be at mostn1 þ n2 pieces of jobs of agent A. (The jobs of agent A arepreempted at most n2 times.) In the worst case, these pieces allappear after the last block of agent B’s jobs. For each execution ofCase 1, one piece will be moved to the left. Therefore, afterOðn2ðn1 þ n2ÞÞ steps, every piece of agent A’s jobs will be movedbefore the first block of agent B’s jobs, and then Case 1 cannotoccur again. This means that we have to execute Case 2 (which willactually compress the job). So the loop will be executed at most

Page 6: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 533

Oðn2ðn1 þ n2ÞÞ steps for each job. Thus, the overall running time ofAlgorithm 2 is Oðn2ðn1 þ n2Þn2

1 log n1Þ. h

Remark 5. For the problem 1jctrla: �bj

PðCa

j þ cjxaj Þ : f b

max withagreeable costs, we can still run the above algorithm to obtain aschedule with preemption first. Then we merge the preemptedpieces of jobs of agent A by moving the jobs of agent B forward.Obviously this will neither violate the constraint for jobs of agentB nor increase the total cost of agent A.

4.2. Two machines with agreeable costs

In this section, we develop an algorithm for the following prob-lem with ‘‘agreeability property”:

P2jctrla;pmtna : pmtnbj

XðCa

j þ caj xa

j Þ : f bmax:

The algorithm is described in two parts. The first part describes analgorithm for the case in which jobs of agent A are not compressible,i.e.,

P2jpmtna : pmtnbjX

Caj : f b

max:

The second part uses the first part and allows for compression of thejobs of agent A.

We use the following notation when referring to machines. Werefer to the current operating machine as machine e and the othermachine as machine e0.

Algorithm 3. A polynomial-time algorithm for the problemP2jpmtna : pmtnbj

PCa

j : f bmax

Step 1: Call Scheduling-Agent-B (see the explanation givenbelow).

Step 2: Define block i as the ith set of contiguously processedjobs of agent B. Let there be k2 6 n2 blocks.

Step 3: Schedule agent A’s jobs alternately on the two machinesin a forward fashion according to the preemptive SPT rule.Each job is scheduled and completed at the earliest possi-ble time. This may require a rescheduling of agent B’s jobson the other machine (see the explanation given below).

In Step 1, we schedule agent B’s jobs backwards in time, startingfrom the last deadline, �db ¼max16j6n2f�db

j g. Let there be k1 distinct

deadlines, �db1 <

�db2 < � � � < �db

k1ð¼ �dbÞ. Suppose we are scheduling

Fig. 2. Illustration of

Fig. 1. An illustration of the schedule of agent B’s jobs.

jobs with the ith deadline and let Ji denote the set of jobs with

the ith deadline. If maxk2Jifpb

kg 6 12

Pk2Ji

pbk

� �, then we schedule

the jobs, against the deadline �dbi , by McNaughton’s wrap-around

rule (McNaughton, 1959). Otherwise, we schedule the longest jobon one machine and the remaining jobs on the other machine. Ifthere is any part of a job that extends beyond the ði� 1Þth dead-line, then we preempt that job and put the preempted piece intoJi�1. Fig. 1 shows the schedule after all jobs of agent B have beenscheduled, where Bi is the ith block of agent B’s jobs that are pro-cessed contiguously on one of the two machines. The shaded areascorrespond to blocks of agent B’s jobs.

In Step 3, we schedule agent A’s jobs alternately on the two ma-chines; i.e., if we schedule job j on machine e, then job jþ 1 will bescheduled on machine e0, job jþ 2 on machine e, job jþ 3 on ma-chine e0, and so on. When scheduling a job of agent A, we mayencounter two cases. The two cases are explained below. Let j bethe job that is being currently scheduled and assume it is beingscheduled on machine e.

Case 1: Let j0 be the agent A’s job immediately preceding job j onmachine e. If job j0 ends exactly at the beginning of an agent B’s job,then we try to reschedule agent B’s job (or piece of it) on machinee0 to the maximum extent possible, to facilitate the earliest possi-ble starting time for job j on machine e. This is illustrated in Figs.2 and 3.

Case 2: If job j runs to completion without running into anyagent B’s block, no action is necessary. On the other hand, if job jruns into an agent B’s block, say block Bi, before its completion,then we reschedule agent B’s jobs (or pieces of them) from blockBi on the machine e0, to the maximum extent possible, to facilitatethe earliest possible completion time for job j. This is illustrated inFigs. 4 and 5.

It is possible to run into both cases when scheduling an agentA’s job. The time complexity of Algorithm 3 is Oðn1 log n1þn2 log n2Þ. The next theorem shows that Algorithm 3 correctlysolves the problem P2jpmtna : pmtnbj

PCa

j : f bmax: The proof is by

induction on the number of jobs and will be omitted.

Theorem 4. Algorithm 3 correctly solves P2jpmtna : pmtnbjPCa

j : f bmax.

We are now ready to describe an algorithm for

P2jctrla;pmtna : pmtnbj

XðCa

j þ caj xa

j Þ : f bmax:

The idea of the algorithm is similar to that of Algorithm 2 in Sec-tion 4.1. First, we schedule agent B’s jobs backwards in time, start-ing from the last deadline, �db ¼max16j6n2f�db

j g. This part is the sameas Step 1 of Algorithm 3. Then we schedule agent A’s jobs alterna-tively on each machine; this part is the same as Step 3 of Algorithm3. Assume that the jobs of agent A have been ordered so that

�pa1 6 �pa

2 6 � � � 6 �pan1

and

ca1 6 ca

2 6 � � � 6 can1:

Case 1 of Step 3.

Page 7: Scheduling two agents with controllable processing times

Fig. 3. Illustration of Case 1 of Step 3.

534 G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539

We then iteratively compress the jobs in ascending order of the jobindexes; i.e., the first job is fully compressed before the second job,and so on. Suppose we are considering the ith job, having fully com-pressed the first i� 1 jobs. We now consider compressing the ithjob by an amount d, where d is the minimum of three quantities:(1) the amount that the ith job can be compressed, (2) the amountby which we can compress job i so that job i’s processing time be-comes less than or equal to one or more of the previous i� 1 jobs,and (3) the minimum amount we can compress job i so that oneor more of the subsequent jobs can jump over the jobs of agent Band finish earlier (the computation of (3) is more complicated thanthat in Algorithm 2). We then compute the cost of compressing job iby an amount d and the benefit that we can obtain in terms ofreduction of

PCj. If the cost is less than the benefit, we compress

job i. Otherwise, we accrue the results until the total cost is lessthan the total benefit, at which time we do the actual compression.

We use the same terminology as in Section 4.1. Job j of agent Ais referred to as ‘‘compressed” if pa

j ¼ paj , i.e., it is fully compressed

and cannot undergo any additional compression. Job j of agent A isreferred to as ‘‘compressible” if pa

j > paj ; it can undergo some (addi-

Fig. 5. Illustration of

Fig. 4. Illustration of

tional) compression. Job 0 with pa0 ¼ 0 is a dummy job that belongs

to agent A and that is scheduled all the way at the beginning. Job 0is considered ‘‘compressed”.

Algorithm 4. A polynomial-time algorithm for the problemP2jctrla; pmtna : pmtnbj

PðCa

j þ caj xa

j Þ : f bmax with ‘‘agreeability

property”

Step 1: Call Algorithm 3.Step 2: For each job j of agent A, let pa

j ¼ �paj and mark job j as

‘‘compressible”.Step 3: Let P ¼ fpa

j j1 6 j 6 n1g (P is the current set of processingtimes of agent A’s jobs). Set Cost = 0 and Benefit = 0.

Step 4: Let z be the first ‘‘compressible” job; i.e., the first z� 1jobs are ‘‘compressed”. If every job is ‘‘compressed” thengo to Step 13. Otherwise, let xz ¼ pa

z � paz and yz ¼ pa

z � paz0 ,

where z0 is the index of the largest job such that paz0 < pa

z .Step 5: Let t be the starting time of job z on machine e. We call e

the current operating machine. We process all agent B’sblocks that are scheduled at or after time t in increasing

Case 2 of Step 3.

Case 2 of Step 3.

Page 8: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 535

order of their starting times. Let Bi be one such agent B’sblock, where i 6 k2, and let Db

i and Cbi be the starting and

finishing times of block Bi. The following two casesoccur:

1. Block Bi is on the current operating machine. Let j bethe job of agent A that is scheduled immediatelybefore Bi. If Db

i is not the ending time of job j, thenwe let li be the remaining processing time of job j attime Db

i . If job j finishes at time Dbi , then we let

li ¼ 1. If there is no agent A’s job that either finishesor gets preempted at Db

i on the current machine, thenagain we let li ¼ 1. In all cases, the current operatingmachine remains the same. This is illustrated inFig. 6.

2. Block Bi is not on the current operating machine. Let job jbe the job of agent A that is scheduled at or immediatelybefore time Db

i on the current operating machine. Let j0

be the job of agent A that is scheduled after job j; jobj0 will be on the same machine as block Bi. If job j0 fin-ishes at time Db

i , then we let li to be 1 and the currentoperating machine remains the same. Otherwise, let hbe the remaining processing time of job j0 at time Db

i . Ifjob j completes at time Cb

i , then we let li to be the smallerof h and Cb

i � Dbi , and the current operating machine will

be switched to the same machine as block Bi. Otherwise,we let li to be the difference between the completiontime of job j and Cb

i . If job j0 does not exist, then we letli ¼ 1. In the last two cases, the current operatingmachine remains the same as before. This is illustratedin Fig. 7.

Fig. 8. Example 1 ex

Fig. 7. Illustration of Case 2 of Step 5.

Fig. 6. Illustration of Case 1 of Step 5.

The value of lmin is the smallest of all the li values.Step 6: Let d ¼minfxz; yz; lming. Compute the cost c of compress-

ing job z by the amount d. Decrease the processing timepa

z of job z by the amount d. Mark job j as ‘‘compressed” ifpa

z ¼ paz .

Step 7: Compute the benefit b from the compression of job z byan amount d. This is calculated by relaying the schedulefor agent A’s jobs as given in Step 4 and calculating thegain in

PCa

j .Step 8: Cost = Cost + c, Benefit = Benefit + b.Step 9: If Cost < Benefit, go to Step 3.

Step 10: If Cost P Benefit, go to Step 4.Step 11: Using P (which has the last recorded processing times of

the jobs), we schedule the jobs of agent A according tothe preemptive SPT rule, skipping the time slots occupiedby jobs of agent B. This is the final schedule.

Illustration of Step 5 through examples: In Fig. 8, there arethree agent B’s blocks. Agent A’s job c is the job that is being com-pressed and is scheduled on machine 1. Machine 1 is the currentoperating machine. Agent B’s blocks that are scheduled after thestart of job c are B1, B2 and B3. These three blocks are processedin increasing order of their starting times. Block B1 is the first blockto be processed and it is scheduled on the current operating ma-chine. Therefore, Case 1 is applicable here. Job i is scheduled acrossB1. Thus, the value l1 is set equal to t1 � Cb

1, and the current operat-ing machine remains the same. Block B2 is processed next. Since B2

is not scheduled on the current operating machine, Case 2 will beapplicable here. The value l2 is set to t3 � t2, and the current oper-ating machine remains the same. Block B3 is the next agent block tobe processed after block B2. Since B3 is not on the current operatingmachine, Case 2 is applicable here. The value l3 is set to be thesmaller of h and Cb

3 � Db3. In this case, machine 2 becomes the cur-

rent operating machine. The value lmin is the minimum of l1, l2 andl3.

The schedule given in Fig. 9 has four agent B’s blocks. Agent A’sjob c is the job being compressed and is scheduled on machine 1.Machine 1 is the current operating machine. Agent B’s blocks thatare scheduled after the start time of job c are blocks B1, B2, B3 andB4. These blocks are processed in increasing order of their startingtimes and B1 is the first block to be processed. Since B1 is on thecurrent operating machine, Case 1 is applicable here. The value l1

is set to t1 � Cb1, and the current operating machine remains the

same. Block B2 is processed next. Since this block is not scheduledon the current operating machine, Case 2 is applicable here. Thevalue l2 is set to t1 � Cb

1, and the current operating machine re-mains the same. Since block B3 is scheduled on the current operat-ing machine, Case 1 is applicable here. Job j ends exactly at thestarting time of B3. Therefore, l3 is set to 1. Since B4 is not sched-uled on the current operating machine, Case 2 is applicable here.Job j is scheduled at or immediately before the starting time ofB4. The value l4 is set to be the smaller of t2 � Cb

4 and Cb4 � Db

4. In thiscase, machine 2 becomes the current operating machine. The valuelmin is set to be the minimum of l1, l2, l3 and l4.

plaining Step 5.

Page 9: Scheduling two agents with controllable processing times

Fig. 9. Example 2 explaining Step 5.

536 G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539

Theorem 5. Algorithm 4 correctly solves P2jctrla; pmtna : pmtnbjPðCa

j þ caj xa

j Þ : f bmax in Oðn2 log n2 þ n3

1 þ n21 � n2Þ time.

Proof. The proof of correctness consists of two parts. The first partis concerned with the correctness and the second part the compu-tational complexity of the algorithm.

The correctness of the algorithm is based on the following twoassertions:

1. The ‘‘agreeability property” of jobs holds while jobs are under-going compression. That is, among the uncompressed jobs, thejob with the smallest compression cost is compressed fullybefore any other job is compressed.

2. In each iteration, if the algorithm compresses by an amount d,then there exists no c < d such that the benefit obtained by acompression of c is greater than the benefit obtained by a com-pression of d.

We prove the first assertion by contradiction. Let S be anoptimal schedule. Let i and j be the jobs violating the property ofagreeability, i.e., in schedule S,

cai < ca

j and hence pai < pa

j ; xaj > 0 and xa

i < �pai � pa

j :

That is, job i has not been compressed fully but j has beencompressed.

Job i is scheduled earlier than job j. Compress job i bya ¼ minfxa

j ; �pai � pa

i � xai g > 0. Job i becomes smaller and creates

additional space. Decompress job j by an amount of a. This causesjob j to become larger. Move a amount of job j to the space createdby the compression of job i. Then the completion time of job jremains the same and the completion time of job i decreases by a.Thus, the total flow time

PCa

j decreases. Furthermore, the total jobcompression cost decreases as well since ca

i < caj . Thus the total

cost of schedule S can be decreased. This contradicts the fact that Sis optimal.

We now prove the second assertion. Let d be the compressiontime. The benefit from a compression occurs in two ways. An agentA’s job that is preempted by an agent B’s block, may finish earlierwithout any preemption, as in Case 1 of Step 7. This causes areduction in

PCa

j . The other way is when a chunk of agent B’sblock is moved to the other machine, thus enabling a job that waspreempted to finish earlier. We call these profit instances. Whenthe algorithm decides on the compression amount in each itera-tion, it keeps track of these profit instances. Among all those profitinstances, it will realize those instances that require the leastcompression.

Let d be the compression time determined by the algorithm ina certain iteration and d be broken into two parts: c and d� c.Assume that the benefit for the first part of c units is positive andthat the benefit for the next part of d� c units of compression isnegative. This is possible only when there are two different setsof profit instances where the first set is realized for a compressionof c units and the second set is realized for the next d� c units. Ifthat is the case, the algorithm would choose a compression of c

units, instead of d units. We thus end with a contradiction of theinitial assumption that the compression amount was d units.

Next, we consider the time complexity of the algorithm. Step 1takes Oðn2 log n2Þ time. Step 4 takes Oðn1 log n1Þ time for the firsttime and Oðn1Þ time from then on. The time taken for the first timeis more because of the sorting operation involved.

The time complexity depends on the number of iterations. Ineach iteration, the time taken from Step 5 until Step 12 is Oðn1Þ.The number of iterations depends on the value d which is chosen tobe the minimum of three values. Specifically, the number ofiterations depends on the number of times when d is set to xz, yz

and lmin, respectively. Clearly, d is set to xz at most n1 times and d isset to yz at most Oðn2

1Þ times. We can calculate the number of timesd is set to lmin as follows.

In the worst case, every job of agent A ends after all the agentB’s jobs, and after compression each one of them ends before all theagent B’s jobs. In each iteration when d is set equal to lmin, one ofthe two events described below occurs:

1. The total number of preemptions of agent A’s jobs is decreasedby at least one, either because of Case 1 or Case 2 of Step 7.

2. An agent A’s job lines up with the end time of agent B’s block onthe other machine, because of Case 2 of Step 7.

Therefore, the number of times d is set to lmin is at most n1 � n2.Thus, the number of iterations is Oðn1 þ n2

1 þ n1 � n2Þ. So, the timecomplexity of the algorithm is Oðn1 log n1 þ n2 log n2 þ n2

1þn3

1 þ n21 � n2Þ, i.e., Oðn2 log n2 þ n3

1 þ n21 � n2Þ. h

5. Maximum tardiness plus compression cost

In this section, we consider two problems involving due dates,namely, the objective function of agent A is the maximum tardi-ness (or maximum lateness) plus total compression cost. It canbe shown that if the jobs of agent A have different release dates,then both these problems are unary NP-hard. The proofs are byreductions from the 3-PARTITION problem and will be omitted.

Theorem 6. The problems 1jctrla; raj ; pmtna : �bjðTmax þ

Pca

j xaj Þ :

f bmax is unary NP-hard.

At the present time, the complexity of the problem is not knownif all the jobs of agent A are released at time 0. However, if ra

j ¼ 0and da

i 6 daj ) ca

i 6 caj for all i and j, then the problem becomes poly-

nomially solvable. The algorithm is based on the fact that the jobs ofagent A will appear in the optimal schedule in EDD (Earliest DueDate first) order for any set of processing times of these jobs.

Property 2. For the problems 1jctrla; pmtna : �bjðTmax þP

caj xa

j Þ :

f bmax, there exists an optimal sequence in which all the jobs of agent

A are sequenced by the preemptive EDD rule.

Because of this property, we can always compress the process-ing times of these jobs without changing the optimal job sequenceof agent A. Below we describe such a polynomial-time algorithmfor this problem.

Page 10: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 537

Algorithm 5. A polynomial-time algorithm for the problem1jctrla; pmtna : �bj Tmax þ

Pca

j xaj

� �: f b

max with ‘‘agreeability property”

Step 0: Sort the jobs of agent A in increasing order of their duedates. Assume after sorting, we have da

1 6 da2 6 � � � 6 da

n1.

Step 1: Call Scheduling-Agent-B.Step 2: Define block i as the ith set of contiguously processed

jobs of agent B. Let there be k1 6 n2 blocks, and let hi

be the length of block i, 1 6 i 6 k1.Step 3: For each job j of agent A, let pa

j ¼ �paj and mark job j as

‘‘compressible”.Step 4: Let P ¼ fpa

j j1 6 j 6 n1g (P is the current set of processingtimes of agent A’s jobs). Cost = 0 and Benefit = 0.

Step 5: Schedule the jobs of agent A by the preemptive EDD rule,skipping the time slots occupied by jobs of agent B. Letthe maximum tardiness be Tmax and jmax ¼minfj :

Tj ¼ Tmaxg. If Tmax ¼ 0, go to Step 10.Step 6: Let block k be last block before starting of job jmax. Let l be

the distance from time Cjmaxto the end of block k. If there

is no such block, let l ¼ Cjmax. Furthermore, let

Tnext¼maxfTj : job j is before the starting time of job jmaxgand jnext ¼minfj : Tj ¼ Tnextg. If there is no such job, thenTnext ¼ 0.

Step 7: Let z be the first ‘‘compressible” job; i.e., the first z� 1jobs are ‘‘compressed”. If every job before job jmax andincluding job jmax is ‘‘compressed” then go to Step 10.Let xz ¼ pa

z � paz and y ¼ Tmax � Tnext.

Step 8: Let d ¼minfxz; y; lg. Compress job z by an amount d; i.e.,pa

z ¼ paz � d. We consider the following three cases, in the

order they are presented:Case 1. ðd ¼ lÞ Cost ¼ Cost þ cz � d; Benefit ¼ Benefit þ Tmax�

maxfT 0jg, where T 0j is the new tardiness of jobs betweenjob z and block k after compressing job z by l amount.

Case 2. ðd ¼ xzÞ Cost ¼ Cost þ cz � d; Benefit ¼ Benefit þ d, markjob z as ‘‘compressed”.

Case 3. ðd ¼ yÞ Cost ¼ Cost þ cz � d; Benefit ¼ Benefit þ d.

Step 9: If Cost < Benefit then go to Step 4 else go to Step 5.Step 10: Using P (which has the last recorded processing times of

the jobs), we schedule the jobs of agent A according tothe preemptive EDD rule, skipping the time slots occu-pied by jobs of agent B. This is the final schedule.

Theorem 7. Algorithm 5 correctly solves 1jctrla; ra; pmtna : �bjðT þ

j maxP

caj xa

j Þ : f bmax with agreeable costs in Oðn2ðn1 þ n2Þn2

1Þ time.

Proof. The proof of correctness consists of two parts. The first partis concerned with the correctness and the second part the compu-tational complexity of the algorithm.

The correctness of the algorithm is based on the following twoassertions:

1. The ‘‘agreeability property” of jobs holds while jobs are under-going compression. That is, among the uncompressed jobs, thejob with the smallest compression cost is compressedfully before any other job is compressed. This holds due toProperty 2.

2. In each iteration, if the algorithm compresses by an amount d,then there exists no c < d such that the benefit obtained by acompression of c is greater than the benefit obtained by a com-pression of d.

We now prove the second assertion. Let d be the compressiontime determined by the algorithm in a certain iteration and d bebroken into two parts: c and d� c. Assume that the benefit for thefirst part of c units is positive and that the benefit for the next part

of d� c units of compression is negative. This is possible only whenthere are two different sets of profit instances where the first set isrealized for a compression of c units and the second set is realizedfor the next d� c units. If that is the case, the algorithm wouldchoose a compression of c units, instead of d units. We thus endwith a contradiction of the initial assumption that the compressionamount was d units.

We now consider the time complexity of the algorithm. Steps1 and 2 take at most Oðn2 log n2Þ time. Step 0 takes Oðn1 log n1Þ.Steps 1 and 2 take at most Oðn2 log n2Þ time. Steps 3 and 4 takeOðn1Þ time. Steps 5 and 6 take Oðn1Þ time (jobs of agent A aresorted in Step 0 and the job sequence remains the sameregardless of processing time compression). Step 7 takes Oðn1Þtime. Step 8 takes Oðn1Þ time. Step 9 takes constant time. Themost expensive time of the algorithm is the loop consisting ofSteps 5–9. In the worst case, the algorithm will terminate whenevery job is ‘‘compressed”. In Step 8, Case 2 will compress a job,while Case 1 and Case 3 will not. Thus, if we can determine thenumber of steps Cases 1 and 3 take before Case 2 is executed, thenwe can determine the running time of the algorithm. Case 3 takesat most Oðn1Þ steps since each time the first job with maximumtardiness will be moved forward at least one position. Case 1takes at most Oðn2ðn1 þ n2ÞÞ steps. This is because there could beat most n1 þ n2 pieces of jobs of agent A. (The jobs of agent A arepreempted at most n2 times.) In the worst case, these pieces allappear after the last block of agent B’s jobs. For each execution ofCase 1, one piece will be moved to the left. Therefore, afterOðn2ðn1 þ n2ÞÞ steps, every piece of agent A’s jobs will be movedbefore the first block of agent B’s jobs, and then Case 1 cannotoccur again. This means that we have to execute Case 2 (whichwill compress the job). So the loop will be executed at mostOðn2ðn1 þ n2ÞÞ steps for each job. Thus, the overall running time ofAlgorithm 5 is Oðn2ðn1 þ n2Þn2

1Þ. h

Remark 6. If dai 6 da

j ) cai 6 ca

j for all i and j, then a polynomial-time algorithm for the problem 1jctrla

; pmtna : �bj Lamaxþ

�P

cjxaj Þ : f b

max with agreeable costs is similar to that for the problem

1jctrla; pmtna : �bj Tamax þ

Pcjxa

j

� �: f b

max with agreeable costs, except

that in Step 5, it is not necessary to test if Lmax ¼ 0. The time com-plexity is the same as well.

Remark 7. We can generalize Algorithm 5 to solve the problem

1jctrla : �bj Tamax þ

Pcjxa

j

� �: f b

max and the problem 1jctrla: �bj La

maxþ�

Pcjxa

j Þ : f bmax as well. We first solve the preempted version of the

problem and then merge the preempted pieces of the jobs of agentA to obtain a nonpreemptive schedule.

6. Concluding remarks

We have studied several two-agent scheduling problemswith controllable processing times, where processing times ofjobs of agent A are controllable and agent B has objective func-tion fmax. We provided either NP-hardness proofs for generalproblems or polynomial-time algorithms for some special casesof the problems. In fact, these results can be extended to thecorresponding cases where the processing times of jobs of agentB are also controllable with the compression costs charged toagent A.

All of the results obtained in this paper for two-agent models inwhich the jobs of agent A are allowed to be preempted have corre-sponding results in preemptive single machine scheduling envi-ronments with a single agent and availability constraints. Thetime periods that the machine was reserved for agent B were

Page 11: Scheduling two agents with controllable processing times

538 G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539

always ‘‘against the deadlines of the jobs of agent B”. The periodsset aside for the processing of the jobs of agent B were basicallyperiods that the machine was not available for the processing ofjobs of agent A. There is an extensive amount of research doneon scheduling with availability constraints (see Lee, 2004). How-ever, to our knowledge, single machine scheduling with availabil-ity constraints and controllable processing times has not yetbeen considered in the literature.

In cases that agent B has different objective function such asPCb

j , orP

Ubj , the problems become much more complicated from

computational complexity viewpoint. In fact, in optimal schedulesfor such problems, there is no nice property such as ‘‘agent B’s jobsare scheduled against the deadlines of the jobs, computed viafmax 6 Q”. Therefore, it is not necessary to schedule agent B’s jobsfirst then schedule agent A’s jobs. The jobs of both agents may bescheduled intertwingly.

For future research, we note that the computational complexityof the problems with total completion time and maximum tardi-ness/lateness of agent A remains open. For those problems thatare unary NP-hard, it will be interesting to develop approximationalgorithms. Furthermore, it will be of interest to consider problemsin a parallel machine environment, or problems where agent B hasan objective function such as

PCb

j , orP

Ubj .

Acknowledgments

The authors thank the three anonymous referees for their con-structive comments, which helped to improve the presentation ofthe paper substantially. The work of the first author is supportedin part by the NSF of China Grant (70872079) and Shanghai PujiangProgram (09PJC033). The work of the third author is supported inpart by the National Science Foundation under Grants DMI-0300156 and DMI-0556010. The work of the fourth author is sup-ported in part by the National Science Foundation under GrantsDMI-0555999.

Appendix A

In this appendix, we will describe the algorithm of Leung–Yu–Wei which solves the problem 1jrj;

�dj; pmtnjP

cjxj inOðn log nþ knÞ time, where n is the number of jobs and k is thenumber of distinct values of fcjg. Their algorithm employs thealgorithm of Hochbaum and Shamir (1990) which solves the un-weighted case, i.e., k ¼ 1. We will first describe the Hochbaum–Shamir algorithm.

The Hochbaum–Shamir algorithm assumes that the jobs havebeen ordered in nonincreasing order of release times. Let0 ¼ u0 < u1 < � � � < up be the pþ 1 distinct integers obtained fromthe multiset fr1; . . . ; rn;

�d1; . . . ; �dng. These pþ 1 integers divide thetime frame into p segments: ½u0;u1�; ½u1;u2�; . . . ; ½up�1;up�. The out-put of the Hochbaum–Shamir algorithm is an n� p matrix S, whereSij is the number of time units job i is scheduled in segment j.

Hochbaum–Shamir algorithm (Hochbaum and Shamir,1990)

Step 1: For i ¼ 1; . . . ; p do: li ui � ui�1.Step 2: For i ¼ 1; . . . ;n do:

Find a satisfying ua ¼ �di and b satisfying ub ¼ ri.For j ¼ a; a� 1; . . . ; bþ 1 do:

d minflj; pig.Sij d; lj lj � d; pi pi � d.

RepeatRepeat

The algorithm of Leung–Yu–Wei can be stated as follows.Leung–Yu–Wei algorithm (Leung et al., 1994)

Input: A single machine and a job set JS with k distinct weights,wi > w2 > � � � > wk. Assume that JS ¼ JS1 [ JS2 [ � � � [ JSk,where JSj; 1 6 j 6 k, consists of all the jobs with weight wj.

Output: An optimal schedule bS for JS.Method:

Step 1: bJS ; and bS empty schedule.Step 2: For j ¼ 1; . . . ; k do:

Sj schedule obtained by the Hochbaum–Shamir algorithm

for bJS [ JSj.Begin (Adjustment Step)

Let there be ‘ blocks in bS : Vi ¼ ½v i�1;v i�; 1 6 i 6 ‘.For i ¼ 1; . . . ; ‘ do:

If Vi is a job block in bS then

Let Jli be the job executed within Vi in bS. Let HðiÞ (resp.

NjðiÞ) be the number of time units Jli has executed in bS (resp.Sj) from the beginning until time v i.

If bNðiÞ > NjðiÞ then assign bNðiÞ � NjðiÞ more time unitsto Jli within Vi in Sj by replacing any job, except Jli , that wasoriginally assigned within Vi.

EndifEndif

RepeatEndbS Sj.bJSj the jobs in JSj with the processing time of each job equal to

the number of nontardy units of the job in bSj.bJS bJS [ bJSj.bS schedule obtained by the Hochbaum–Shamir algorithm forbJS.

Repeat

References

Agnetis, A., Mirchandani, P.B., Pacciarelli, D., Pacifici, A., 2004. Scheduling problemswith two competing agents. Operations Research 52, 229–242.

Baker, K.R., Smith, J.C., 2003. A multiple-criterion model for machine scheduling.Journal of Scheduling 6, 7–16.

Blazewicz, J., 1984. Minimizing mean weighted information loss with preemptibletasks and parallel processors. Technique et Science Informatiques 3, 415–420.

Blazewicz, J., Finke, G., 1987. Minimizing mean weighted execution time loss onidentical and uniform processors. Information Processing Letters 24, 259–263.

Chase, R.B., Aquilano, N.J., Jacobs, F.R., 2004. Operations Management forCompetitive Advantage. Irwin McGraw-Hill.

Cheng, T.C.E., Janiak, A., 1994. Resource optimal control in some single machinescheduling problems. IEEE Transactions on Automatic Control 39, 1243–1246.

Cheng, T.C.E., Janiak, A., Kovalyov, M., 1998. Bicriterion single machine schedulingwith resource dependent processing times. SIAM Journal on Optimization 8,617–630.

Cheng, T.C.E., Janiak, A., Kovalyov, M., 2001. Single machine batch scheduling withresource dependent setup and processing times. European Journal ofOperational Research 135, 177–183.

Cheng, T.C.E., Ng, C.T., Yuan, J.J., 2007. Multi-agent scheduling on a single machineto minimize total weighted number of tardy jobs. Theoretical Computer Science362, 273–281.

Cheng, T.C.E., Ng, C.T., Yuan, J.J., 2008. Multi-agent scheduling on a single machinewith max-form criteria. European Journal of Operational Research 188, 603–609.

Garey, M.R., Johnson, D.S., 1979. Computers and Intractability: A Guide to theTheory of NP-Completeness. Freeman, San Francisco, CA.

Grabowski, J., Janiak, A., 1987. Job-shop scheduling with resource-time models ofoperations. European Journal of Operational Research 28, 58–73.

Hochbaum, D.S., Shamir, R., 1990. Minimizing the number of tardy job unit underrelease time constraints. Discrete Applied Mathematics 28, 45–47.

Hoogeveen, H., Woeginger, G.J., 2002. Some comments on sequencing withcontrollable processing times. Computing 68, 181–192.

Janiak, A., 1986. Time-optimal control in a single machine problem with resourceconstrains. Automatica 22, 745–747.

Janiak, A., 1987a. Minimization of the maximum tardiness in one-machinescheduling problem subject to precedence and resource constraints.International Journal of System Analysis, Modeling, Simulation 4, 549–556.

Page 12: Scheduling two agents with controllable processing times

G. Wan et al. / European Journal of Operational Research 205 (2010) 528–539 539

Janiak, A., 1987b. One-machine scheduling with allocation of continuously-divisibleresource and with no precedence constraints. Kybernetika 23, 289–293.

Janiak, A., 1988. General flow-shop scheduling with resource constraints.International Journal of Production Research 26, 1089–1103.

Janiak, A., 1989. Minimalization of the total resource consumption under a givendeadline in two-processor flow-shop scheduling problem. InformationProcessing Letters 32, 101–112.

Janiak, A., 1998. Minimization of the makespan in two-machine problem undergiven resource constraints. European Journal of Operational Research 107, 325–337.

Janiak, A., Kovalyov, M.Y., 1996. Single machine scheduling subject to deadlines andresource dependent processing times. European Journal of OperationalResearch 94, 284–291.

Janiak, A., Kovalyov, M.Y., Kubiak, W., Werner, F., 2005. Positive half-products andscheduling with controllable processing times. European Journal of OperationalResearch 165, 416–422.

Lee, C.-Y., 2004. Machine scheduling with availability constraints. In: Leung, J.Y.-T.(Ed.), Handbook of Scheduling: Algorithms, Models and Performance Analysis.CRC Press, Boca Raton, FL, USA.

Leung, J.Y.-T., 2004. Minimizing total weighted error for imprecise computationtasks and related problems. In: Leung, J.Y.-T. (Ed.), Handbook ofScheduling: Algorithms, Models and Performance Analysis. CRC Press,Boca Raton, FL, USA.

Leung, J.Y.-T., Pinedo, M.L., Wan, G., 2010. Competitive two-agent scheduling and itsapplications. Operations Research. doi:10.1287/opre.1090.0744.

Leung, J.Y.-T., Yu, V.K.M., Wei, W.-D., 1994. Minimizing the weighted number oftardy task units. Discrete Applied Mathematics 51, 307–316.

Liu, J.W.S., Shih, W.-K., Yu, A.C.S., Chung, J.-Y., Zhao, W., 1991. Algorithms forscheduling imprecise computations. IEEE Computers 24, 58–68.

McNaughton, R., 1959. Scheduling with deadlines and loss functions. ManagementScience 6, 1–12.

Nowicki, E., Zdrzalka, S., 1984. Scheduling jobs with controllable processing timesas an optimal control problem. International Journal of Control 39, 839–848.

Nowicki, E., Zdrzalka, S., 1995. A bicriterion approach to preemptive scheduling ofparallel machines with controllable job processing times. Discrete AppliedMathematics 63, 271–287.

Potts, C.N., van Wassenhove, L.V., 1992. Single machine scheduling to minimizetotal late work. Operations Research 40, 586–595.

Shabtay, D., Steiner, G., 2007. A survey of scheduling with controllable processingtimes. Discrete Applied Mathematics 155, 1643–1666.

Shih, W.-K., Liu, J.W.S., Chung, J.-Y., 1991. Algorithms for scheduling imprecisecomputations with timing constraints. SIAM Journal on Computing 20, 537–552.

Shih, W.-K., Liu, J.W.S., Chung, J.-Y., Gillies, D.W., 1989. Scheduling tasks with readytimes and deadlines to minimize average error. ACM Operating SystemsReview, 14–28.

Shakhlevich, N.V., Strusevich, V.A., 2005. Preemptive scheduling problems withcontrollable processing times. Journal of Scheduling 8, 233–253.

van Wassenhove, L.N., Baker, K.R., 1982. A bicriterion approach to time/costtradeoffs in sequencing. European Journal of Operational Research 11, 48–54.

Vickson, R.G., 1980a. Choosing the job sequence and processing times to minimizetotal processing plus flow cost on a single machine. Operations Research 28,1155–1167.

Vickson, R.G., 1980b. Two single machine sequencing problems involvingcontrollable job processing times. AIIE Transactions 12, 258–262.

Wan, G., Yen, B.P.C., Li, C.-L., 2001. Single machine scheduling to minimize totalcompression plus weighted flow cost is NP-hard. Information Processing Letters79, 273–280.