Single machine scheduling with forbidden start times

Similar documents
Complexity analysis of job-shop scheduling with deteriorating jobs

High Multiplicity Scheduling on One Machine with Forbidden Start and Completion Times

A polynomial-time approximation scheme for the two-machine flow shop scheduling problem with an availability constraint

Scheduling Parallel Jobs with Linear Speedup

Minimizing Mean Flowtime and Makespan on Master-Slave Systems

University of Twente. Faculty of Mathematical Sciences. Scheduling split-jobs on parallel machines. University for Technical and Social Sciences

STABILITY OF JOHNSON S SCHEDULE WITH LIMITED MACHINE AVAILABILITY

Partition is reducible to P2 C max. c. P2 Pj = 1, prec Cmax is solvable in polynomial time. P Pj = 1, prec Cmax is NP-hard

M 2 M 3. Robot M (O)

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness

Computers and Intractability

The Complexity of Maximum. Matroid-Greedoid Intersection and. Weighted Greedoid Maximization

Lecture 2: Scheduling on Parallel Machines

On-line Scheduling of Two Parallel Machines. with a Single Server

Polynomial Time Algorithms for Minimum Energy Scheduling

The Maximum Flow Problem with Disjunctive Constraints

This means that we can assume each list ) is

Static-Priority Scheduling. CSCE 990: Real-Time Systems. Steve Goddard. Static-priority Scheduling

Complexity analysis of the discrete sequential search problem with group activities

Scheduling jobs with agreeable processing times and due dates on a single batch processing machine

arxiv:cs/ v1 [cs.ds] 18 Oct 2004

NP-Completeness. NP-Completeness 1

Machine Minimization for Scheduling Jobs with Interval Constraints

No-Idle, No-Wait: When Shop Scheduling Meets Dominoes, Eulerian and Hamiltonian Paths

Single Machine Scheduling with a Non-renewable Financial Resource

EXACT DOUBLE DOMINATION IN GRAPHS

Dispersing Points on Intervals

Santa Claus Schedules Jobs on Unrelated Machines

Exponential neighborhood search for a parallel machine scheduling problem

Gearing optimization

A note on proving the strong NP-hardness of some scheduling problems with start time dependent job processing times

On-line Bin-Stretching. Yossi Azar y Oded Regev z. Abstract. We are given a sequence of items that can be packed into m unit size bins.

New scheduling problems with interfering and independent jobs

APTAS for Bin Packing

Solving Fuzzy PERT Using Gradual Real Numbers

Bicriterial Delay Management

On the Complexity of Mapping Pipelined Filtering Services on Heterogeneous Platforms

Throughput Optimization in Single and Dual-Gripper Robotic Cells

Batch delivery scheduling with simple linear deterioration on a single machine 1

An improved approximation algorithm for two-machine flow shop scheduling with an availability constraint

Machine scheduling with resource dependent processing times

A lower bound for scheduling of unit jobs with immediate decision on parallel machines

Batching Identical Jobs

On Preemptive Scheduling on Uniform Machines to Minimize Mean Flow Time

Algorithm Design. Scheduling Algorithms. Part 2. Parallel machines. Open-shop Scheduling. Job-shop Scheduling.

A comparison of sequencing formulations in a constraint generation procedure for avionics scheduling

CMSC 722, AI Planning. Planning and Scheduling

Algorithms. Outline! Approximation Algorithms. The class APX. The intelligence behind the hardware. ! Based on

HEURISTICS FOR TWO-MACHINE FLOWSHOP SCHEDULING WITH SETUP TIMES AND AN AVAILABILITY CONSTRAINT

On Two Class-Constrained Versions of the Multiple Knapsack Problem

Polynomially solvable and NP-hard special cases for scheduling with heads and tails

Scheduling Linear Deteriorating Jobs with an Availability Constraint on a Single Machine 1

A Dynamic Programming algorithm for minimizing total cost of duplication in scheduling an outtree with communication delays and duplication

Single processor scheduling with time restrictions

1 Introduction and Results

hal , version 1-27 Mar 2014

A Robust APTAS for the Classical Bin Packing Problem

Approximation schemes for parallel machine scheduling with non-renewable resources

The polynomial solvability of selected bicriteria scheduling problems on parallel machines with equal length jobs and release dates

Introduction to Bin Packing Problems

Ideal preemptive schedules on two processors

Flow Shop and Job Shop Models

Optimal on-line algorithms for single-machine scheduling

Common-Deadline Lazy Bureaucrat Scheduling Problems

The Tool Switching Problem Revisited

On Machine Dependency in Shop Scheduling

On improving matchings in trees, via bounded-length augmentations 1

Approximation complexity of min-max (regret) versions of shortest path, spanning tree, and knapsack

Automata on linear orderings

The Multiple Traveling Salesman Problem with Time Windows: Bounds for the Minimum Number of Vehicles

On the Generation of Circuits and Minimal Forbidden Sets

Single processor scheduling with time restrictions

CS 6901 (Applied Algorithms) Lecture 3

Efficient approximation algorithms for the Subset-Sums Equality problem

CS264: Beyond Worst-Case Analysis Lecture #18: Smoothed Complexity and Pseudopolynomial-Time Algorithms

CMSC 451: Lecture 7 Greedy Algorithms for Scheduling Tuesday, Sep 19, 2017

Minimizing the total flow-time on a single machine with an unavailability period

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Static priority scheduling

Approximation Algorithms for Scheduling with Reservations

A new lower bound for one-machine earliness-tardiness scheduling

2 Notation and Preliminaries

CS264: Beyond Worst-Case Analysis Lecture #15: Smoothed Complexity and Pseudopolynomial-Time Algorithms

