Scheduling jobs to minimize total cost

Scheduling jobs to minimize total cost

European Journal of Operational Research 74 (1994) 111-119 North-Holland 111 Theory and Methodology Scheduling jobs to minimize total cost Y.L. Che...

553KB Sizes 0 Downloads 73 Views

European Journal of Operational Research 74 (1994) 111-119 North-Holland

111

Theory and Methodology

Scheduling jobs to minimize total cost Y.L. Chen Department of Information Management, National Central Unit,ersity, Chung-Li, 32054 Taiwan, ROC Recieved January 1992; revised March 1992

Abstract: The problem of preemptively scheduling a set of independent jobs with release times and deadlines to a set of parallel identical processors is a well-known scheduling problem. In this paper, we extend this famous problem by adding the consideration that the processing requirement of each job is not a fixed quantity but is a linear function of cost. We assume that the more cost we pay, the less processing requirement there is. Under this new assumption, our goal is to use the minimum cost to complete all jobs subject to their processing conditions. Two polynomial algorithms are developed for this new variant of scheduling problem. Keywords: Deterministic scheduling; Maximum flow problem; Min-cost flow problem

1. Introduction The problem of scheduling a set of jobs on a set of processors so that all processing conditions are satisfied and a certain objective function is optimized has received extensive attention due to its widespread applications. Hence, it is not surprising that a very large number of variants of scheduling problems have been proposed [1-4, 6,7,9]. Basically, a variant of a deterministic scheduling problem can be easily derived by taking appropriate assumptions on the problem conditions and objective function. For example, we may consider the following problem conditions: (1) What types of processors are used? (2) How many processors will be used? One, two, three or m? (3) Can the jobs be run independently? If not, what constraints should be obeyed? Correspondence to: Dr. Y.L. Chen, Department of Informa-

tion Management, National Central University, Chung-Li, 32054 Taiwan, ROC.

(4) Do all the jobs have the same size? If not, can every job have a different size? (5) Should the jobs be scheduled into certain time intervals? (6) Is the schedule preemptive or nonpreemptive? For condition (1), it is usually assumed that the processors are parallel or dedicated, where parallel processors can be further classified as identical, uniform, heterogenous and unrelated processors and dedicated processors can be further divided into flow shop, open shop and job shop systems. The objective function also has many possible variants. For example, we may assume that the goal is the optimization of completion time, mean flow time, mean weighted flow time, mean tardiness, weighted tardiness, maximum lateness or maximum earliness, etc. Although a multitude of variants of deterministic scheduling problems can be easily invented by taking assumptions on problem conditions and the objective function, not every such variant can be said to be important. Only those which are

