Volume I, Number 2
SCHEDULING
OPERATIONS RESEARCH LETi'ERS
SUBJECT TO NONRENEWABLE-RESOURCE
April 1982
CONSTRAINTS
J, C A R L I E R Unttwrsit~ de Pierre et Marie Curie, 4 Place Jussie~ 75230 Paris C~lex 05, France A.H.G. R I N N O O Y K A N IEconometri~ [nstituut, ErasnlW Universi~, P.O. Box 1738, 3000 DR Rotterdam, The Netherlands Received July 198I Revised January 1982 Polynomially bounded solution methods are presented to solve a class of precedence constrained scheduling problems in which each job requires a certain amount of nonrenewable resource that is being consumed during its execution. Scheduling, polynomial time algorithm, nonrenewableresource
I. lntnNluetton In resource constrained schedulin& the problem is to allocate scarce resources over time in such a way that a set of jobs, every, one of which requires certain quantities of each resource, can be scheduled for execution in an optimal fashion, In this paper, we shall be dealing with schedulins problems involvins one or more resources that are nonrenewable [$], in the sense that they are actually beins consumed by the jobs usins them. Money or fuel provide natural examples of such resources, More specifically, suppose that a schedule has to be
commu:ted to execute njo~&,.,.,~.. Job~ ( j ~ = { I,...,n}) requires pj time units of pmcessin£ time; for each job, a continuous nondecreasins cost function fj(t) is 8ive~, indicatins the cost incurred if ~ is completed at time t (as a function of t). For certain pairs of jobs (JpJ~) nonnesative constants q~k are siven that define precedence comtmints of the form
s, ~,c, +q,k,
(I)
where ~ is the starting time of a job '/7 an~ , = S7 + pj is its completion time. Moreover, job Js requires an amount equal to a~ units of nonrenewable resource which is to be available at time Ss ( j E ~); this umol,nt is consumed durin8 the execution of the job. Initially, at time 0, the number of available units of resource is 0. At siren times T~ ( i E g - - { I .... ,m}), an
52
additional quantity of b~ units of resource becomes available. The objective is to find starting times Ss and comple~on times Cs for ~ ( j • ~) such that the resulting schedule is feasible with respect to the precedence constraints (I) and the nonrenewable resource constraints, and such that the maximum cost maxs(~(Cs) } of the schedule is minimized. In Section 2, we show how the resource constrained problem stated above can be solved by an efficient (polynomially bounded) al$orithm in the case that ~(t) = t for all j, so that the optimal schedule in fact minimizes the time by which all jobs are completed. In Section3, we show how to extend this method if in addition to the above constraints job ~ ( j E ~.) has to be completed not later than a deadline d s. Subsequently, in Section4, an efficient method is described to solve the problem for arbitrary cost functions. All methods can be easily extended to the case of multiple nonrenew. able resources and to various other generalizations of the problem. As soon, however, as we allow for the possibility that certain jobs produce rather than consume quantifies of the resource, the problem becomes much more difficult: in Section 5, we show that the simple version in which a s E ( - I, + ! } ( j E ~.) already becomes NP. /lard [4], so that a polynomially bounded algorithm for its solution is unlikely to exist. We also show that the problem becomes NP-hard as well if the objective is to ~ e total cost rather than maximum cost, even in the simple case that fs(t)= t for allj. 0167-6377/82/0000-0000/$02.75 © 1982 North-Holland
Volume I, Number 2
OPERATIONS RESEARCH LETTERS
2. A imlynomially bounded dgorithm to minimize the maximum completion time A natural way to represent the scheduling problem described in Section i is by means of a directed acyclic graph G = ( V , A ) with vertex set V= {0, l,...,n, • ). For every precedence constraint (l), there is a directed arc ( j , k) E A with weight ~k = P~ + q~. In addition, A contains directed arcs or weight 0 from vertex 0 to vertexj and of weight p/t~'om vertexj to vertex • for all In the absence of resource constraints, the earliest time t, by which all jt~bs can be finished is equal to the weight of a max}~.~alweight or critical path in G from 0 to ,; it can be calculated recursively as t o ~- O,
t~-max{t~+w~,l(j,k)~A)
(k=l,...,n, ,).
Co.~versely, if all jobs. have to be finished at time t,, the latest possible time t1 by which Jj can start ( j ~ ~) is given by /,=t,, ~ - rain{i,
-wj, l(j,k)~A }
(k = n , . . . , l , 0 ) .
April 1982
Hence, the problem in this section is to find the smallest 8 such that
B(t)>A,(t) (t=0,...,t, +8).
(9)
Ao(t ) and B(t) are both stepwise increasing functions of t. This suggests that the minimum value 8" of 8 is equal to the m/nimum amount.by which the graph of Ao(t) has to be shifted to the r i o t so as to be completely dominated by the 8raph of B(t). More formally, let'i(_j) be the index of the smallest Tj such that B(Tj) > Ao(tj). Then it is not difficult to verify that
The proof is left to the reader. Let us determine the computational requirement of the procedure to calculate 8'. G has been ass~med to be acyclic, so that the values t"( j E ~) can be calculated in O(]A I) time. The sets (QI J ~ ~ } and (T11i ~ ~) are then sorted in O(n log n + m log m) time, so that i', ,~ I"2 • .. <,[,,and 7', ~T2 < .." < T,,. Next, Ao(~) ( j E ) ) and B(T~) ( i E ~) are calculated in O(n + m ) time. I~ B(T,,)
O) In this section, the objective will be to minimize the maximum completion time, i.e., the time by which all jobs are completed. Thus,/~(t)- t for all j. If in this case the maximum completion time is fixed to be equal to t. + 8 for some 8 > 0 we may assume without loss of seneral/ty - in view of the cumulative character of the resource constraint - that each job starts as late as possible. It follows easily that under this assumption the starting time of ~ is s/yen by
3. The eme of demllines Suppose that a deadline d7 has been specified for ( j = I,..., n), and that the schedulins problem defined in Section 2 is modified to include the constraint that each job has to be completed before its deadline:
cj , dj (1= I,...,,).
(If)
and the total amount of resource available at time t is given by
We shall show how the procedure given above to minimize the maximum completion time can be extended to take these extra constraints into a.~count. The basic idea, as before, is to shift the graph of Ao(t) to the right until it is completely dominated by the 8raph of B(t). In the current case, however, a job Jj may run into its deadline during the shift. Whenever this happens, is scheduled to be completed at d / a n d removed from the problem, the resource supply and demand are suitably reduced by aj and the shift continues. We note that the schedule resulting from this proce dure will be feasible with respect to the preceder,~.~ constraints only if
B(t) =~ {b, li~(t)).
d r ,~ m i n ( d , - p , - q ~ l ( / , k )
sj=
+a.
(4)
If we define
~.,(t) = {Jl~ +8
(5) (6)
then the total amount of resource required up to time t as a function of 8 is given by
A (t)
(7)
(8)
eA) (1~).
(12) 53
Volume I,.Number 2
OPERATIONS RESEARCH LETTERS
April 1982
If this inequality is not satisfied initially, the due dates can be adjusted accordingly without changing the prob-
4. The case of arbitrary cost functions
lain, in o(I,4 I) time. (13)
We now assume that the ~(t) are arbitrary continuous nondecreasing cost functions. Let us note first that a threshold T on the value of the objective function, i.e. Ij(Cj)
(~4)
induces a deadline dj(y) before w h i c h / j has to be completed if the threshold value is to be achieved by the schedule.
For a precise description, consider the critical values St,...,8,, of 8 defined by
-I-pj +~ =dj (j----'l,...,n), i.e.,
=d,-~ -pj (j= l.....,) and let the permutation w be such that
d.(v)=**,
Suppose that the optimal value 8" subject to the additional constraints (I I) is Suassed to satisfy
S.., <8' , ~ , + , ~ .
(is)
It is easy to see that in that caseJ,,(,),...,J,,o) will all be completed exactly on their deadline. Hence, these jobs can be removed from the problem:
~.:= ~.- (,(l),....,(i)). ,4o(t) :=,Co(t) - ~ (a,(~)l i
(16) (17)
provided that the resource supply is reduced appropriately as well:
• (,):= mi~..,{~(,) - ~ (a,,(,dI"j~i,d,(,,-p,,,,,
(18)
m)) = o(I,41 +n los,, + m los m) time. Hence, deadlines can be incorporated without an increase in computalionel complexity, We note that another variation on the problem of the previous section, the minimization of maximum lateness = t - d p can be solved by similar reasoning
in 0(IAI +n los n + m los m) time as well. 54
(~0)
min{d,(y')-p,-q,,l(j,k)EA)
}.
These values are not necessarily intoser, and hence we cannot simply apply the procedure of the previous section to the induced deadlines in order to obtain a polynomially bounded binary search procedure for the optimal value y*. However, if we define U(j) to be the set of all successors ofj in G = (F, ,4) (excludinl~ .) and Wjk to be the weigitt of the maximal weight path in G between j E gand k E U(j), the problem can be reformulated as follows: find the smallest value of ¥ such that the followin$ m inequalities are satisfied:
•..{aAdj('r)-p,
The set g can be adjusted to contain only the indices i such that B(t) chanSesvalue at T,. We now apply the procedure of the previous section to calculate 8* with respect to this new problem. If the above suess was correct, 8" will indeed satisfy (IS). If 8" ~;8,~,), then the guessed value has been too h i ~ , if 8" >Sw,+, ) (or if B(TI~i)
wh~(t)
dj(~)- mi.{~-'(~),
which can be rewrittenas
-
(B(T~)
k
u(j)} }.
(i= I,...,m).
(22)
Define
y,j -- max{/j(T~ +p,),
max(A(T,+p,÷W,,Ik~U(j)}}.
(23)
Then the problem amounts to findin$ the smallest value of 7 such that
(a,I v';~o) .~,e(~)
(24)
for i = i,...,m. The function G~(7) = y~(a~[7 "; 7,j } is a stepwise 'nonincreasing function of 7. For fixed i, the smallest value y~* for which (24) is satisfied can be found by a median findin$ procedure [2]: we first test the median value of the Yu (J = I,..., n), if that value is too larse (too small), we repeat on the group of ½n smallest" (largest) ¥o, etc. This takes 0(n -4-½n+ In + . . . ) =
Volume I, Number 2
OPERATIONS RESEARCHLETTERS
O(n) time for each i. and O(mn) time overall. The optimal value 7" is equal to maxi(7~*). Since y~j has to be calculated for all pairs (i,j), the overall running time of this procedure is O(nJAJ 4. mn 2) (O(mn) in the case without precedence constraints). If the same approach is used on the special case treated in Section 2, a running time of O(IAI +n log n + mn) is obtained, which is better than the time reported there if n - o(log m). Certain relations between the values ¥~j are not exploited in the above calculations (e.g., ?~j yj+ ~,j and Yo ~ YJ* if (j, k ) E A), so that better running times may in fact be possible.
April 1982
precedence constraints, by setting Pi = I and a~ = K + n + 1 4-cj ( j E a3L), and setting qjk = 0, and by choosing m = n = ] ~ I, T ~ = / - I ( i = i , . . . , m ) , b , = K + ( K + n + l), b~ = . . . =b,, = K + n + !. We claim that there exists a feasible schedule for CCS if and only if there exists a resource feasible schedule for the above problem with ~-~=,~(Cj)= N~= iCj ~ ½n(n4.I). To see why this is true, note that in each interval (0, i) (i = I,..., n - I) no more than i jobs can be started. Indeed, if a subset (Jj,,...,J~,+,} would be started, this would require ,~ i+l
Y. S. Coxlwlin8 reminds The solution approach described in the three preceding sections can easily be extended to cover various other generalizations of the scheduling problem considered, such as the case that the number of resources is larger than one or that the jobs become available at diffment release dates instead of simultaneously at time 0. However, if the problem is extended to include the possibilhy that a job produces rather than consumes an amount of resource, the change is far more dramatic: even if a~ ( j E ~) is restricted to be either - i or +1, the problem becomes NP-hard and hence unlikely to be solvable in polynomial time. To see why this is the case, consider the following problem:
Cost Constrained $chedulin 8 (CCS): Given a set of precedence constrained tasks (~l J E ~ ) with a cost cj E ( - I; + I ) being attached to ~ (j E ~ ) , and a constant K, does there exist a feasible schedule such that the total cost of all jobs scheduled before (includini~ ~ itself) does not exceed K for allj E °'3/,7 It is e~uily seen that the above problem is a special case of the resource constrained problem with a / E ( - i, + i ), in which K units of resource become available at 7', - 0 . Since the problem above is known to be (unary) NP-complete [I], it follows immediately that the extended version of our scheduling problem is (unary) NP-hard. The same reasoning can be applied to show that the minimization of total cost, subject to nonrenewableresource constraints, is fikely to be inherently more difficult than the minimization of maximum cost, even in the simple case that fj(t) -- t for all j. More precisely, given an instance of CCS, we construct a resource constrained problem by having ,/j correspond to ~ ( j = l,...,J~/,J) subject to the same
(2S)
b--I
units of resource, while the amount available for that period is only g+i(K+n4- ! ) - ( i + I)K+~n+i. (26) Hence, the contribution from the ith job that is started, to ~ = ,C~ is at least equal to i for every feasible schedule, and the threshold value ½n(n + I) can be achieved only if there exists a f-.asible schedule such that the i th j o b is completed exactly at time i (i = I,..., n). But such a schedule for the ,/j corresponds to a cost feasible schedule for the ~ , and vice versa. Related complexity results in [3] confirm that, indeed, the problems dealt with in Sections2, 3 and 4 appear to be the only ones in this class for which efficient solution methods can be found. Acknowled8ment ,,
We are grateful for useful suggestions by R. Faure, B. Lemaire, J.K. Lanstra and J. Weglam.
References
"
[I] H.M. Abdd-Wahab, "Scheduling with applications to regislet allocation and deadlock problems", Ph.D. thesis, Universify of Waterloo (1976). [2] A.V. Aho, J.E. Hopcroft and J.D. Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley,Reading, MA (1974). [3] J. Curlier, "Complexit6 des probl~mesd'ordonnancementsh contraintes de financement", Working paper, Universit6 de Pari~ Vl (1980). [4] J.K. Lenstra and A.H.G. Rinnooy Kan, "Computational complexity of discrete optimization problems", Ann. Discrete Math. 4 (1979) 281-300. [S] R. Slowinski,"Multiobjective network schedulingwith efficient use of renewable and non.renewableresources", Techn/cal Paper, Institute of Control Engineering, Pozntm, Poland. 55