Fixed-sequence single machine scheduling and outbound delivery problems

Approximation results for the weighted P 4 partition problem

Heuristics for two-machine flowshop scheduling with setup times and an availability constraint

Single Machine Scheduling with Job-Dependent Machine Deterioration

Climbing discrepancy search for flowshop and jobshop scheduling with time-lags

Scheduling for Parallel Dedicated Machines with a Single Server

Algorithm Design and Analysis

LPT rule: Whenever a machine becomes free for assignment, assign that job whose. processing time is the largest among those jobs not yet assigned.

Design and Analysis of Algorithms

Real-Time k-bounded Preemptive Scheduling

Introduction to Complexity Theory

Hierarchy among Automata on Linear Orderings

CS 6783 (Applied Algorithms) Lecture 3

arxiv: v2 [cs.dm] 29 Mar 2013

Solving an integrated Job-Shop problem with human resource constraints

Transcription:

4OR manuscript No. (will be inserted by the editor) Single machine scheduling with forbidden start times Jean-Charles Billaut 1 and Francis Sourd 2 1 Laboratoire d Informatique Université François-Rabelais de Tours 64 avenue Jean Portalis, 37200 Tours France e-mail: jean.billaut@univ-tours.fr 2 LIP6 CNRS Université Pierre et Marie Curie 4 place Jussieu, 75252 Paris cedex 05 France e-mail: francis.sourd@lip6.fr Abstract This paper addresses a single machine scheduling problem in which the following simple constraint is added: a set of time slots is forbidden for starting a task, that is no task can start at any forbidden time point. We show that the single machine problem with makespan minimization is strongly N P-complete and we give polynomial algorithms to solve the problems with a small number of forbidden start times. 1 Introduction When considering a scheduling problem, it is generally assumed that the resources are always available for processing the tasks. Sometimes some unavailability periods are considered, that is periods during which no task can be processed. In these problems, a task can either start before the period and resume after the period (resumable case), or must be completely scheduled between two unavailability periods (non-resumable case). The main scheduling problems with unavailability periods have already been considered in the literature (Lee, 1996, 1999; Gharbi and Haouari, 2005; Mauguière et al., 2005). A recent overview can also be found in the book chapter of Lee (2004). However, while most theoretical scheduling literature focuses on the resumable and non-resumable cases, real-life unavailability periods may cause a large bunch of different types of constraints, as it is illustrated by the Application Programming Interface (API) of ILOG Scheduler (2003). In particular, some unavailability periods may prevent to launch or stop a task during a given period but a running task is not necessarily interrupted by periods of this type. In the problem we study, the tasks have integral processing times and a given set of integral forbidden start times is given. It means that no task can have a start time belonging to this set. For instance, in a workshop, the forbidden start times can correspond to the dates at which the operators have to receive raw materials - and thus cannot be present at the same time in front of the machines for starting a new task. In multi-machine environments, assuming a single operator Corresponding author: Francis Sourd, LIP6, Université Pierre et Marie Curie, 4 place Jussieu, 75252 Paris cedex 05, France. Tel. +33-144275395, Fax +33-144277000.

2 Jean-Charles Billaut and Francis Sourd is qualified for performing a machine setup, this operator cannot perform all the setups at the same time even if the setup time is small. Therefore two operations cannot start at the same time, here the forbidden start times would correspond to the time slots where the operator is known to be busy. Formally we are given a set J = {J 1,J 2,...,J n } of n tasks to be scheduled on a single machine. To each task J j is associated a processing time p j. We denote by P k = k i=1 p i, P 0 = 0 and P = P n. It is assumed that the tasks start at integral time points and that some start times are forbidden. We denote by F = {F 1,F 2,...,F K } the set of the K forbidden start times and we assume without loss of generality that 0 < F 1 < F 2 < < F K. The problem is to schedule the tasks so that no task starts at a forbidden start time and so that the makespan is minimum. Formally, if a schedule is given by the start times S 1,...,S n, the forbidden-start-times constraint is defined by S j / F, j,1 j n. (1.1) In some classes of instances where there are several adjacent forbidden start times, the input can be more compactly encoded using the concept of forbidden intervals : a task cannot start in a forbidden interval, but it can be in process or completed in such an interval. The concept of forbidden interval is closely related to the concept of unavailability period. However, we emphasize the difference that the processing of a task is not restrained by the presence of forbidden start times while the task has started at a non-forbidden start time. Constraints (1.1) imply that the setup period of each task is unary, that is the constraints only check that S j / F. In some cases, the setup periods may be of length p > 1, that is p j p for all j and we must have {S j,s j + 1,...,S j + p 1} F = for all j. We can show that this problem is equivalent to the problem with forbidden start times with an extended set of forbidden start times equal to F = f F {f p+1,...,f}. In other words, the problem with equal setup periods is equivalent to the problem with unit setup periods. In an optimal schedule, the forbidden start times constraints may give rise to the insertion of idle times in the schedule. Therefore, the problem is to minimize the number of idle slots. The problem can be denoted by 1 S j F C max in the well-known three-field α β γ notation, where S j F corresponds to the constraint of forbidden start times. In the literature, some works have considered scheduling problems with discrete sets of allowed start times. In other words, the constraints write S j F j for all j where F j is the set of possible start times for task j. The model was introduced by Nakajima and Hakimi (1982) in a parallel machine environment. They proved the problem is N P-complete. Keil (1992) studies the onemachine problem. Rosenkrantz (2001) studies the one-machine and parallel machines problems when the tasks are subject to release dates. The rest of the paper is organized as follows. We consider the general problem and show its strong N P-hardness in Section 2. Then we study polynomially solvable cases for small values of K. Section 3 is devoted to the case where K = 1 and Section 4 to the case where K = 2. Finally, Section 5 presents a dynamic programming algorithm that is polynomial when K is considered as a constant. 2 Study of the general problem We consider the decision problem to determine whether a schedule without idle time that is a schedule with makespan P exists or not. We denote this problem by SMS-FST, formally defined