0377-2217/94/$07.00 © 1994 Elsevier Science B.V. All rights reserved SSDI (t377-2217(02)001//9-9

112

EL. Chen / Scheduling jobs to minimize total cost

practical and have efficient solutions are important and merit further studying. In this paper, a new and important variant of scheduling problem will be introduced by revising the following famous scheduling problem. The original problem is to preemptively schedule a set of n jobs with release times and deadlines on m identical parallel processors [9]. Associated with each job, there is a fixed processing requirement. U n d e r the assumption of fixed processing requirement, the original problem is to find a feasible schedule. Although this assumption is reasonable in many practical situations, there are situations where the amount of processing requirement of a job is not a fixed quantity but is determined by some other parameters, For example, a product can be produced completely by the manufacturing equipments in one's own factory but it is also possible that some parts are purchased from suppliers. In the extreme case, the whole product is purchased from suppliers. Hence, this p a p e r assumes that the processing requirement of a job is a linear function of cost. The more cost we pay, the less processing requirement there is. For enterprise, if all jobs can be done by the current available equipments before the deadline, then there is no reason to buy. On the other hand, if there is no sufficient capability to do all jobs by their deadlines, then it is required that some part of the jobs should be made by outside manufacturers or purchased from suppliers. Therefore, this p a p e r tries to use the minimum cost to complete all the jobs by their deadlines. In this paper, two models of cost are proposed. In the first model, we assume that all jobs are highly correlated such that every job's processing requirement is a linear function of a single parameter A (semantically, A denotes the amount of cost we pay for all jobs) and the problem is to find the minimal value of A such that all jobs can be completed by their deadlines. In the second model, we assume that all the jobs are highly independent so that the processing requirement of each job J~ is a linear function of p a r a m e t e r Ai (semantically, /~i denotes the amount of cost we pay for job Ji) and the problem is to find the minimal value of Y~Ai such that all jobs can be completed by their deadlines. In the following, we describe the problem considered in this paper. We are given n independent jobs J1, J2 . . . . . Jn and m parallel identical

processors P l , P2 . . . . , Pm" Each job Ji has a release time r i and deadline d i such that the job cannot be started before time r i and must be completed by time d i. In addition, each job J,. has a processing requirement Pi which is the amount of processing required to complete job Ji. In the first model, we assume that the processing requirement Pi is a function of the p a r a m e t e r A, where A > 0. Formally speaking,

Pi =

b i - aiA

if 0 _< A < b i / a i ,

0

if A >_ b i / a i ,

where a~ and b i a r e nonnegative constants. In the second model, we assume that the processing requirement Pi is a function of the p a r a m e t e r A~, where Ai > 0. That is,

Pi =

b i - aih i

if 0 _< A i < b i / a i ,

0

if l~ i ~ b i / a i .

Each processor can run only one job at a time and each job can only be run on one processor at a time. A job can be p r e e m p t e d at any time, and be resumed immediately on a new processor or later on any processor at no cost. The goal is to find the minimum value of A or EA~ such that we can construct a schedule which completes all jobs subject to their release times and deadline restrictions. The aim of this paper is to develop algorithms to find the minimum value of A or ~A~ and to find the corresponding schedule. In Section 2, we formulate the above scheduling problem as a parametric bipartite maximum flow problem. Then, Section 3 proposes an O ( n 5) algorithm to solve the formulated bipartite flow problem for the first model, and Section 4 proposes an O(n 4 log n) algorithm to solve the formulated problem for the second model. Finally, Section 5 is the conclusion.

2. Problem formulation

Let us order release times r i and deadlines d i in nondecreasing order and let there be k + 1 different values of r i and d i , k < 2n - 1. These values form k time intervals It, I 2. . . . . I k. Let a j denote the width of interval Ij where Aj = t j+ 1 tj. A job Ji can be run on interval Ij if r i < tj and di>_tj+ ~. Otherwise, job Ji cannot be run on

Y.L. Chen / Scheduling jobs to minimize total cost

5 time intervals. T h e following lemma proves that the transformation is correct.

interval I t. Now, the network is constructed as follows. W e create a n o d e s as the source node. For each job Ji, we create a n o d e with label Ji. F r o m n o d e s to each job n o d e Ji, an arc (s, Ji) is a d d e d with capacity Pi. W h e n the network is for the first model, we define

b i - aih Pi=

0

L e m m a I. For a given value of h or given values of h i where 1 <_i <_n, there is a feasible flow with flow value Eip~ in the constructed bipartite network if and only if there is a feasible schedule in the original scheduling problem.

if 0 _< A < bi/ai, if A > b i / a i.

Proof. Let f be a feasible flow in the network, and let xii d e n o t e the a m o u n t of job Ji to be run on interval I v. We can define the corresponding feasible schedule from the flow f as

W h e n the network is for the second model, we define

{boi-aihi Pi =

113

ifO<-hi
xij=f(Ji, For each interval Iv, a n o d e with label 1t is created. F r o m each job node Ji, an arc (Ji, It) of capacity A t is a d d e d if job Ji can be run on interval I t (that is, if r i < t I and d i > ti+1). W e create node t as the sink node. F o r m each interval n o d e I t to the sink node t, arc (1i, t) is a d d e d with capacity Arm. O u r problem is to find the m i n i m u m value of h or E A / w h o s e maximum flow value is E~Pi. Figure 1 is an example of 4 j o b s and

Ij)

for l < i < n

Since f(s, Ji) = E J ( J i , Ii), we have Pi = Eixii. In other words, the workload of job Ji can be done completely. Since Eif(Ji, Iv) = f ( I j , t) < m~l i, we have S, i x i i < m A i. This means that the total a m o u n t of workloads to be run on interval I i is less than the total available capacity. Suppose the capacities of m parallel processors on interval 1i are imagined as a continuous line in the range of

job

ai

bi

ri

di

1

2

9

0

5

2

2

9

2

9

3

1

7

4

10

4

2

8

5

10

m=3

2

6

and l _ < j _ < k .

2

Figure 1. An example for 4 jobs and 5 intervals

Y.L. Chen / Scheduling jobs to minimize total cost

114

[0,mAj], where range [0,Aj] denotes the capacity of processor Pl and range [rAi, (r + 1)Ai] denotes the capacity of processor Pr+ 1 for 1 < r < m -- 1. These capacities can be assigned to the jobs in the following way. Range [0,xij] is assigned to job Jl, and range [Ei:rXi/, ~ r+l ~,i=rXiy] is assigned to job J~+~ for 1 _< r _
f(Ji, I~)=xij

for 1 <_i<_n and 1 <_j<_k.

Since no job can be run on more than one processor simultaneously, we have f(Ji, Ij) = xij <_Aj. Since the workload of each job should be done completely, we have EyXij = Pi; hence we get Ef( i

S, J i ) = E i

Ef(Ji, j

Ij)=

EPi. i

Since the total amount of workloads to be run on an interval should be no more than the available capacity, we have E i x o < mAj; hence we get

Ef(Ji,

Ii) = f ( I/, t) < m k i.

i

Therefore, we have a feasible flow with flow value Egpg in the constructed bipartite network. [] From Lemma 1, we can find the corresponding optimum schedule if we have found the minimum value A* of A for the first model or we have found the optimum values A]~, A~. . . . . A* of A1, A2,...,A n for the second model. Therefore, the only problem is how to determine these values.

3. Solution m e t h o d for the first model

This section assumes that the processing requirement Pi = bi -

aih

if A < b i / a i

or

Pi = 0

if A >_ bi/a i

for all 1 _< i _< n. The problem now is to find the minimum value A* of A such that the maximum flow value is Y"iPi. An intuitive approach to find this value is by trying all possible values of A. For a given value of A, if the value of the maximum flow is less than Ei Pi, then we should increase the value of A, since doing this decreases the total processing requirement ~iPi" For a given value of A, if the value of the maximum flow is equal to Eipi, then we should decrease the value of A, since it is possible that there exists a value smaller than A whose maximum flow value is still Z.i Pi. After trying all possible values, we can find the smallest value of A whose maximum flow value is EiPi. Although the above approach can solve the problem, it is not an efficient method at all, because there are infinitely many possible values of A. In the following, we present an O(n 5) method to solve this problem. Basically, the algorithm contains two stages. In the first stage, we find those jobs whose processing requirements are equal to zero. Having found these jobs, they are removed from the job set. In the second stage, we try to determine the value A* for which the maximum flow value F is E~= 1Pi. If h >_b i a s , then the processing requirement Pi equals zero. Because we have n jobs, we can get n + 1 critical values c o <_C 1 ~ C2 ~_~ • " • ~ Cn by sorting the values O, b J a l, b2/a 2 .... , bn/a n into a nondecreasing sequence. If the value of A is equal to c r, then there are r jobs whose processing requirements are equal to zero. Suppose the maximum flow value F for A = c r is ET= l Pi, then we can try to decrease the value of A, since it is possible that there is a value smaller than h whose maximum flow value is E,"= l P , On the other hand, if the maximum flow value F for h = c r is less than Y~=lpi, then we should increase the value of h. After O(log n) tests in Co, c 1. . . . , cn, we have two possibilities. The first possibility is that the maximum flow value F for h = c o is equal to E~'=~p~. Then we are done and we can complete all jobs at no cost. The second possibility is that we find a value, say cr, from Co, c l , . . . , c n such that the maximum flow value F for h = c r is less than E~=lpi and the maximum flow value F for h = c~+ 1 is equal to E~'= ~p~. This result implies that (1) the jobs corresponding to the critical values c~, c 2 , . . . , c r have zero processing requirements, and ( 2 ) c ~ < h * _
115

EL. Chen / Scheduling jobs to minimize total cost

on this result, the jobs corresponding to cal values c~, c e . . . . , c r can be removed. loss of generality, we assume that the Ja . . . . . Jr are removed from the job set and now we enter into the next stage.

the critiWithout jobs J~, entirely,

Let f denote the maximum flow in the network N with A = c~+ 1. From the flow f and the original network N, we can construct residual network N ( f ) = (V, E l ( f ) 0 E 2 ( f ) , r), where E'(f)

v) < c ( u , v)

