# the_complexity_landscape_of_resourceconstrained_scheduling__dd129305.pdf The Complexity Landscape of Resource-Constrained Scheduling Robert Ganian1 , Thekla Hamm1 and Guillaume Mescoff2 1Vienna University of Technology 2Rennes University rganian@gmail.com, thamm@ac.tuwien.ac.at, guillaume.mescoff@ens-rennes.fr The Resource-Constrained Project Scheduling Problem (RCPSP) and its extension via activity modes (MRCPSP) are well-established scheduling frameworks that have found numerous applications in a broad range of settings related to artificial intelligence. Unsurprisingly, the problem of finding a suitable schedule in these frameworks is known to be NP-complete however, aside from a few results for special cases, we have lacked an in-depth and comprehensive understanding of the complexity of the problems from the viewpoint of natural restrictions of the considered instances. In the first part of our paper, we develop new algorithms and give hardness-proofs in order to obtain a detailed complexity map of (M)RCPSP that settles the complexity of all 1024 considered variants of the problem defined in terms of explicit restrictions of natural parameters of instances. In the second part, we turn to implicit structural restrictions defined in terms of the complexity of interactions between individual activities. In particular, we show that if the treewidth of a graph which captures such interactions is bounded by a constant, then we can solve MRCPSP in polynomial time. 1 Introduction The RESOURCE-CONSTRAINED PROJECT SCHEDULING PROBLEM (RCPSP) provides a generic and well-established framework for the formal description of scheduling problems. RCPSP has been the subject of extensive theoretical as well as empirical research in the context of Artificial Intelligence [Smith and Pyle, 2004; Kuster et al., 2007; Varakantham et al., 2016; Song, 2017], Operations Research and Scheduling [van Bevern et al., 2016; Fu et al., 2010; Fu et al., 2016]; see also the survey [Kolisch and Padman, 2001] and book [Artigues et al., 2008] dedicated to the topic. RCPSP falls within the wider framework of so-called scheduling problems which are classical and have been at the focus of a vast and diverse amount of works [Schwindt and Zimmermann, 2015]. On a high level, in scheduling problems one is given a set of activities that have to be processed in a given time frame while adhering to certain conditions. Solutions to scheduling problems are also called schedules. RCPSP represents the subclass of scheduling problems where the processing of activities requires the use of resources; these have certain capacities that limit how many activities can be processed concurrently, and activities have certain resource requirements and durations which describe what resources each activity needs to be assigned to and for how long. It is assumed that an activity cannot be interrupted (one also calls this nonpreemptiveness). Now for RCPSP, a schedule consists of an assignment of the activities to certain points in time (simply modeled by natural numbers) such that the time it takes to process all activities satisfies a given makespan bound. Often one requires that activities also adhere to a precedence order. A prominent generalisation of RCPSP that has received considerable attention [Bofill et al., 2017; Barrios et al., 2011; Poppenborg and Knust, 2016] is based on the addition of activity modes, capturing scenarios where it is possible to complete activities in multiple ways each possibly requiring different amounts of time and resources. This gives rise to the MULTI-MODE RESOURCE-CONSTRAINED PROJECT SCHEDULING PROBLEM (MRCPSP). Contribution. It is known that RCPSP is NP-complete, and in fact remains NP-complete even when we consider only a single resource and when there are no precedence constraints [van Bevern et al., 2016; Garey and Johnson, 1975]. However, so far we have lacked a comprehensive understanding of the complexity of these fundamental scheduling problems under explicit and natural restrictions of considered instances; interestingly, already Blazewicz, Lenstra and Kan (1983) called for such a theoretical investigation in their seminal paper which formalized RCPSP: The obvious research program would be to determine the borderline between easy and hard resource constrained scheduling problems. For example, is (M)RCPSP restricted to instances of constant makespan and number of resources NP-hard, or does the problem become polynomial-time solvable? Our first contribution is a complete complexity map for (M)RCPSP which takes into account all combinations of variants arising from the following explicit restrictions/attributes which are immediately tied to numerical properties of the input or have been established in previous literature: Fixed upper-bound on number of activities (n), number Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence (IJCAI-20) of resources (m), maximum duration of an activity (t), maximum capacity of a resource (c), makespan (Cmax), and/or on the number of activities that can use each resource (rdeg); No precedence constraints ( P); Simple instances, where each activity only uses a single resource (S) (see, e.g., the work of Damay et al. [2007]); Whether we consider modes (MRCPSP) or not (RCPSP); All numbers are encoded in unary1 (U). With the exception of the modes attribute, we will adopt the convention of listing the attributes considered in a given fragment in angular brackets for instance, MRCPSP c, rdeg refers to instances of MRCPSP where each resource has capacity bounded (by a constant), and each resource is only used by a (constant-)bounded number of activities. Each of the above attributes can be viewed as an independent binary switch ; altogether this amounts to 210 considered fragments of (M)RCPSP. Our first contribution is a complete classification of all of these problems in terms of classical complexity theory; we show that 736 fragments are polynomial-time solvable and 288 are NP-hard. This is achieved by a collection of 3 new hardness proofs (in addition to 4 known NP-hard cases) and 6 polynomial-time algorithms, utilizing a range of diverse algorithmic techniques. An illustration of our complexity map is provided in Figure 1. In the second part of our paper, we shift our focus from explicit restrictions on instances to implicit ones. More specifically, we ask whether one can exploit the structure of interactions between activities and/or resources to lift any of the obtained polynomial-time algorithms towards more general classes of instances. A natural way of capturing such structure is the concept of treewidth. As our second contribution, we show that treewidth allows us to push the frontiers of tractability for MRCPSP when applied to the activity graph a graph which represents activities as vertices and adds edges between activities which interact either by sharing a resource or a precedence constraint. Related work. While the treewidth of instances has not been considered for RCPSP yet, the parameter has found numerous applications in prominent subfields and problems that are relevant for AI research, such as SAT [Gottlob et al., 2002], ILP [Ganian and Ordyniak, 2018] and CSP [Cohen et al., 2015]. It is worth noting that instances of low treewidth may arise naturally in a variety of problems and settings for example, the treewidth of control flow graphs arising from goto-free programs is known to be at most 6 [Thorup, 1998]. RCPSP is known to be polynomial-time solvable when the poset width of the precedence constraints is bounded [van Bevern et al., 2016]. 2 Preliminaries For an integer i, we use [i] as shorthand for {1, . . . , i}. The function argmin refers to an (arbitrary) argument of the min- 1This captures the distinction between weak and strong NPhardness. Unary instances arise when encoding certain problems. imum. We assume that N is the set of non-negative integers. For a vector R, we use R[ℓ] to denote its ℓ-th coordinate. Problem definition. An instance I of MRCPSP is a tuple A, R, C, M, T, Q,
0}| 1. Simple instances represent a middle ground between instances with a single resource and general instances [Damay et al., 2007] and have a natural correspondence to classical scheduling over m types of machines [Gehrke et al., 2018]. We will use |I| to denote the size of a (unary or binary, depending on the flag U ) encoding of the instance I. Treewidth and Graph Representations. A nice treedecomposition T of a graph G = (V, E) is a pair (T, X), where T is a tree rooted at a node r and X is a function that assigns each tree node t a set X(t) = Xt V of vertices such that the following conditions hold: For every vertex u V , there is a tree node t such that u Xt. For every edge uv E(G) there is a tree node t such that u, v Xt. For every vertex v V (G), the set of tree nodes t with v Xt forms a subtree of T. |Xr| = |Xℓ| = 1 for every leaf ℓof T. There are only three kinds of non-leaf nodes in T: Introduce node: a node t with exactly one child t such that Xt = Xt {v} for some vertex v Xt . Forget node: a node t with exactly one child t such that Xt = Xt \{w} for some vertex w Xt . Join node: a node t with two children t1, t2 such that Xt = Xt1 = Xt2. The sets Xt are called bags of the decomposition T and Xt is the bag associated with the tree node t. The width of a nice tree-decomposition (T, X) is the size of a largest bag minus 1. The treewidth of a graph G, denoted by tw(G), is the minimum possible width of a nice tree-decomposition of G. For every fixed k, a nice tree-decomposition of a graph G of treewidth k can be computed efficiently if one exists [Bodlaender et al., 2016; Kloks, 1994; Arnborg et al., 1987]. We use X (t) to denote the set of all vertices in bags of the sub- a3 a4 n = 4, m = 4 Q(b1 1) = (1, 0, 0, 0), Q(b3 1) = (1, 1, 0, 0) Q(b1 2) = (0, 1, 0, 0), Q(b3 2) = (1, 0, 0, 1) Q(b2) = (0, 0, 1, 0), Q(b4) = (0, 0, 0, 1) a4
0 = { b ω(A) | j N : Q(b)[j] > 0 } has cardinality at most q. Let A>0 = {a A | ω(a) B>0} be the set of activities using these modes in the solution. We can solve I using the algorithm A which begins by branching over all subsets of modes of cardinality at most q containing at most one mode from each of the pairwise disjoint Mi as options for B>0. From such a choice for a possible B>0 we infer a corresponding ω by setting ω(ai) = b for ai A>0 whenever B>0 Mi = {b}, and for all other activities ai A \ A>0 choosing ω(ai) as b Mi such that Q(b) = 0m (i.e., b requires no resources) and minimizes T(b) among these modes. It is easy to see that, whenever a solution with the chosen B>0 exists, a solution with the chosen B>0 and deduced ω exists. Now, we proceed similarly as in the proof of Observation 1 in which we branched on the order in which the activities are scheduled in a solution and then greedily constructed α which conforms to this ordering whenever such an α exists. The caveat here is that this exact approach would introduce a linear dependency on n! which is in general not in poly(|I|). Instead, A branches only on the order in which the activities in A>0 are scheduled by a solution, inserts the activities in A \ A>0 into this ordering, at the respective smallest positions respecting the precedence relation, and then a greedy starting time assignment is performed just as before. The overall running time of A can be shown to lie in O(|B|Cmax c m (Cmax c m)! |I|2) O(|I|Cmax c m+2). The proof strategy for Theorem 3 can be combined with that of Observation 1 to obtain a polynomial-time algorithm when rdeg and m are bounded. The resulting algorithm runs in time O((rdeg m)! |I|rdeg m+2). Corollary 4. MRCPSP m, rdeg is in P. The final two (and arguably most difficult) fragments for which we show polynomial-time tractability both have no precedence constraints and have boundedly many resources. Theorem 5. MRCPSP m, P, Cmax, U is in P. Proof Sketch. Let a resource snapshot be a Cmax m matrix over [c] {0} (i.e., the maximum capacity of a resource). Observe that the number of resource snapshots is upper-bounded by (c + 1)Cmax m. The resource snapshot J of a partial schedule (i.e., a solution restricted to a subset of activities) (ω, α) is the matrix where, for each x [Cmax] and y [m], the entry J[x, y] equals the amount of resource ry left at time step x. Given an instance I, let Ji be the set of resource snapshots of all partial schedules for the activities { aj | j i }. Clearly, J0 contains a single resource snapshot, namely the one where J[x, y] = C(ry) for all x, y. On the other hand, if Jn = then I is clearly a YES-instance. To prove the theorem, we describe a dynamic programming algorithm A which computes Ji+1 from Ji. A begins by looping over all resource snapshots in Ji, branching over each mode b Mi+1 of activity ai+1 and branching over each starting time s [Cmax T(b)]. For each such choice of resource snapshot J, b and s, it creates a new possible resource snapshot J . If any entry of the constructed J is negative, it is not a resource snapshot and hence not added to Ji+1; otherwise J is added to Ji+1. If the algorithm A results in a set Jn+1 that is non-empty, we can reconstruct a solution from the run of the algorithm by standard means; otherwise we conclude that I is a NOinstance. Note that each combination of mode, starting time and resource snapshot is considered at most once when updating the resource snapshots. Hence time complexity lies in O(|B| Cmax (c + 1)Cmax m) O(|I|Cmax m+1). Our last algorithm can be viewed as an extension of Theorem 5 to instances of larger makespan, by replacing the bound on the makespan by a weaker restriction, bounding t. This comes at a cost of requiring a bound on c. Theorem 6. MRCPSP m, c, t, P is in P. Proof Sketch. We may assume w.l.o.g. that the image of Q is a subset of [c]m (modes mapped by Q outside of this range are irrelevant because of resource constraints). Define the type of an activity ai A, denoted τ(ai), as { (Q(b), T(b)) | b Mi }. Observe that the property of having the same type describes an equivalence relation between activities, which has at most 2cm t many equivalence classes, each of which we refer to as an activity type. Let T be the set of non-empty activity types. If there is a solution, there is a solution (ω, α) such that maxi [n] α(ai) + T(ω(ai)) t n and any activity with a mode b with T(b) Cmax which requires no resources is scheduled to start at time 0 using mode b. In such a solution at any time point between 0 and t n at most c m of the remaining activities are being processed concurrently as they have to be assigned to modes using at least some resource. For the remaining activities we build up partial solutions ((ω , α ) where ω and α are defined on a subset of A instead of A satisfying all constraints on that subset) along the time steps. We do so by backtracking on the choice of a multiset of at most c m activity types and modes conforming to these activity types such that activities of these type may be scheduled using these modes in each time step. More formally, we iterate through i = 0 . . . min{t n, Cmax} 1. Within this iteration we iterate through the activity types (with multiplicities) that can be scheduled at time step i. To determine these activity types and their multiplicities we maintain, for each partial solution constructed in each iteration, the resource snapshot J ([c] {0})Cmax m (defined as in the proof of Theorem 5) induced by this partial solution and a vector s τ activity type([|τ|] {0}), describing how many activities of each activity type are not yet in the domain of the Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence (IJCAI-20) partial solution. A multiset {τ1, . . . , τz} of z c m activity types, can be scheduled at time step i if the multiplicity with which each activity type occurs in the multiset is bounded by the corresponding entry in s and there are (Qj, Tj) τj such that subtracting all Qj from the (i+1)-th through (i+1+Tj)- th rows of J does not result in negative entries in J. For each such choice of {(Qj, Tj) τj | j [z]}, we find an unscheduled activity a with τ(a) = τj and can set ω(a) = b such that (Q(b), T(b)) = (Qj, Tj) and α(a) = i. Appropriate modifications for J and s are straightforward. If we complete iteration min{t n, Cmax} 1 without having scheduled all activities in any encountered solution, we can conclude that no schedule for the instance exists. The described approach is an iterative branching procedure which is exhaustive modulo activity type equivalence. Hence correctness follows from the fact that activities of the same type can easily be interchanged in a schedule by an easy transformation. The complexity lies in O((min{t n, Cmax} 1) (2cm t |B|)c m |I|) O(|I|cm t+2). 3.2 Lower Bounds We now turn towards hardness results for fragments of MRCPSP. First, we state a few previously known lower bounds: Fact 7 (Uetz [2011], Lemma 5.1.1). RCPSP c, rdeg, t, P, Cmax, U is NP-hard. Fact 8 (Blazewicz, Lenstra and Kan [1983], Theorem 7). RCPSP m, c, t, S, U is NP-hard. The third and last known NP-hardness result that we need concerns the fragment RCPSP m, c, S, P, U . Du and Leung (1989, Theorem 2) proved that a scheduling problem equivalent to this fragment is NP-hard (one merely needs to represent the identical machines used in their reduction by capacity units of a single resource). Fact 9. RCPSP m, c, S, P, U is NP-hard. Moreover, it is easy to observe that a trivial reduction from BIN PACKING [Garey and Johnson, 1979] yields: Observation 10. RCPSP m, t, S, P, U is NP-hard. Our following three new reductions complete the complexity map for MRCPSP in terms of explicit restrictions. Theorem 11. RCPSP c, rdeg, t, S, Cmax, U is NP-hard. Proof Sketch. We give a reduction from 3-SAT by constructing an instance I from a 3-CNF formula F as follows. I has Cmax = 3 and all processing times of activities 1. For each variable x in F we create a resource rx with capacity one and two activities x T , x F , each requiring one of rx. Moreover, for each clause C we create a resource r C with capacity 3, and for each literal ℓin C we create one activity Cℓwhich requires one r C. If ℓ= x for some variable x (i.e., ℓis a positive literal), we create the precedence constraint requiring Cℓ to start after x T is completed; otherwise we create the precedence constraint requiring Cℓto start after x F is completed. For each clause C, we now create three new activities C0, C1 and C2, where C0