Single machine scheduling with forbidden start times 3 by: SMS-FST (Single Machine Scheduling with Forbidden Start Times): Data: J a set of tasks, p j processing time of task J j, a set of forbidden start times F, F = K. Question: does a schedule of all the tasks exist on a single machine, with a makespan equal to P and no start time in F? Theorem 2.1. SMS-FST is N P-complete in the strong sense. Proof. The problem is clearly in N P. To prove the theorem we give a pseudo-polynomial transformation from 3-PARTITION to SMS-FST. Since 3-PARTITION is strongly N P-complete, then so is SMS-FST (Garey and Johnson, 1979, Lemma 4.1). 3-PARTITION is formally defined by: Data: a finite set A of 3m elements, a bound B > 0 and a size s(a) for each a A that satisfies B/4 < s(a) < B/2 and a A s(a) = mb. Question: Can A be partitioned into m disjoint sets S 1,...,S m such that, for each i {1,...,m}, we have a S i s(a) = B? We build an instance of SMS-FST with n = 4m tasks defined as follows: the first 3m tasks correspond to the elements of A: the task associated with a has a processing time equal to s(a). m tasks T 1, T 2,... T m with a processing time equal to B. The number of forbidden start times is equal to K = m(b 1). The set of forbidden start times is given by F = 1 i m [(2i 1)B + 1,2iB 1], that is we periodically have B + 1 allowed start times followed by B 1 forbidden start times (see Fig. 2.1): F 1 = B + 1, F 2 = B + 2,..., F B 1 = 2B 1, F B = 3B + 1, etc. This transformation of the instance of 3-PARTITION is pseudo-polynomial since the number of forbidden start times depends on B. B B B B B T B B B 1 T 2 T m 0 F 1 F 1 + B 2 F K Fig. 2.1. Instance of problem SMS-FST We want to schedule all the tasks without idle slots, that is the schedule is to be completed at time 2mB. In order that the time slot [2iB 1,2iB] is not idle, a task of length at most B must be started at (2i 1)B or before, which means that it must be a task of length B that starts at (2i 1)B. Therefore, in a schedule without idle time, task T i of length B has to start at time (2i 1)B for i {1,...,m}. If there is no idle time in the schedule, the 3m remaining tasks are scheduled in the m remaining intervals of length B, which gives a solution to 3-PARTITION. Conversely, any solution to 3-PARTITION clearly leads to a schedule without idle time.

4 Jean-Charles Billaut and Francis Sourd This reduction shows that, unless P = N P, the problem has no constant-factor approximation algorithm. Indeed, if we have a forbidden interval [2mB, T], finding a schedule that completes before T is as difficult as finding a schedule that completes before 2mB. However an obvious upper bound for any feasible schedule is P + F, which means that any algorithm that schedules tasks in an arbitrary order as soon as possible has an absolute performance guarantee of F. If we assume that the problem has only one interval of forbidden start times, a similar reduction based on PARTITION shows that the problem is N P-complete in the ordinary sense. We can also show that this problem can be solved in pseudo-polynomial time by adapting the classical dynamic programming algorithm for PARTITION. In the following sections, we are going to show that if there are only one or two forbidden start times, the problem becomes polynomial and that it remains polynomial when K is assumed to be a constant. Before, we show that the case where all the tasks are identical (p j = p for all j) can also be solved in polynomial time. Theorem 2.2. Problem 1 S j F,p j = p C max can be solved optimally in O(K) time, assuming that the forbidden start times are given in increasing order. Proof. In this case, all the tasks are identical and thus there is no sequencing problem. The only problem is to assign a start time not in F to each task. If no forbidden start time is equal to 0 (mod p) the tasks can be sequenced without introducing an idle time. Otherwise, one idle time has to be introduced and if no remaining forbidden start time is equal to 1 (mod p), the tasks can be sequenced without introducing an idle time. The process iterates K times and finally returns the optimal makespan value. The procedure given in Figure 2.2 returns the optimal makespan in O(K). 1. C = P; t = 0; i = 1 2. while i K and F i < C do if F i t (mod p) then C = C + 1; t = t + 1 endif i = i + 1 3. return C Fig. 2.2. Optimal procedure for the 1 S j F, p j = p C max problem 3 One forbidden start time Theorem 3.1. If K = 1, there exists an optimal schedule of makespan equal to P unless p i = p for all tasks and F 1 = kp for some integer k < n. In the latter case, the makespan is equal to P + 1. Proof. If the processing times of all tasks are equal to p and F 1 = kp, there clearly exists no feasible active schedule that completes at P = np. Indeed in such a schedule, the k + 1 th task would start at time kp, which is forbidden. Conversely, we can obviously build a schedule that completes at P + 1 by starting the k + 1 th task at time kp + 1. We now show that in any other case, there is a schedule which completes at P. If the processing times of all tasks are equal to p and F 1 kp, each task starts at time kp (with 0 k n 1)

