On the minimum number of resources for a perfect schedule

In the single-processor scheduling problem with time restrictions there is one main processor and B resources that are used to execute the jobs. A perfect schedule has no idle times or gaps on the main processor and the makespan is therefore equal to the sum of the processing times. In general, more resources result in smaller makespans, and as it is in practical applications often more economic not to mobilize resources that will be unnecessary and expensive, we investigate in this paper the problem to find the smallest number B of resources that make a perfect schedule possible. We show that the decision version of this problem is NP-complete, derive new structural properties of perfect schedules, and we describe a Mixed Integer Linear Programming (MIP) formulation to solve the problem. A large number of computational tests show that (for our randomly chosen problem instances) only B=3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$B=3$$\end{document} or B=4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$B=4$$\end{document} resources are sufficient for a perfect schedule.


Introduction
In the single-processor scheduling problem with time restrictions (STR), there are n independent jobs J 1 , . . . , J n (or 1, . . . , n) with positive integer processing times (or job lengths) s j , j ∈ {1, 2, . . . , n}. The jobs have to be processed non-preemptively on a single processor (note that the processor could be a computer processor or a person/worker who operates resources/machines Trier University of Applied Sciences, Environmental Campus Birkenfeld, 55768 Birkenfeld, Germany π = (π 1 , π 2 , . . . , π n ) of the jobs with corresponding processing times p 1 , p 2 , . . . , p n , completion times C 1 , C 2 , . . . , C n , makespan C max = C n and the following property: The initial job π 1 starts at time 0 and completes its processing at time p 1 . For k ≥ 2, job π k starts no earlier than job π k−1 has completed its processing, and possibly later as the following constraint must always be satisfied: Each job requires the use of one of B identical additional resources that have to be renewed in α time units after the processing of a job has been finished and before they can be used again (Braun et al. 2014).
Because of its general formulation, this model is widely applicable. The renewal time of the resource reflects that it has to be cleaned, transported to another place, cool down, refilled, re-loaded, updated, etc. A practical application can be found in a production environment in which one main machine can use several resources that must be cleaned etc. after their usage. Another application would be, for example, one or more team members who can work on a project for a certain amount of time and then are locked out until they can be reassigned to a new project.
From the constraint above it follows that 1. At most B jobs can be processed during any interval [x, x + α)∀x ∈ R ≥0 , and that 2.∀x ∈ R ≥0 , the interval [x, x + α) can intersect at most B jobs.
The following example with n = 4 jobs J 1 , J 2 , J 3 , J 4 , processing times s 1 = 6, s 2 = 4, s 3 = 2, s 4 = 4 and renewal times α = 10 is given for better illustration. Figures 1 and 2 present two feasible schedules for B = 2. As an example, in Fig. 1, resource R 1 is occupied by job J 1 from timepoint 0 to timepoint 6 and has to be renewed afterwards which takes 10 timeunits until timepoint 16. In order to schedule job J 2 immediately after J 1 we need another resource R 2 which is occupied by J 2 from timepoints 6 to 10 and which has to be renewed afterwards from timepoint 10 to timepoint 20. It follows that we have a gap on the main processor from timepoint 10 until timepoint 16. The schedule (1, 2, 3, 4) is not optimal with respect to minimzing the makespan, whereas the schedule (3, 2, 1, 4) is an optimal schedule with makespan C * max = 22 (on the main processor).   (1,2,3,4) with n = 4 jobs, B = 2 resources R 1 , R 2 , renewal times α = 10, and makespan C max = 24

Fig. 2
Schedule (3, 2, 1, 4) with n = 4 jobs, B = 2 resources R 1 , R 2 , renewal times α = 10, and optimal makespan C * max = 22 0  2  6  12  16  22  26 Fig. 3 Perfect schedule (3, 2, 1, 4) with n = 4 jobs, B = 3 resources R 1 , R 2 , R 3 , renewal times α = 10, and optimal makespan C * max = 4 j=1 s j = 16 It is obvious that in the STR-problem more resources lead to smaller (or at least not larger) makespans and that never more than n resources are necessary to schedule the jobs on the main processor without any idle times (or gaps). In this paper, we investigate the question how many resources are needed at most (in the sense of a supremum) for such a perfect schedule (Braun et al. 2014). We call this problem the STR-Bproblem. The idea behind this problem is that in practical applications it is often more economic not to mobilize resources that will be unnecessary and expensive (Rustogi and Strusevich 2013). This kind of question arises as well in scheduling problems with no-wait constraints, e.g. Ruiz et al. (2009).
To continue with our introductory example, it turns out that only B = 3 resources are necessary for a perfect schedule (3, 2, 1, 4) with makespan C * max = n j=1 s j = 16 (Fig. 3).
Another example with n = 10 jobs, processing times 7, 14,19,25,27,31,38,38,49,71 and renewal times α = 100 has the following optimal makespan values for a different number of resources: C * max = 570 (B = 2), C * max = 373 (B = 3), C * max = 319 (B = 4). The optimal makespan values decrease with an increasing number B of resources until C * max reaches for B = 4 the value of the sum of the processing times 10 j=1 s j = 319, i.e. for B = 4 there is a perfect schedule that has no gap (or delay) on the main processor.
The single-processor scheduling problem with time restrictions (STR) was at first studied by Braun et al. (2014Braun et al. ( , 2016. The authors show that the decision version of the STR-problem is NP-complete when the number of resources B is part of the input and therefore possibly arbitrarily large. They analyze the worst-case behaviour of List Scheduling (where the jobs are scheduled in an arbitrary permutation) and prove that for B = 2 the best possible worst-case factor of List Scheduling is 4 3 of the optimum (plus the additional constant 1), and that for B ≥ 3, the best possible worst-case factor is equal to 2− 1 B−1 of the optimum (plus the additional constant B/(B −1)). Moreover, the authors analyze the Longest-Processing-Time-first (LPT)-algorithm, where the jobs are ordered non-increasingly and show that LPT-ordered jobs can be processed within the best possible factor of 2 − 2/B of the optimum (plus the additional constant 1 2 for B = 2 and 1 for B ≥ 3).  show independently the same bound for B = 2. Moreover, they provide an approximation algorithm for B ≥ 3 that achieves the factor 3 2 plus the additional constant 2 for B = 3, the factor 4 3 plus the additional constant 2 for B = 4, and the factor 5 4 plus the additional constant 2 for B ≥ 5.  prove that the decision version of the STR-problem is even NP-complete for B = 2 and they describe a Polynomial Time Approximation Scheme (PTAS) for any fixed value B ≥ 2. Benmansour et al. (2018) propose Mixed Integer Linear Programming (MIP) formulations, based on a time-indexed formulation and based on an assignment and positional date formulation, to solve the STR-problem and they prove that the decision version of the STR-problem is NP-complete even for B = 2. Benmansour et al. (2019) present two algorithms, namely Variable Neighborhood Search (VNS) and Fixed Neighborhood Search (FNS), for the approximate solution of the STR-problem.
There is an interesting connection between the single-processor scheduling problem with time restrictions and the parallel machine scheduling problem with a single server (PSS, P, S1 | s i , p i | C max ) (Benmansour et al. 2018;Kravchenko and Werner 1997). In PSS, s i is the setup time to load a job i on a common server, and p i is the processing time of that job. The server and the processor are both occupied during the loading operation. STR and PSS are in fact equivalent problems: The setup times of PSS are equal to the processing times of STR (it might well be that in a practical application some jobs need more or less time than others to be ready for being processed), and the processing times of PSS are equal to the renewal times of STR (which is a constant α in this case). Therefore, our analysis gives also an answer to the following question: How many parallel machines do we need at least to construct a schedule of the jobs that has no idle times on the single server?
The remainder of the paper is organized as follows. In Sect. 2 we prove that the decision version of STR-B is NP-complete by reducing the decision version of (the known NP-complete problem) STR to the decision version of STR-B. In Sect. 3, we develop structural properties of perfect schedules, and we present a Mixed Integer Programming (MIP) formulation to solve the STR-B problem. Section 4 presents computational performance tests of the MIP. Finally, in Sect. 5 we give a conclusion.

The decision version of STR-B is NP-complete
It is easy to see that in the worst-case, there must be n resources available in order to schedule the jobs without gaps on the main processor. As an example: When the sum of the n − 1 largest processing times is less than α, then n − 1 resources are not sufficient and we need as many as n resources for a perfect schedule. From a computational complexity point of view, STR-B is not harder than STR as STR-B can be solved by solving at most log n + 1 instances of the STR-problem: We just have to perform a binary search to determine the smallest B such that the makespan of the solution to the STR-problem is equal to the sum of the processing times. Note that the optimal makespans for an increasing number B of resources are non-increasing.

Theorem 1
The decision version of the STR-B-problem (given n processing times s j , j = 1, . . . , n, with S = n j=1 s j , the renewal time α of the resources, and a number B of resources, is there a feasible schedule with a makespan C max = S?) is NP-complete.
Proof STR-B is obviously in NP: Given B and a schedule π , i.e. a permutation of the jobs, it is in polynomial time possible to check that the jobs can be scheduled without gaps on the main processor using at most B resources. The decision version of the STR-problem is as follows: Given n processing times s j , j = 1, . . . , n, the number B of resources, the renewal time α of the resources, and a makespan C max , is there a feasible schedule with a makespan not larger than C max ? It is known to be NP-complete (Benmansour et al. 2018). We want to show that STR ∝ STR-B: Given an instance of STR-B, we ask if it is possible to schedule the jobs without any gap on the main processor with B resources. The only way to answer this question is to solve STR. Conversely, given a solution to STR that uses B resources and has no gaps on the main processor yields immediately to a solution to STR-B (we would possibly and in the worst-case have to solve log n + 1 instances of the STR-problem as described above). Since STR-B is in NP, since the input for STR-B can be computed in polynomial time from the input for STR, and since we can reduce the NP-complete problem STR to STR-B, STR-B must also be NP-complete.
As a remark, Braun et al. (2014) show that the decision version of STR (when the value B is variable) is NP-complete through a reduction of PARTITION to the special case of STR where there is a perfect schedule.

MIP formulation
We start with a useful property of perfect schedules.
Theorem 2 There is always a perfect schedule where the two jobs with the smallest processing times are scheduled at the beginning and at the end of the schedule.
Proof We assume w.l.o.g. that J n−1 and J n are the jobs with the smallest processing times s n−1 and s n and claim that there is always a perfect schedule with a permutation (n − 1, π 2 , . . . , π n−1 , n). Imagine a perfect schedule π where the first B − 1 jobs have a sum of processing times ≥ α and use only B − 1 resources. We can construct another perfect schedule π by using the B th resource for processing another job in the beginning. This resource will be available again after α time units. Therefore scheduling this new job at the very beginning will not cause any delay. The same is true for the last B −1 jobs in a perfect schedule. Again, we can use the Bth resource for another job. It follows that there is always a perfect schedule where the two smallest jobs are scheduled at the beginning and at the end of the schedule.
Next we describe a necessary and sufficient condition for a perfect schedule with B resources.
Theorem 3 Necessary and sufficient conditions for a perfect schedule π = (π 1 , π 2 , . . . , π n ) with processing times p 1 , p 2 , . . . , p n and B resources are: Proof If C i + α would be greater than C i+(B−1) , then there would be a gap in the schedule. This observation leads to the following necessary conditions for a perfect schedule: C i + α ≤ C i+(B−1) ∀i ∈ {2, . . . , n − (B − 1)}. From this it follows immediately that the following constraints must be satisfied in a perfect schedule: i+B−2 k=i p k ≥ α ∀i ∈ {2, . . . , n − (B − 1)}.
Note that p 1 + p 2 + p 3 and p 8 + p 9 + p 10 can be smaller than α as the corresponding jobs are scheduled at the beginning and at the end of the schedule.
Another useful observation is about the number of jobs that must have a certain length to build a perfect schedule.
Proof Let J n−1 and J n be the two jobs with the smallest processing times s n−1 and s n . We observe that in a perfect schedule π (where we put J n−1 in the front and J n at the end of the schedule), all of the other jobs must fulfill the following property: Always B − 1 processing times of adjacent jobs have to sum up to at least α. In a perfect schedule for B resources, by the pigeonhole principle, in each of the inequations (1) from Theorem 3, at least one job has to have a processing time that is ≥ α B−1 . As we can schedule the two smallest jobs at the beginning and at the end of a perfect schedule (Theorem 2), it remains that in a perfect schedule at least n−B B−1 jobs have processing times ≥ α B−1 .
In our example for Theorem 3, we see that there are n−B B−1 = 10−4 4−1 = 2 jobs, namely p 4 and p 7 with processing times p j ≥ α B−1 = 1000 3 . As a result, before starting the MIP, we check if the necessary conditions from Theorem 4 for a perfect schedule for B = 2 are fulfilled. If yes, this gives the lower bound l on the number of resources that are needed. Otherwise, we increase B by 1 and continue until we found a lower bound (Algorithm 1).
An upper bound is obviously u = n as there might be as many resources as there are jobs necessary to construct a perfect schedule (see the example in Sect. 2). However, Algorithm 1 Algorithm to determine a Lower Bound l on the number of resources for a perfect schedule. 1: procedure LowerBound(n, p 1 , . . . , p n , α) 2: l := 2; 3: while number of jobs with processing times ≥ α l−1 is smaller than n−l l−1 do 4: l := l + 1; there might be tighter upper bounds possible. We did not investigate this question further, but we decided to use u as a parameter in the MIP. The resulting MIP formulation to solve the STR-B-problem is given in Fig. 4. The objective function (1) minimizes the number of B of resources that are necessary for a perfect schedule. Since the value of B is not known in advance, we introduce the binary variables y b such that B = u b=l by b , where l is the lower bound (determined by Algorithm 1) and u is the upper bound (we chose u = n) on the number of resources that are needed for a perfect schedule. Constraint (2), u b=l y b = 1, assures that B equals exactly one value (the minimum number of resources that are necessary to find a perfect schedule) out of the possible values {l, . . . , u}. It assures that exactly one of the binary variables y l , . . . , y u is equal to 1.
The binary variable x jk corresponds to the assignment of job j to position k (i.e., x jk = 1 if and only if job j is assigned to position k). Note that in a perfect schedule, we can place the two jobs with the smallest processing times (w.l.o.g. J n−1 and J n with processing times s n−1 and s n ) to positions k = 1 and k = n so that π 1 = n − 1 and π n = n with p 1 = s n−1 and p n = s n (Theorem 2). We then have to decide at what positions 2, . . . , n − 1 to place jobs J 1 , . . . , J n−2 in the optimal permutation π . Therefore the job index variable j always runs from 1 to n − 2 and the position variable k always runs from 2 to n − 1.
Constraints (3) and (4) state that each job is assigned to only one position and that each position is assigned to exactly one job.
The constraints from inequalities (1) Constraints (6) and (7) ensure that z b jk will be zero if either x jk or y b are zero. Constraints (8) make sure that z b jk will take value 1 if both binary variables x jk and y b are one.
The variables y b , x jk , z b jk are defined as binary variables in constraints (9).

Computational tests
In this section, we describe the results of the computational tests for the MIP. The meaning of the parameters are explained in Table 1. We used an Intel i7 1.8 GHz processor with 16 GB RAM and IBM ILog CPLEX 20.10 using default settings. It is obvious that the number of resources for a perfect schedule are smaller when α is small in comparison to the processing times. Therefore, we restricted the processing times of the jobs to be generated from a discrete uniform distribution in [1, α], i.e. no job has a processing time that is larger than the renewal time α of the resources.

n = 10 jobs
The computational results for n = 10 jobs and α = 10, 100, 1000 are displayed in Table 2.
The MIP found the optimal solutions for all of the problem instances in less than 0.1 seconds. In 4 out of the 30 problem instances the optimal MIP result is not equal to the lower bounds calculated by Algorithm 1.
All of the problem instances with α = 10, 100 could be optimally solved by the MIP. In 5 out of 20 problem instances the optimal MIP solution was not equal to the lower bound. The hardest problem instances for n = 50 jobs were those with α = 1000. All of the 4 problem instances with a lower bound of 4 could be solved optimally by the MIP in less than 0.1 seconds. For two problem instances where the lower bound is only 3, the MIP could only find a solution with B = 4 resources in the given time (3000 s).
10 out of the 30 problem instances could not be solved provable optimally by the MIP. While all of the problem instances with a lower bound 4 could be optimally solved by the MIP, there are some problem instances with a lower bound 3 where the MIP could only find a solution with B = 4 resources.
We find it interesting that our MIP could not find the optimal solution for e.g. problem instance 7 of n = 100, α = 100. The result of the MIP is B = 4, but there are perfect schedules possible for this problem instance with only B = 3 resources: Take out the two smallest jobs, sort the remaining jobs from large to small (i.e. s 2 ≥ s 3 ≥  1, 2, 99, 3, 98, . . . , 50, 51, 100). This alternating schedule is obviously promising as a heuristic or even an approximation algorithm for B = 3 resources. We note that our implementation of a Variable Neighborhood Search (VNS) heuristic lead in no case to a smaller number B of resources for a perfect schedule. This is why we decided not to present the VNS results in this paper.
the jobs that has no idle times or gaps on the main processor. We showed that the decision version of this problem is NP-complete, derived new structural properties of perfect schedules, described a MIP formulation, and performed computational tests. We observed that for all problem instances either B = 3 or B = 4 resources are necessary for a perfect schedule. As we chose the processing times of the jobs from discrete uniform distributions in [1, α], the expected processing time of a job is (α + 1)/2. Though possible, it is very unlikely that n − 2 out of the n jobs have processing times that are equal to α. But as a result from Theorem 4, this would be a necessary condition that only B = 2 resources are sufficient for a perfect schedule. On the other hand, if B = 3, then we need at least n−3 2 jobs with processing times that are at least α/2 and this is indeed what we can expect. For B = 4 we need at least n−4 3 jobs with processing times of at least α/3 and this is highly probable. Of course, these are only necessary conditions but as the computational tests show that for all of our problem instances either B = 3 or B = 4 resources are sufficient for a perfect schedule. Note that this implies that for randomly generated problem instances any schedule is optimal if we allow at least B = 4 resources. This might be a valuable hint from a managerial perspective.
The worst-case bounds of Braun et al. (2014Braun et al. ( , 2016 for arbitrary schedules (i.e. permutations of jobs) achieve asymptotically a worst-case-factor of even 2 for the relation between the makespans of arbitrary schedules and optimal schedules. In more detail, the asymptotic worst-case factors are 4 3 for B = 2, 3 2 for B = 3, 5 3 for B = 4, and 2 for B → ∞. This is another example for the well-known observation that often worst-case factors might be too pessimistic for arbitrary problem instances. Another observation, related to the result of Rustogi and Strusevich (2013) is that in the single-processor scheduling problem with time restrictions more resources do not necessarily help. Again, at most B = 4 resources are sufficient for perfect schedules. Finally, despite the single-processor scheduling problem with time restrictions is NPhard for the number of resources B being a variable parameter of the problem (Braun et al. 2014) and even for B = 2 , the single-processor scheduling problem with time restrictions is easily solvable for our randomly chosen problem instances by any permutation of the jobs when there are B = 4 or more resources.