= {(u, v ) I f ( u ,

or f(~,, u) > 0} E 2 ( f ) = {(s, J i ) I r + 1
Adding flow f with flow g, we have

f + g ( s , Ji) = b i - a i c r + l +aiV =bi-ai(er+

1 - 17)

for r + l
g(s, Ji)=aiV

forr+l
The residual capacities of N ( f ) are defined as

r ( u , v) = c ( u , v) - f ( u , for (u, v) c E ' ( f )

v) + f ( v , u)

U Ez(f),

where c(u, v) is the capacity of arc (u, v) in network N. Since e(s, Ji)= b i - aiA for (s, Ji) ~ E 2 ( f ) , we have

r( s, Ji) = ( b i - Aai) - ( bi-aiCr+l) +0 =ai(Cr+ I --A).

In other words, the residual capacities on the arcs in E 2 ( f ) are linear functions of A. When the value of A is equal to Cr+ ~, the capacities of arcs in E 2 ( f ) are zeros. But, when the value of A is decreased, the capacities are no longer zeros. The following lemmas indicate that we can find the value A* from the residual network N ( f ) . L e m m a 2. In network N(f), let g be a flow with flow value ET= r + l a i 17 and satisfying

g ( s , Ji)=ai17

forr+l
where 0 <_ V < c, + 1 - Cr" Then f + g is a maximum flow in network N with A = c, + 1 -- 17" Proof. f + g must be a flow in network N. If not, then there must exist at least one arc (u, L') such that flu, v ) + g ( u , v ) > c(u, v) or flu, v ) - g ( v , u) < 0. According to the definition of the residual network, these two conditions are impossible to occur.

According to the definition of flow f , we have

f(s, Ji)=bi-aicr+ 1 forr+l
Proof. Since h - f is a feasible flow in residual network N ( f ) , we can let g = h - f . Since

h(s, J i ) = b i - a i ( c r + l - V

)

f o r r + l <_i<_n

and

f(s, Ji)=bi-aiCr+l

for r + l

<_i<_n,

we have

h-f(s,

Ji)=g(s, Ji)=ay

for r + l < _ i < _ n .

Therefore, g is a flow in residual network N ( f ) with flow value )Z'/_r+ tai V and g satisfies

g(s, Ji)=aiV

forr+l
[]

According to Lemmas 2 and 3, we see that the problem of finding the value A* can be solved by finding a maximum flow in N ( f ) subject to the constraints that g(s, Ji) = a y for r + 1 _< i < n. To solve this problem, we revise the residual network N ( f ) by removing node s and all arcs connecting to node s. In this revised network, we have n - r source nodes Jr+l, J , + 2 , ' " , J , , and one sommon sink t. All source nodes must send flows to the common sink node proportionally. That is, if source node Jr+l sends ar+ 1 units of flow to the sink node t, then source node Jr+~ must send ar+ i units of flow to the sink node for 2 < i _ < n - r. The goal of the problem now is to send the flow from the multiple source nodes to a common sink node in a proportional manner as much as possible. The problem stated above can be solved directly by using the result of Itai and Rodeh [10]. In their paper, they want to send the files from multiple source nodes to a common sink. They

116

Y.L. Chen / Scheduling jobs to minimize total cost

finally transformed this file transfer problem into a multiple-source one-sink maximum flow problem with the constraint that the amount of flow sent from each source node must be proportional with one another. For this flow problem, they proposed an algorithm of O(k I E II V 12) to solve it, where k is the number of source nodes, [ E l is the number of arcs and I VI is the number of nodes. Now, we analyze the time complexity of the algorithm. The first stage solves the maximum

flOW problem O(log n) times. Since the maximum flow problem can be solved in O(n 3) time [8,11], the time complexity for the first stage is O(n 3 log n). The second stage is to transform the parametric flow problem into a multiple-source one-sink network flow problem with the proportional flow constraint. As stated above, this problem can be solved in O ( k l E II V I 2) time. In our model, we have O(k) = O(n), O ( I V I) = O(n) and O(I E I) = O(n2), since we have at most 2n intervals. Therefore, the time complexity of the sec-

11

14

Figure 2. An exampleof transformation to min-cost flowproblem

Y.L. Chen / Scheduling jobs to minimize total cost

ond stage is O(n5). Adding the time complexities for the first stage and the second stage together, we have the total time complexity O(nS).

117

The cost on each arc is defined as follows:

w'(u, v) =0 if (u, c) in E 1 0 E 2 0 E 3 t.j {(Ik+l, t)},

w'(Ji, I k + l ) = l / a i f o r l < i < n . 4. Solution method for the second model

This section assumes that the processing requirement is

Pi = bi - aihi

if h i < bi/a i

Figure 2 shows an example of this transformation, where the upper figure is the original network and the lower figure is the constructed network. In the following, we prove this transformation is correct.

or

Lemma 4. There is a feasible flow with flow value

Pi = O i f h i > bi/ai,

En= l Pi in network N if and only if there is a feasible flow with flow value F~7 ;b i and total flow cost ~ _ tAi in network N'.

for 1 < i < n . The problem now is to find the optimum values of h l, h 2 , . . . , h n such that the value E;A; is minimum among all flows with maximum flow value equal to ]g~'=1Pi. To this end, we construct another network from the original network in Section 2. Let N = (V, E, c) be the network constructed in Section 2 with node set V = {s} O J o l o {t} and arc set E = E 1 0 E 2 0 E3, where

J = {J,, J2 . . . . . Jn}, E l = { s } ×J,

Proof. Let f be a feasible with flow value Y'.~'=l Pi in network N. From f , we can define another flow g in network N ' in the following way:

g(u,~)=f(u,v)

if(u,c)

g(Ji, Ik+l)=aiAi

forl
I = {1 l, I 2 . . . . . lk}, Ez=J×I ,

E 3 =I×

for 1 < i < n ,

g(s, Ji)=b i

= b;-y(s,

g(Ik+l, t ) = ~ g ( J i ,

bi - aih i

0

J;),

{t}.

For each arc (u, c) in E 2 or E3, a nonnegative capacity value c(u, v) is associated with it. For each arc (s, Ji) in E 1, the associated capacity is

Pi =

in E e O E 3,

if 0 ~_~h i < b i / a i , if h i >_bi/a i.

From the network N, we construct another network N ' = (V', E ' , c', w') with node set V' = {s} oJol'o{t} and arc set E ' = E 1 U E ~ O E ~, where

From the definition of network N ' , it is clear that flow g is a feasible flow in N ' with flow value ~_.,n=lbi and total flow cost E~= l h i • Suppose flow g is a feasible flow in N ' with flow value En=lb/ and total flow cost ET=tA;. Since w'(Ji, Ik+l) = 1/a i for 1 < i _ < n and w'(u, v) = 0 otherwise, we have ~g(Ji,

l k + l ) / a i = ~_,A i .

i-I

l'=IO{Ik+,},

Ik+l).

i=1

(1)

i--1

Since c'(Ji, Ik+l)=bi for 1 < i < n , we have

E ~ = E 2 0 {( Ji, Ik+l)ll
if(u,v)

(2)

From (1) and (2), we can let

The capacity function in N ' is defined as follows:

c'(u,v)=c(u,v)

O < g ( J ; , I k + l ) / a ~ < b i / a i for l < i ~ n .

in E 2 0 E 3 ,

h i = g ( J i , lk+l)/a i f o r l < i < n .

c'(s, J i ) = b i for 1 < i < n ,

From flow g, we can define a feasible flow f in network N in the following way:

c'(Ji, I k + l ) = b i for 1 < i < n ,

f(s, Ji)=bi-u(Ji,

C'(Ik+l, t) -= ~ b i. i=1

Ik+l)

for 1 < i _ < n ,

= bi -- aihi = P i ,

f(u,v)=g(u,v)

if(u,v)

in E 2 U E 3.

EL. Chen / Schedulingjobs to minimize total cost

118

Since k+l

g(Ji, Ii)=g(s, Ji) =bi

and

j-1 f(Ji, Ij)=g(Ji,

Ii)

for 1 < j < k, we have k

Y'~f(Ji, Ij)=bi-g(Ji, Ik+l) =f(s, Ji)" j=l

(3)

Since

~g(Ji, Ij)=g(Ij, t)

and

f(u, v) =g(u, v)

i=1 for (u, v) in E 2 W E3, we have

~f(J~,Iil=f(Ij, t ).

(4)

i=1

From (3) and (4), we see that the conservation constraints of flow f are satisfied. Besides, it is easy to see that the capacity constraints are also satisfied. Hence, flow f is a feasible flow in network N. Finally, since the flow f is defined as f(s, J,) =Pi for 1 < i < n, it can be seen that the total flow value is Y'.~'=1Pi. [] From Lemma 4, the problem can be solved by finding a minimal cost flow with flow value E~'=lbi in network N'. Since this is a conventional minimal cost flow problem and since the algorithm of Galil and Tardos [5] can solve the minimal cost flow problem in a time of O ( I V I 2 ( I E I + Ilog I V I) log I V I), where I V I is the number of nodes and I EI is the number of arcs, the problem can be solved in O(n 4 log n) time.

mize the value of A. For the second model, an O ( n 4 log n) algorithm is proposed to minimize the value of ET=IAi. The extended model has some advantages as compared with the original scheduling model: (1) The new model allows that one part of a job is done by one's own equipment but another part of a job is made by outside manufacturers or purchased from suppliers. (2) The new model not only tries to meet the requirements on the time factors but also tries to minimize the cost. In the original model, one only tries to find a feasible schedule for the problem. From these two advantages, it can be seen that the current model is more reasonable than the previous one. This paper has a variety of possible extensions in the future. One example is to classify all n jobs into r classes. Two jobs in the same class are highly correlated and two jobs in different classes are highly independent. Therefore, the processing requirements of all jobs in the same class are determined by the same parameter but jobs in different classes are influenced by different parameters. In this sence, the first model of this paper is the special case of r = 1 and the second model is the special case of r = n. The second example of possible extension is to include more attributes which can affect the processing requirement of a job into the model. Therefore, we may assume that the processing requirement of each job Ji is a function Pi = ci- biA- ai°" or something else. The third example of possible extension is to set an upper bound of cost we want to pay. Under this cost constraint, we seek a schedule which minimizes the time of the schedule.

5. Conclusions References

In this paper, the famous scheduling problem of preemptively scheduling a set of n independent jobs with release times and deadlines to m parallel identical processors is extended by adding the consideration that the processing requirement of each job is a function of cost, and the extended goal is to use the least amount of cost (i.e., the minimum value of A or E~'=IA;) to complete all jobs by their deadlines. For the first model, an O(n 5) algorithm is proposed to mini-

[1] Baker, K.R., and Scudder, G.D., "Sequencing with earliness and tardiness penalties: A review", Operations Research 38 (1990) 22-36. [2] Blazewicz, J., "Selected topics in scheduling theory", Anuals of Discrete Mathematics 31 (1987) 1-60. [3] Chang, R.S., and Lee, R.C.T., "On a scheduling problem where each job can be executed only by a limited number of processors", Computers of Operations Research 15 (1988) 471-478. [4] Chen, Y.L., "An improved algorithm for scheduling jobs on heterogenous processors", presented at National

Y.L. Chert / Scheduling jobs to minimize total cost

Computer Symposium, Chung-Li, Taiwan, ROC, 1991, 172-177. [5] Galil, Z., and Tardos, E., "An O(nZ(m + n log n)log n) rain-cost flow algorithm", in: Proc. 27th Annual Symposium on Foundations of Computer Science, 1986, 1-9. [6] Graham, R.L., Lawler, E.L., Lenstra, J.K., and Rinnooy Kan, A.H.G., "Optimization and approximation in deterministic sequencing and scheduling theory: A survey", Annals of Discrete Mathematics 5 (1977) 287-326. [7] Gonzales, Jr., M.J., "Deterministic processor scheduling", Computing Surveys 9 (1977) 173-204.

119

[8] Gusfield, D., Martel, C. and Fernandez-Baca, D., "Fast algorithms for bipartite network flow", SIAM Journal on Computing 16 (1987) 237-251. [9] Horn, W., "Some simple scheduling algorithms", Naval Research Logistics Quarterly 21 (1974) 177-185. [10] Itai, A., and Rodeh, M., "Scheduling transmissions in a network", Journal of Algorithms 6 (1985) 409-429. [11] Kumar Malhtra, V.M.P., and Maheshivari, S., "An O(IVI 3) algorithm for finding maximum flow in networks", Information Processing Letters 7 (1!)78) 277-278.