Single machine scheduling with forbidden start times 5 and so any sequence is feasible and completes at P. If there are at least two different tasks to schedule, we can assume without loss of generality that p 1 p 2 and that p 1 p i for all i. Let k be the index such that P k 1 F 1 < P k. Therefore, we have P k F 1 p k p 1. If P k F 1 < p 1, we can schedule the tasks J 2,...,J k in any order between 0 and P k p 1 < F 1 and J 1 between P k p 1 and P k. If P k F 1 = p 1, we can schedule the tasks J 3,...,J k in any order between 0 and P k p 1 p 2 < F 1 and J 1 between P k p 1 p 2 and P k p 2 = F 1 + p 1 p 2 F 1. Therefore, J 2 can start at P k p 2. In both cases, we are able to schedule J 1,...,J k before P k and all the other tasks can be scheduled later in any order to complete before P n. The above proof gives an O(n) algorithm to build an optimal schedule when there is only one forbidden start time and at least two different tasks to schedule. 4 Two forbidden start times In this section, we assume that K = 2 and 0 < F 1 < F 2 < P +2 (remember P +2 is an upper bound on any earliest schedule). We distinguish three cases: the case where all the tasks are identical, the case where there is at least three types of tasks and the case where there is only two types of tasks. Figure 4.1 outlines the sub-cases that are successively addressed. 1. Identical tasks 2. At least three different tasks 3. Two different tasks (a) One task has only one occurrence (b) Both tasks have at least two occurrences (p 2 > p 1 ) i. {F 1, F 2 } = {p 1, p 2 } or {F 1, F 2 } = {P p 2, P p 1 } ii. p 2 = 2p 1 iii. p 2 = kp 1 (k > 1) iv. p 2 is not a multiple of p 1. Fig. 4.1. Outline of the proof 4.1 Identical tasks When all the tasks have a processing time equal to p and F 1 or F 2 is equal to kp, the schedule cannot complete at P (as in Theorem 3.1). In fact, we can even be more precise. Lemma 4.1. In the problem with two distinct forbidden start times, when all the tasks are identical, i.e. if K = 2, 0 < F 1 < F 2 < P + 2 and p i = p, i, 1 i n, the optimal makespan is equal to: P if F 1 kp and F 2 k p for all k, k, 0 k k < n; P + 2 if {F 1,F 2 } = {kp,k p + 1} for some k, k, 0 k k < n; P + 1 otherwise. Proof. The makespan is either P, P + 1 or P + 2. Since all the tasks are identical, all the task sequences are equivalent. The makespan is equal to P if and only if the k th task in the sequence

6 Jean-Charles Billaut and Francis Sourd starts at (k 1)p. Such a schedule is feasible if and only if F 1 kp and F 2 k p for all k, k, 0 k k < n. If this condition is not satisfied, the schedule is at least P +1. Let us consider the smallest k such that kp is forbidden. If kp = F 2, we have a schedule of length P + 1. If kp = F 1, we conclude the proof by using Theorem 3.1. Since there is only one machine and only one type of tasks, the optimal makespan value is known in constant time. 4.2 At least three different tasks Lemma 4.2. If there are three different tasks, we can build an optimal schedule with a makespan equal to P. Proof. We can assume without loss of generality that p 1 > p 2 > p 3 and p 1 p j for j J. We first schedule the tasks J 4,J 5,...,J n until we cannot add a task that completes strictly before F 1. Let t be the completion time of the last scheduled task. Let us first consider the four following sub-cases. F 1 t p 3 : As the three tasks J 1, J 2 and J 3 have different processing times, there is at least one task J j among J 1,J 2,J 3 such that t + p j {F 1,F 2 }. Once we have scheduled J j, we have to schedule the remaining tasks after t + p j. As F 1 < t + p j, there is at most one forbidden start time and at least two different tasks, which means, according to Theorem 3.1, that we can schedule all the tasks without idle time and the schedule completes at P. p 3 < F 1 t p 2 : If t + p 1 / F or t + p 2 / F, we can schedule J 1 or J 2 so that, as in the previous case, the remaining problem has at least two different tasks and one forbidden start time. Otherwise F 1 = t + p 2 and F 2 = t + p 1. We can then start J 3 at t and J 1 at t + p 3. J 1 completes after F 2 so that the remaining tasks can be scheduled in any order. p 2 < F 1 t: Any unscheduled task J j with j / {2,3} verifies F 1 t p j p 1. If there exists at least one unscheduled task J j with j 4, we can start at t either J 1 alone, or J 2 + J 1, or J 3 + J 1. At least one of these possibilities do not meet any forbidden start time because t + p 3 < t + p 2 < F 1 and there are three possible different completion times for J 1. After the completion of J 1, we have again at most one forbidden start time and at least two different tasks (since J j is unscheduled). Otherwise, all the tasks J 4,...,J n are scheduled before t. If we start J 3 at t, it completes at t + p 3 < F 1. If there is no idle time, the completion time of the last job must be either P p 1 or P p 2. Therefore a feasible schedule can be built unless F = {P p 1,P p 2 }. Conversely, if F = {P p 1,P p 2 }, we can schedule J 3 so that is completes at P because P p 3 > F 2 = P p 2. We can also start J 2 at t because t+p 2 = P p 1 p 3 < P p 1 = F 1. Therefore a feasible schedule can be built again. 4.3 Two types of tasks From now on, we consider that there are two distinct subsets of tasks. The first one contains k 1 tasks (k 1 > 0) with processing time p 1 and the second one contains k 2 tasks (k 2 > 0, k 1 + k 2 = n) with processing time p 2. In this problem, tasks with identical settings are to be processed several times: we are therefore in the field of high multiplicity scheduling (Brauner et al., 2005). We observe that the problem can be compactly encoded in O( 2 i=1 log k i + log p i ) space, which means that

Single machine scheduling with forbidden start times 7 the number of tasks is exponential in the size of the input of the problem. Abusing notation, we will denote by J i any task with length p i (for i {1,2}). In other words, we have k 1 occurrences of task J 1 and k 2 occurrences of task J 2. 4.3.1 First case: k 1 = 1 We first consider the case where k 1 = 1 and k 2 = n 1. Since there is no assumption on the processing times p 1 and p 2, the case k 1 = n 1 and k 2 = 1 is identical. If F 1 > k 2 p 2 = (n 1)p 2, then a schedule that first sequences the k 2 tasks J 2 followed by task J 1 (that starts at (n 1)p 2 ) does not meet any forbidden start time, completes at P and is optimal. In the following we assume that F 1 (n 1)p 2. Lemma 4.3. It is assumed that k 1 = 1 and F 1 (n 1)p 2. There is an optimal schedule where F J 1 does not start before t = 1 1 p 2 p 2. Moreover, the optimal makespan is given by 1. Suppose {t + p 1,t + p 2 } = {F 1,F 2 }, then the optimal makespan is P + 1. 2. Suppose F 1 = t + p 2. If furthermore F 2 t + p 1 and P F 2 = kp 2 then the optimal makespan is P + 1, otherwise, it is P. 3. Otherwise, the optimal schedule is P. Proof. We first prove the initial statement of the lemma about the start time of J 1. As F 1 0, we have t 0. Moreover, we have by construction that t < F 1 t + p 2. If J 1 starts before t, it F starts at time λp 2 where λ is the number of tasks J 2 before J 1. We have λ < 1 1 p 2 k 2. If we swap J 1 with its successor (a task J 2 ), task J 1 can start at (λ + 1)p 2 t < F 1 without violating any forbidden start time. We iterate this swap operation until J 1 starts at t. Let us now compute the optimal makespan in each of the three sub-cases. 1. Let us assume {t + p 1,t + p 2 } = {F 1,F 2 }. In the optimal schedule that contains only tasks J 2 before t, we have either an idle slot at t, or a task is started and followed by an idle slot. It means that there is no optimal schedule that complete at P and P + 1 is a lower bound. Such a makespan is reachable is we start the longest task (among J 1 or J 2 ) at t + 1. It completes at F 2 + 1, which means that all the remaining tasks can be scheduled in any order before P + 1. 2. If J 2 was scheduled at t or if a time slot was inserted, the makespan would be at least P +1. We show that by scheduling J 1, we have a makespan at most P + 1 (which means that scheduling J 1 at t is the optimal decision). Since t + p 1 F 1 and t + p 1 F 2 (otherwise, we would be in the first case), we can start a task J 2 at t + p 1. As F 1 < t + p 1 + p 2, any resulting schedule contains at most one idle slot due to F 2. The optimal schedule is given by optimally scheduling the remaining task J 1 subject to an eventual forbidden start time, which is done following Theorem 3.1. Rewriting the conditions of the theorem in the present case gives that the makespan is equal to P + 1 if F 2 t + p 1 and P F 2 is a multiple of p 2. Otherwise, the makespan is P. 3. We have t + p 2 F 1. If t + p 2 = F 2 (then t + p 1 F 1, otherwise it would be the first case), we can schedule J 1 at t and J 2 between t + p 1 and t + p 1 + p 2 > F 2, which means that the remaining tasks can be scheduled without idle time. If t + p 2 F 2, we can schedule a task J 2 at t. By definition of t, it completes after F 1, which means that two different tasks must be scheduled after t + p 2 subject to at most one forbidden start time. It can be done without idle time according to Theorem 3.1. 4.3.2 Second case: k 1 > 1 We now study the case where k 1 2 and k 2 2. Without loss of generality, we can assume that p 1 < p 2. We first consider two special cases where the schedule

8 Jean-Charles Billaut and Francis Sourd 0 p 1 p 1 + p 2 p 1 + 2p 2 F 1 F 2 P Fig. 4.2. Illustration of the proof of Lemma 4.6 J 2 J 2 cannot complete at P. Afterwards, we will show that in any other case a schedule completing at P exists. Lemma 4.4. If {F 1,F 2 } = {p 1,p 2 } or {F 1,F 2 } = {P p 2,P p 1 }, then the minimum makespan is equal to P + 1. Proof. We only prove the results when {F 1,F 2 } = {p 1,p 2 }, the other case is symmetric. Any schedule must start by either a task J 1 or a task J 2. Whatever the first task is, the second task cannot start at the completion of its predecessor. Therefore the makespan is at least P +1. Such a makespan can be reached by first scheduling a task J 2 followed by the other tasks in any order. Lemma 4.5. Let us assume we have p 2 = 2p 1. If {F 1,F 2 } = {(k 1)p 1,kp 1 } for some k < k 1 +2k 2, the minimum makespan is equal to P + 1. Otherwise, it is equal to P. Proof. Let us first assume that F 1 = (k 1)p 1 and F 2 = kp 1. Whatever is the schedule before F 1, if there is no inserted idle time we have either a task that completes at F 1 or a task that completes at F 1 p 1 since p 2 = 2p 1. In the first case, an idle slot is necessary at time F 1. In the second case, an idle slot is necessary at time F 1 if we schedule a task J 1 or at time F 2 is we schedule a task J 2. Therefore the makespan is at least P + 1. Conversely, a schedule with makespan P + 1 exists: we first schedule a task J 2 starting at F 1 p 1 and completing at F 2. We can fill the time interval [0,F 1 p 1 ) with tasks such that there is no more idle time and compute all the remaining tasks after F 2 + 1. The schedule has only one idle slot, its makespan is equal to P + 1. Consider now that {F 1,F 2 } {(k 1)p 1,kp 1 }. If both F 1 and F 2 are not multiple of p 1 any sequence is feasible and completes at P. We consider now three sub-cases. 1. F 1 = λp 1 and F 2 is not multiple of p 1 : we just have to schedule one task J 2 at time F 1 p 1 and the optimal makespan is equal to P. 2. F 2 = λ p 1 and F 1 is not a multiple of p 1 : this case is similar to the previous one. 3. F 1 = λp 1 and F 2 = λ p 1 with λ λ + 2: we can schedule two tasks J 2 at times F 1 p 1 and F 2 p 1 (they do not collapse). As there are at least two tasks J 1, the schedule can be filled without idle time and the makespan is P. We now show that in any other case, we can find a schedule with a makespan equal to P. We consider two cases, where p 2 = kp 1 (lemma 4.6) or not (lemma 4.7). Lemma 4.6. If k 1 2 and k 2 2, {F 1,F 2 } {p 1,p 2 }, {F 1,F 2 } {P p 2,P p 1 } and p 2 = kp 1 (for some integer k greater than 2), then there exists a schedule of makespan P. Proof. We consider all the schedules with no idle time and we show that at least one schedule has no task starting at time F 1 or F 2. If F 1 λp 1 (for all λ), then any such schedule avoids F 1 and, according to Theorem 3.1, there exists a schedule with makespan P. We have a similar conclusion if F 2 λp 1 (for all λ). Therefore we consider that F 1 = λ 1 p 1 and F 2 = λ 2 p 1. Figure 4.2 illustrates an instance with k = 3, λ 1 = 11 and λ 2 = 15. Let us first assume that F 1 < p 2. If F 2 p 2, we can schedule a task J 2 between 0 and p 2. The k 1 tasks J 1 and k 2 1 > 0 tasks J 2 are to be scheduled without idle time after p 2 subject

Single machine scheduling with forbidden start times 9 to the forbidden start time F 2, which is feasible according to Theorem 3.1. If F 2 = p 2, we have F 1 p 1 by hypotheses and we can schedule a task J 1 between 0 and p 1 and a task J 2 between p 1 and p 1 + p 2. Since F 2 = p 2 is the latter forbidden start time, p 1 + p 2 is not forbidden and all the remaining tasks can be scheduled in any order and no idle time has been inserted. If F 2 > P p 2, we can symmetrically build a schedule that completes at P. We now consider the remaining case, that is p 2 F 1 F 2 P p 2. Let f 1 (resp. f 2 ) be the remainder of λ 1 (resp. λ 2 ) when divided by k. The set {0,1,2} {f 1,f 2 } contains at least one element. Let x be such an element. In Figure 4.2, f 1 = 2 and f 2 = 0 which means that x must be equal to 1. We consider the slots corresponding to the intervals [lp 1,(l + 1)p 1 ] and the superslots corresponding to [xp 1 + lp 2,xp 1 + (l + 1)p 2 ]. By construction, no superslot starts at a forbidden start time, there is no forbidden start time neither before the first superslot in [0,xp 1 ] nor after the last superslot in [xp 1 + yp 2,P] with y = (P xp 1 )/p 2. To build a schedule without idle slot, we schedule x tasks J 1 before xp 1. Then, we place a task J 2 in the superslots that contain F 1 and F 2 (F 1 and F 2 may be in the same superslot or in two different superslot). Then, we place the remaining tasks J 2 in the superslots that completes before P. Finally, we place the remaining tasks J 1 in the remaining slots. Lemma 4.7. If k 1 2 and k 2 2, {F 1,F 2 } {p 1,p 2 }, {F 1,F 2 } {P p 2,P p 1 } and p 2 /p 1 not integer (p 1 < p 2 ), the schedule can be completed at P. Proof. We first build the following pseudo-schedule (that may violate one or both forbidden start times): all the k 2 tasks J 2 are scheduled without idle time between 0 and k 2 p 2 then all the k 1 tasks J 1 are scheduled between k 2 p 2 and P. Then, we show that this schedule can be repaired to become feasible. Clearly, if it does not violate any forbidden start time, no reparation is required. Let us assume that a task J 2 completes at some forbidden start time F {F 1,F 2 } (let J denote this occurrence of task J 2 ). We then modify the schedule by moving the last task to the first position (the tasks are scheduled from 0 to P, forbidden start times are still ignored). As p 1 < p 2, the forbidden start time F is strictly between the start and the end time of J and therefore it is not violated. Let us consider the second forbidden start time F {F 1,F 2 }\{F }. If no task starts at time F, the schedule is optimal. Otherwise, let J be the task that completes at F. If J is the first task of the schedule, we swap the first two tasks. Since F = p 1, we have F p 2 by hypotheses so that the swap operation repairs the violations of F without violating F. The schedule is feasible and of length P. If J is a task J 2, we move again the last task (a task J 1 as k 1 2) to the first position. F is now between the end and start time of J. We can also prove that no task starts at F: otherwise, we would have 2p 1 = kp 2 for some integer k. As p 2 > p 1, we would have p 2 = 2p 1, which is impossible. Therefore the schedule is feasible and of length P. If J is a task J 1 and is not the first task, F = k 2 p 2 +λp 1 for some λ such that 1 < λ < k 1. We move the last task J 2 to the last position. The completion time of the tasks J 1 are now of the form (k 2 1)p 2 + λ p 1 = F p 2 + (λ λ )p 1. Since p 2 is not a multiple of p 1, F is not a completion time of any task J 1. A task J 1 can complete at F only if F = k 2 p 2 but it would also mean that p 2 is a multiple of p 1. Therefore, the schedule is feasible. We have proved that if a task J 2 completes at F then the schedule is feasible and of length P. Let us now assume that some task J 1 completes at F = k 2 p 2 + λp 1 (and F kp 2 for all k {1,...,k 2 }). If there are two such tasks, we consider the latest one. As F < P, we have λ < k 1. We now build a modified schedule by sequencing k 2 1 tasks J 2, λ + 1 tasks J 1, the last task J 2 and all the other tasks J 1. F is between the start and end times of the last task

10 Jean-Charles Billaut and Francis Sourd J 2. Only the λ first tasks J 1 and the last task J 2 have moved. Therefore, if there is a violation of the second start time F, we have F = (k 2 1)p 2 +kp 1 for some k {1,...,λ+1}. If k λ then, there is only one forbidden start time before (k 2 1)p 2 + (k + 1)p 1 and two different tasks. So Theorem 3.1 shows that the tasks can be resequenced so that there is no violation. If k = λ + 1, then F is equal to the start time of the last task J 2. By construction, this task cannot be the last one (otherwise we would have {F 1,F 2 } = {P p 1,P p 2 } and we can swap it with its successor (denoted by J ). J starts at F but does not complete at F (otherwise, we would have p 2 = 2p 1 ). We can then move the first task J 2 and reinsert it just after J : now F is between the start and the end of this task J 2 and there is no more violation. 4.4 Complexity In this section, we have considered all the possible cases that may happen when there are two distinct forbidden start times. For each case, we presented how to build an optimal schedule. For a given instance, we can check in O(n) time to which case (according to Figure 4.1) the instance belongs. Then, for any case, we can build the schedule in O(n) time. Therefore, we have the following theorem. Theorem 4.1. 1 S j / F,K 2 C max can be solved in O(n) time. 5 Small number of forbidden start times We have proved that our scheduling problem with forbidden start times is polynomial when the number K of forbidden start times is equal to 1 or 2 but it is N P-complete for arbitrary values of K. We complete this study by proving that the problem is polynomial when K is considered as a constant that is we propose an optimal algorithm that runs in O(n p(k) ) with p(k) a (polynomial) function of K. Since p(k) quickly grows with K, this algorithm is only tractable for small values of K. The precise study of the previous section shows that a large number of sub-cases are to be considered when K = 2. It seems hard to generalize such a study for K = 3 or for a general value of K. Therefore, our approach here is different and based on dynamic programming. However, we do not study the complexity of compactly encoded instances as in Section 4.3. First, we give in Lemma 5.2 a counterpart of Lemma 4.2 that shows that instances with a large number of different jobs are easy. This result is the key for polynomially bounding the number of states in the dynamic programming. We recall that the forbidden start times are numbered such that 0 < F 1 < < F K < P +K. The following lemma and its corollary isolate the transformation used to prove Lemma 5.2. We define an active pseudo-schedule as a schedule without idle time that may violate the forbidden start times, i.e. a potentially non-feasible schedule without idle time. Job J j starting at time t is said to be a straddling job if there exists a forbidden start time F k such that t < F k t + p j. Lemma 5.1. Let us consider an instance where the tasks are pairwise different, that is their processing times are different. If there exists an active pseudo-schedule in which the last 2K 1 tasks are non-straddling then there exists a schedule that completes at P. Proof (by induction). From the previous section, the lemma is true for K = 1 or K = 2. We assume that the lemma is true for all K < K. Let S be the set of the last 2K 1 non-straddling

Single machine scheduling with forbidden start times 11 tasks. If the pseudo-schedule is feasible, there is nothing to prove. Conversely, let J j be the first task in the schedule that completes at a forbidden start time. Let t be the start time of J j. Since t + p j is forbidden and the processing times of the tasks in S are different from p j, there is at least one task say J i1 in S such that t + p i1 is not forbidden. We schedule J i1 at t, that is we move it and reinsert it before J j. If t + p i1 + p j is not forbidden, we let J j start at t + p i1. Otherwise, we have to find a second job J i2 in S to be inserted before J j such that t+p i1 +p i2 is not forbidden. By this way, we iteratively schedule x jobs J i1,j i2,...,j ix of S until t+( x k=1 p i k )+p j ( x 1 ) is not forbidden. We have x K since t + p j,t + p i1 + p j,...,t + k=1 p i k + p j are x distinct forbidden start times. Therefore, at step l of the above algorithm (for any l x), there remain 2K 1 (l 1) = 2K l K non-straddling tasks in S so that we are able to find J il in S such that its completion time t + l k=1 p i k is not a forbidden start time. In the new schedule, there are at least x forbidden start times but no violation before the completion of J j. Let us consider the tasks scheduled after J j : we have a subproblem with at most K x forbidden start times and the last 2K 1 x tasks are non-straddling. By induction, since 2K 1 x > 2(K x) 1, we are able to build a feasible schedule. Corollary 5.1. Let us consider an instance where the tasks are pairwise different, that is their processing times are different. If there exists an active pseudo-schedule in which there is a subsequence of 2K 1 adjacent non-straddling tasks, then there exists an active feasible schedule. Proof. Let K be the number of straddling tasks before this subsequence. From lemma 5.1, we can repair the part of the pseudo-schedule before the subsequence such that no task starts at a forbidden start time. In the new schedule, we still have a subsequence of 2K 1 K 2(K K ) 1 tasks. We can then similarly repair the part of the pseudo-schedule before the subsequence by applying Lemma 5.1 with the time reversed. Lemma 5.2. If there are at least L = 2K(K +1) different tasks, we can build an optimal schedule with a makespan equal to P. Proof (by induction). Let J be the maximal subset of J such that J does not contain two jobs with the same processing time. In other words, J contains one occurrence of each job in J so, from the statement of the lemma, we have J L. We first schedule, by list scheduling, the jobs of J J until we are not able to schedule a job strictly before F 1. Let t be the completion time of the last scheduled task. We have t < F 1 and we consider the two following cases. If F 1 t > p max = max j J p j, it means that all the jobs in J J are scheduled before F 1. Therefore we have to schedule the tasks of J in the time interval [t,p] without idle time. All the tasks are pairwise different. We only consider this subproblem and forget the tasks scheduled before t. We first build a pseudo-schedule by ignoring the forbidden start times. There are at most K straddling tasks. We consider the longest subsequence of non-straddling tasks between two straddling tasks. There are at most K + 1 such subsequences and, since there are at least 2K(K +1) tasks, the longest subsequence contains at least 2K 1 tasks. By Corollary 5.1, we can repair the pseudo-schedule to make it feasible. Otherwise (that is F 1 t p max ), there are at least L different unscheduled tasks. We first try to schedule one task in C = {J j p j > F 1 t} such that it does not complete at a forbidden start time. If C K + 1, such a task exists. Otherwise (that is C K), there are at least L K > K tasks with a processing time less than F 1 t. So there exists some job J j such that t + p j < F 1 and t + p j + p max / F. In both cases, we are able to build a partial schedule that completes after F 1 and does not violate any forbidden start time. Moreover there are at

12 Jean-Charles Billaut and Francis Sourd least L 2 > 2(K 1)K different unscheduled tasks and at most K 1 forbidden start times after t + p j + p max. Therefore, by induction, we are able to build a feasible schedule. According to the previous lemma, we only have to solve the case where there are at most M = L 1 different types of tasks. Similarly to Section 4.3, we will say that the instances contain k 1 jobs J 1, k 2 jobs J 2... and k M jobs J M. For the dynamic programming algorithm, we define the boolean values P(i 1,i 2,...,i M,k) that are true if and only if we can schedule i 1 jobs J 1, i 2 jobs J 2... and i M jobs J M in the time interval [0,T] with T = T(i 1,...,i M,k) = k + M j=1 i jp j. In other words, k is the number of allowed idle slots. In an optimal schedule for this problem, we either have that the time slot [T 1,T] is idle or that some job J j completes at T, which means that its start time T p j does not belong to F. In the first case, P(i 1,i 2,...,i M,k) is true if and only if P(i 1,i 2,...,i M,k 1) is true. In the second case, P(i 1,i 2,...,i M,k) is true if and only if P(i 1,...,i j 1,...,i M,k) is true. Therefore we have P(i 1,i 2,...,i M,k) = P(i 1,i 2,...,i M,k 1) P(i 1,...,i j 1,...,i M,k) j T p j / F with T = T(i 1,...,i M,k) = k + M j=1 i jp j. The minimal makespan for the problem is given by P + k where k is the smallest integer such that P(k 1,k 2,...,k M,k ) is true. Assuming that we have pre-sorted the elements of F in an array and the processing times p 1,...p M in a second array, each value P(i 1,i 2,...,i M,k) can be computed in O(K+M), that is in O(K 2 ). Therefore, the time complexity of the dynamic programming algorithm is in O(K 3 M j=1 k j), that is O(K 3 n 2K2 +2K 1 ). The space complexity is in O(Kn 2K2 +2K 1 ). The algorithm is then polynomial when K is assumed to be a constant. We observe that in the case with K = 2 forbidden start times, Lemma 4.2 shows that we can take L = 3 so that the dynamic programming approach leads to an O(n 2 ) algorithm, whereas Section 4 is devoted to an O(n) algorithm. 6 Conclusion We have considered in this paper a new scheduling problem, assuming that some starting times are forbidden. For the single machine problem and makespan minimization we have shown that the general problem is strongly N P-hard. Assuming that only one or two starting times are forbidden, we show that the problem can be solved in linear time. When the number of forbidden start times is seen as a constant, the problem remains polynomial. In order to improve the complexity of the dynamic programming algorithm of Section 5, we can search for a smaller L in Lemma 5.2. Clearly, L must be greater than K but we conjecture that the lemma holds for L = K + 1. This study is devoted to the makespan. Further works could consider the sum of (weighted) completion times since this problem is polynomial when there is no forbidden start time. In an environment with several machines, several variants of the forbidden start times can be imagined. An interesting one would be to allow at most one task to start at any time point. References N. Brauner, Y. Crama, A. Grigoriev, and van de Klundert. A framework for the complexity of high-multiplicity scheduling problems. Journal of Combinatorial Optimization, 9:313 323, 2005.

Single machine scheduling with forbidden start times 13 M.R. Garey and D.S. Johnson. Computers and Intractability; A Guide to the Theory of N P-completeness. W.H. Freeman and Company, New York, 1979. A. Gharbi and M. Haouari. Optimal parallel machines scheduling with availability constraints. Discrete Applied Mathematics, 148(1):63 87, 2005. ILOG Inc. ILOG Scheduler Reference Manual. October 2003. J. Keil. On the complexity of scheduling tasks with discrete starting times. Operations Research Letters, 12(5):293 295, 1992. C-Y. Lee. Machine scheduling with an availability constraint. Journal of Global Optimization, 9(3-4):395 416, 1996. C-Y. Lee. Two-machine flowshop scheduling with availability constraints. European Journal of Operational Research, 114(2):420 429, 1999. C-Y. Lee. Machine scheduling with availability constraints. In: J.Y.T. Leung (ed.) Handbook of Scheduling: Algorithms, models and performance analysis, Chapter 22, 2004. Ph. Mauguière, J-C. Billaut and J-L. Bouquard. New single machine and job-shop scheduling problems with availability constraints. Journal of Scheduling, 8:211 231, 2005. K. Nakajima and S. L. Hakimi. Complexity results for scheduling tasks with discrete starting times. Journal of Algorithms, 3(4):344 361, 1982. D. J. Rosenkrantz, L. Yu, S. S. Ravi. Efficient construction of minimum makespan schedules for tasks with a fixed number of distinct execution times. Algorithmica, 3(1): 83-100, 2001.