Noname manuscript No. (will be inserted by the editor) Complete 4-parametric Complexity Classification of Short Shop Scheduling Problems? Alexander Kononov · Sergey Sevastyanov · Maxim Sviridenko Received: date / Accepted: date Abstract We present a comprehensive complexity analysis of classical shop scheduling problems subject to various combinations of constraints imposed on the processing times of operations, the maximum number of operations per job, the upper bound on schedule length, and the problem type (taking values “open shop”, “job shop”, “mixed shop”). It is shown that in the infinite class of such problems there exists a finite basis system that allows one to easily determine the complexity of any problem in the class. The basis system consists of ten problems, five of which are polynomially solvable, and the other five are NP-complete. (The complexity status of two basis problems was known before, while the status of the other eight is determined in this paper.) Thereby the dichotomy property of that parameterized class of problems is established. Since one of the parameters is the bound on schedule length (and the other two numerical parameters are tightly related to it), our research continues the research line on complexity analysis of short shop scheduling problems initiated for the open shop and job shop problems in the paper by Williamson et al. (1997). We improve on some results of that paper. FA preliminary version of this paper was published in [22] Alexander Kononov Sobolev Institute of Mathematics, Siberian Branch of the Russian Academy of Sciences, Novosibirsk, Russia; E-mail: alvenko@math.nsc.ru Sergey Sevastyanov Sobolev Institute of Mathematics, Novosibirsk State University, Novosibirsk, Russia; E-mail: seva@math.nsc.ru Maxim Sviridenko IBM T.J. Watson Research Center, Yorktown Heights, USA; E-mail: sviri@us.ibm.com 1 Introduction Probably, the first complexity classification result was the well-known result due to Schaefer [33]. He considered a constrained satisfaction problem and derived an infinitely large subclass of NP that had a so called dichotomy property. This property means that every problem in the class is either in P or is NP-complete, thereby explicitly excluding the case of existing (in a given subclass of NP) a problem of an “intermediate” complexity. There are a few natural ways (see [7] and [18]) to generalize this dichotomy theorem, but many questions in this area still remain open. In the present paper this kind of questions is studied with respect to classical shop scheduling problems — job shop and open shop without preemption, as well as to their “mixture” called a mixed shop problem. Shop scheduling problems appear ubiquitously in modeling of many real-life phenomena such as manufacturing production lines, packet exchange in communication networks, timetabling, etc. They received much attention from researchers in different communities [14]. One of the fundamental goals of this research is to classify the problems into “easy” and “hard” with respect to their exact solution. Definitely, in contemporary complexity theory there are many “formal” and “informal” notions of hardness. In our paper “easy” problems are assumed to be polynomially solvable, while “hard” ones should be NP-complete or NP-hard. It was not surprising that the majority of shop scheduling problems appeared to be “hard” in the above sense. Shop scheduling problems considered in our paper are also notorious to be difficult from both practical and theoretical perspectives. Problem settings and main notation. The job shop is a multi-stage production process with the property that the jobs from a given set {J1 , . . . , . Jn } = J have to be processed on a given set of . machines {M1 , . . . , Mm } = M, and each job may have to pass through several machines. More precisely, each job Jj is represented by a chain of νj operations O1j , . . . , Oνj j , which means that operation Oi−1,j must be completed before operation Oij starts processing. Every operation Oij is preassigned a machine Mij ∈ M (on which it has to be processed without interruption) and an integral processing time or length pij . (We allow the values pij = 0, which is meaty for job-shop-type problems.) In any feasible schedule for those n jobs, at any moment in time (except maybe for a finite set of moments) every job can be processed by at most one machine and every machine can execute at most one job. The fourth parameter M taken in our paper for the complexity analysis is the problem type which will take values from the partially ordered set {J, b (J + O), (J + O)}; b here J, O, b and O stand for O, O, the job shop, the open shop, and the classical open b denote shop respectively, while (J +O) and (J + O) 1 their mixtures. On pairs of elements of this set we define a relation ≤, where X ≤ Y means that the problem type X is a sub-type of Y (equivalently, the set of instances of problem Y includes the set instances of problem X). The relation ≤ is defined b O ≤ (J + O), O b ≤ (J + for the pairs: O ≤ O, b J ≤ (J + O), (J + O) ≤ (J + O), b as well as O), for the pairs X ≤ X for all possible values X of parameter M and for all transitive closures of the above pairs. The minimum makespan among all ∗ feasible schedules will be denoted by Cmax . We will consider an infinite class of decision problems, each being a subproblem of the mixed b with an upper shop scheduling problem (J + O) bound on schedule length. The question in this decision problem is whether a feasible schedule exists under given constraints on the chosen key parameters. The constraints will be imposed by specifying upper bounds (delimiters) on the key parameters. The delimiters for the parameters M, pmax , ν, and C will be denoted by M, p̄, ν̄, and C̄ respectively. They compound a 4-dimensional vector-delimiter (M, p̄, ν̄, C̄) whose particular values define a particular representative in the class of subproblems. It should be noticed that while constraints of the type ν ≤ 3 or pij ∈ {1, 2} impose restrictions on the set of inputs of a given problem (and thereby define a subproblem), this is not the case for constraints of the type Cmax (S) ≤ C which impose restrictions on the problem output. As a direct consequence, there is a principle difference between these two types of constraints in that how they affect the problem complexity. Clearly, constraints of the type pij ≤ p̄ imposed on the set of problem inputs imply a monotonous dependance of the problem complexity on the parameter p̄ (the larger the bound p̄, the harder the problem). But this is not true with respect to the bound C imposing a constraint on the problem output. (In some cases increasing the bound C makes the problem easier.) However, considering C as part of the in- The (general) open shop differs from the job shop in that the ordering of the operations of each job is not fixed and should be chosen by the scheduler. Furthermore, in the classical open shop we additionally assume that every job may have at most one operation per machine. Finally, in a mixed shop there may be both jobs of the “open shop type” (with a non-fixed order of operations) and jobs of the “job shop type” (with chain-type precedence constraints on the set of job operations). The goal is to find a feasible schedule with the minimum makespan (or length), which in our case coincides with the maximum job completion time Cmax . In the decision problem our goal is checking the existence of a feasible schedule with length no more than a given parameter C. In this case the value of that parameter is part of the input. Clearly, each scheduling problem can be described in terms of many parameters. Beside the parameter C, in the complexity analysis of our scheduling problems we will focus on such related parameters as the maximum processing time of an operation (pmax ), and the maximum number of operations per job (ν). It is clear that tough restrictions imposed on schedule length imply also constraints on pmax and ν (at least, C bounds the number of non-zero operations per job). On the other hand, these two parameters can be considered as independent ones (which is especially true for long schedules). The dependance of the problem complexity on each of these parameters, being taken separately, was investigated in many papers (for details, see section “Known results”). 1 Although in other papers the mixed shop scheduling problem is denoted by a single letter X, it sometimes produces a mishmash (e.g., Masuda et al. [28] denote by X a different problem (F + O), where F stands for the flow shop problem). To avoid possible confusion, we decided to use the above “direct” notation for the mixed shop problems under consideration. 2 put and imposing a constraint of the type C ≤ C̄, we obtain the monotonous dependance of the problem complexity on parameter C̄ (the larger C̄, the wider the set of problem instances, the harder the problem). As mentioned above, any subproblem in the class is uniquely defined by its vector-delimiter (M, p̄, ν̄, C̄). We will use this short notation in Table 2. However, in the main part of the paper we will use the more traditional three-field notation [24] for denoting scheduling problems, where the constraints on the parameters ν, pmax , and C will be explicitly specified in the second field (in the form of inequalities), while in the first field, instead of a constraint of the form M ≤ M imposed on types of instances included into a given subproblem, we will specify just the most general problem type M. Finally, in the third field we will write either the objective function Cmax (if we speak on an optimization problem), or the inequality Cmax ≤ C (if we consider a decision problem). polynomial time, while the same procedure with respect to schedules of length 4 is NP-complete for both problems. General overview and motivation. One of the popular ways to draw a boundary between easy and hard scheduling problems with an integer valued objective function F (S) is to show for some integer K ≥ 1 that checking the existence of a schedule S with value F (S) ≤ K −1 is a polynomially solvable problem while the problem of deciding if there exists a feasible schedule S with value F (S) ≤ K is NP-complete. Note that the latter result implies also a non-approximability result: the existence of a polynomial time approximation algorithm with ratio performance guarantee better than (K + 1)/K implies P = N P . Among most popular results of this type there are those obtained for the minimum makespan objective (so called “short scheduling” results). The first example of such result in scheduling is the proof that deciding if there exists a schedule of length 3 for identical parallel machines with precedence constraints between jobs is an NP-complete problem due to Lenstra and Rinnoy Kann [25]. Later on, this approach was applied to unrelated parallel machine scheduling [27], scheduling with communication delays [15], no-wait job shop scheduling [1], and many other scheduling models. As far as shop scheduling problems with the minimum makespan objective is concerned, the first complexity analysis of “short shop” scheduling problems was performed by Williamson et al. [40], who showed that checking the existence of a feasible schedule of length 3 for a given instance of the open shop or job shop problem can be realized in 3 The first line of our research also concerns the complexity analysis of short shop scheduling problems, i.e., the dependence of the problem complexity on the parameter C and related parameters, ν and pmax . Of the most interest, to our opinion, is establishing the dependance of the problem complexity on combinations of constraints on these parameters. The main target of this (so called “multiparametric” [34]) complexity analysis is performing a complete complexity analysis on the infinite class of decision problems defined for all possible combinations of constraints on chosen key parameters, and as a convenient tool for performing such analysis we use the notion of a basis system of subproblems (see Section 7 for definitions). When such a basis system is determined and is finite, to derive the complexity of any problem in the class, it is sufficient to compare its vector-delimiter with that of every basis subproblem. If the vector is majorized by the vector-delimiter of a polynomially solvable basis subproblem, we deduce that the problem under investigation is polynomially solvable. Alternatively, if the vector majorizes the vector-delimiter of an NP-complete basis subproblem, our subproblem is also NP-complete. (By the definition of the basis system, one of the above alternatives must hold, when such a system exists.) Thus, proving the existence of a basis system in a given class of subproblems implies its dichotomy property. In the above mentioned paper [33], Schaefer proposed an alternative approach to perform a complete complexity analysis on an infinite class of problems. For satisfiability problems of boolean formulas, where each problem was defined by a finite set of boolean functions, he showed that to determine the complexity of any problem defined by a given set S, it is sufficient to check whether the set meets at least one property from a given finite list. Since each of the properties can be easily checked, this provides an efficient tool for determining the complexity of a given problem. However, to attain this goal, we need not compare the determinant set S with other sets (maybe, specifying some “basis problems”), and no such “basis problems” are defined for a given list of properties either, which demonstrates the difference between two approaches. Another line of our research concerns the question of how the mixture of different types of problems affects the problem complexity. As is known, a mixed problem may sometimes have properties drastically different from the properties of its “parts”. Such phenomenon with respect to the open shop and the job shop problems with preemption allowed and integral input data was reported in [2]. It is known that for each of the two scheduling problems there always exists an optimal schedule with integral preemptions only. However, as shown in [2], the mixture of these two problems results in a problem for which we might not be able to guarantee the integrality property for all preemptions. Furthermore, the optimal schedule length may be fractional. A similar phenomenon of appearing a new property in a mixed shop problem is demonstrated in the current paper with respect to the computational complexity issue. As proved in [40], the existence of a feasible schedule of length 3 for a given instance of the open shop or job shop problem can be checked in polynomial time. In contrast to this result, it is shown in our paper that the mixture of these two problems results in an NP-complete problem for the same question. That is why the problem type (open shop, job shop or mixed shop) is chosen in our paper for a key parameter in the multi-parametric complexity analysis. Known Results. Complexity of exact solution. Ordinary NP-hardness of job shop and open shop problems was shown in [26] and [13] already for two and three machines respectively. Their strong NP-hardness for the variable number of machines directly follows from the NP-hardness results obtained in [40] for short shop scheduling problems. Efficient algorithms are known for very restricted settings only, having either a constant number of jobs, or two machines, or special properties of processing times, etc. [5,24]. A practical proof of the intractability of these problems is that a small example of the job shop problem with 10 jobs and 10 machines suggested by Fisher and Thompson [9] in 1963 remained open for over 20 years until it was solved by Carlier and Pinson [4]. For further references and a survey of the area, see Lawler, Lenstra, Rinnooy Kan, and Shmoys [24] and Chen, Potts, and Woeginger [5]. Complexity analysis of short shop scheduling problems. Williamson et al. [40] proved that deciding if there exists a feasible schedule of length 3 and finding such a schedule can be solved in polynomial time for the open shop and job shop problems. On the negative side, they showed that the decision problems hJ | pij = 1, ν ≤ 3 | Cmax ≤ 4 i 4 and hO | pij ∈ {1, 2}, ν ≤ 3 | Cmax ≤ 4 i are NPcomplete. Analysis of problems with constraints on the parameter ν. Jackson [17] presented an exact polynomial time algorithm for the two-machine job shop problem hJ2 | ν ≤ 2 | Cmax i. Lenstra et al. [26] showed that the two-machine job shop problem becomes NP-hard even if there is only one job with three operations, while all other jobs have one operation per job. (Thus, hJ2 | ν ≤ 3 | Cmax i is NP-hard.) On the other hand, Neumytov and Sevastyanov [30] proved NP-hardness of hJ3 | ν ≤ 2 | Cmax i (even in the special case when there are only two types of job routes through machines: M1 → M3 and M2 → M3 ). It remains unknown since 1976 (when this question was posed by Gonzalez and Sahni [13]) whether the three-machine open shop problem with at most two operations per job, i.e., hO3 | ν ≤ 2 | Cmax i, is polynomially solvable or NP-hard. Two special cases of this problem were shown to be polynomially solvable. First, it was proved by Drobouchevitch and Strusevich [8] that the case with a bottle-neck machine (on which every job has one of its two operations) is polynomially solvable. Next, in [19] the problem was shown to be solvable in linear time for any class of instances in which one of machines has load at least 3pmax . Analysis of problems with constraints on the maximum processing time of an operation. First, it is well known [13] that the open shop problem b | pmax ≤ 1 | Cmax i is just the bipartite multihO graph edge-coloring problem, and therefore is polynomially solvable. In fact, a lot of complexity results were obtained for scheduling problems with unit processing times. We refer the reader to [3] and [36] for comprehensive surveys of such results and corresponding references. Complexity analysis of mixed shop scheduling problems. As demonstrated in the comprehensive survey paper by Shakhlevich et al. [35], the mixed shop problem received much attention in scheduling literature, where the problem complexity was analyzed subject to restrictions on such problem parameters as the number of machines, the number of the “job-shop-type” jobs, and the number of the “open-shop-type” jobs. Multi-parametric complexity analysis. The first complete 4-parametric complexity analysis was performed in [21] for the connected list coloring problem posed by Vizing [37]. Later on, a similar 4parametric analysis was undertaken in [20] for the open shop problem with respect to such parame- ters as the number of machines m, the maximum number of operations per machine µ, the number of jobs n, and the maximum number of operations per job ν. It was shown that if we exclude so called “trivial” subproblems from the class of subproblems generated by all possible combinations of constraints on the above four parameters, then the remaining infinite class possesses a finite basis system consisting of either 8 or 12 subproblems. (A subproblem is called “trivial”, if the total number of operations in every instance is bounded by a predefined constant or if each job consists of a single operation. — All such problems can be solved in linear time.) The exact size of the basis system will become known after obtaining a (negative or positive) answer to the above mentioned open question posed by Gonzalez and Sahni. However, even that incomplete information on the basis system enabled the authors of [20] to perform a nearly complete complexity analysis of the aforesaid class of subproblems. (In fact, the complexity status of only two subproblems remained open: hO3 | ν ≤ 2 | Cmax i and its symmetrical counterpart hO | n ≤ 3, µ ≤ 2 | Cmax i.) Some general theoretical results on multi-parametric complexity analysis were presented in [34], where the notion of the basis system of subproblems was introduced and the conditions providing the existence, the uniqueness and the finiteness of such a system were established. 3. 4. 5. 6. 7. Our Results. In this paper we study the complexity of exact solution of five shop scheduling b (J + O), and (J + O) b with the problems: J, O, O, minimum makespan objective. The problems are investigated subject to constraints imposed on the processing times of operations, on the maximum number of operations per job (ν), and on an upper bound on schedule length (C). In the complexity analysis of the class of subproblems of the b we will consider two engeneral problem (J + O) coding schemes: the “ordinary” and the “compact” one. It will be shown that they produce equivalent complexity classifications of subproblems from the considered class. Specifically, the following results have been obtained. the above algorithm for the job shop problem. Although it is known that the general graph orientation problem can be reduced to the Max Flow computation, we show that for the class of instances corresponding to the mixed shop problem there exists a linear time algorithm. Deciding if there exists a schedule of length 2 b || Cmax ≤ 2 i, is for a mixed shop, i.e., h(J + O) a polynomially solvable problem (Theorem 3). h(J + O) | pij = 1, ν ≤ 3 | Cmax ≤ 3 i is NPcomplete (Theorem 4). h(J + O) | pij ∈ {1, 2}, ν ≤ 2 | Cmax ≤ 3 i is NP-complete (Theorem 5). hO | pij ∈ {1, 2}, ν ≤ 2, µ ≤ 3 | Cmax ≤ 4 i is NP-complete (Theorem 11). This result tightens the result from [40] (that hO | pij ∈ {1, 2}, ν ≤ 3, µ ≤ 3 | Cmax ≤ 4 i is NP-complete) and closes the open question posed in [20]. (It was proved in [20] that hO | pij ≤ 3, ν ≤ 2, µ ≤ 3 | Cmax ≤ 6 i is NP-complete. Since a similar decision problem with the constraint Cmax ≤ 3 was known to be polynomially solvable [40], this left open the question on the complexity status of the problems with intermediate constraints Cmax ≤ 4 and Cmax ≤ 5. Our result fills in this gap.) The problem hJ | pij ∈ {1, 2}, ν ≤ 2 | Cmax ≤ 4 i is NP-complete (Theorem 8). (The proof of this result uses a new type of gadgets different from the ones used in [40].) We also achieved a complete complexity analysis on the infinite class of subproblems of problem b with constraints on the above mentioned (J + O) key parameters in the form of inequalities: M ≤ M, pij ≤ p̄, ν ≤ ν̄, C ≤ C̄. (1) Thus, each subproblem in the class is defined by its vector-delimiter (M, p̄, ν̄, C̄) specifying the problem type and specific constraints of type (1). As we established, the class of problems has a finite basis system consisting of ten problems (Theorem 12). Five of them, namely, those defined by the vectorb 1, 2, ∞), ((J + O), b ∞, ∞, 2), delimiters ((J + O), b ∞, ∞, 3), (O, b 1, ∞, ∞) are proved (J, ∞, ∞, 3), (O, to be polynomially solvable, while the other five, defined by the vector-delimiters ((J + O), 2, 2, 3), ((J + O), 1, 3, 3), (O, 2, 2, 4), (J, 2, 2, 4), (J, 1, 3, 4) are N P -complete. Thus, knowing the basis system not only implies the dichotomy property of this infinite class, but also enables one to easily determine the complexity of any problem in the class. 1. The job shop problem with at most two operations per job and unit processing times, i.e., hJ | pij = 1, ν ≤ 2 | Cmax i, is polynomially solvable (Theorem 1). (The algorithm is based on the bipartite edge coloring.) 2. The more general mixed shop problem h(J + b | pij = 1, ν ≤ 2 | Cmax i is polynomially solvO) able, too (Theorem 2). The algorithm is a combination of a graph orientation algorithm and Paper outline. The paper is organized as follows. In Section 2 we consider two different encod5 ηij denotes the total number of such operations. We also specify different job types and the number of jobs of each type. Thus, the input consists of the number of job types (Λ) and of a sequence of pairs (λ1 , A(1) ), ..., (λΛ , A(Λ) ), where A(k) is the vector specifying the k-th job type, and λk is the number of jobs of that type: ing schemes (both pretending to be “reasonable”, although being non-equivalent), called “ordinary” and “compact”. (Our further complexity results will be established in both encodings.) Next, in Section 3 we design polynomial time algorithms for the job shop and the mixed shop optimization problems with the minimum makespan objective in the case of at most two operations per job and unit processing times of operations. In Sections 4, 5, and 6 we provide complexity results for the mixed shop, job shop and open shop decision problems respectively with restrictions on schedule length. Basic definitions and notions of the multi-parametric complexity analysis are given in Section 7. The main result of this paper is formulated and proved in Section 8. It shows that all our results presented in the previous sections, as well as two previously known results constitute a basis system of subproblems with respect to the chosen key parameters, and therefore, none of those results can be improved. Finally, in Section 9 some further research directions are formulated. λk = |{Jj | Aj = A(k) }|. Let us illustrate these two encoding schemes by a short example. Suppose, we are given an instance of the mixed shop problem with 3 machines and 170 jobs, 120 of which are job-shop-type jobs (of two different types), and the other 50 are openshop-type jobs (all of the same type). So, there are three job types, and in the compact encoding scheme the input will look like: Λ = 3, λ1 = 20, A(1) = (1, 5, (1, 2, 2), (2, 1, 1), (1, 1, 1), (3, 2, 1), (3, 1, 2)), λ2 = 100, A(2) = (1, 2, (1, 1, 1), (2, 1, 2)), λ3 = 50, A(3) = (0, 3, (2, 1, 2), (2, 2, 1), (3, 1, 2)). As one can see, the first and the second types are job-shop-types, while the third one is an openshop-type. Each job from J1 to J20 has 7 operations on machines M1 , M1 , M2 , M1 , M3 , M3 , M3 consecutively. Each job from J21 to J120 has 3 operations on machines M1 , M2 , M2 consecutively. Finally, each job from J121 to J170 has 5 operations that should be processed on machines M2 and M3 in an arbitrary order. So, in the “ordinary” encoding scheme the input will look like: n = 170, m = 3, n0 = 120; ν1 = 7, J1 = (M1 , 2), (M1 , 2), (M2 , 1), (M1 , 1), (M3 , 2), (M3 , 1), (M3 , 1), ... ν20 = 7, J20 = − − 00 − − , ν21 = 3, J21 = (M1 , 1), (M2 , 1), (M2 , 1), ... ν120 = 3, J120 = − − 00 − − , ν121 = 5, J121 = (M2 , 1), (M2 , 1), (M2 , 1), (M3 , 1), (M3 , 1), ... ν170 = 5, J170 = − − 00 − − . (In fact, the order of listing the operations of jobs J121 to J170 may differ from job to job, because in this encoding scheme we do not care about this order for open-shop-type jobs.) Assuming that each number in the input is encoded (in both schemes) by binary digits, and all numbers are separated from each other (e.g., by commas) and the point after the last number serves as “the END of the input”, while all other signs (like Latin letters or parentheses presented 2 Encoding the input data As is known, the complexity of a problem essentially depends on the encoding scheme (e.s.) used for encoding its input data. In our complexity analysis, for encoding instances of the mixed shop problem, we will use two different encoding schemes, normally used for scheduling problems. In one of them (called an “ordinary” e.s.) each operation Oij is encoded individually by specifying its attributes Aji = (Mij , pij ). We also specify the values of two parameters: the overall number n of jobs and the number n0 of job-shop-type jobs (assuming that they have indices from 1 to n0 , while the remaining indices are allotted for the open-shop-type jobs). In another e.s. (called High Multiplicity, or “compact” e.s., for short) we define a type of each job Jj as a vector Aj = (zj , νj , Ãj1 , . . . , Ãjνj ), where zj = 0 denotes an open-shop-type job, zj = 1 denotes a job-shop-type job, and νj is the number of operation types of job Jj (rather than the number of its operations); Ãji = (Aji , ηij ) denotes the pair: an operation type (rather than a particular operation) and its multiplicity. In the case of job-shoptype jobs the operations of a given job are listed in the order of their processing, and ηij denotes the number of same-type operations that follow each other in succession. For open-shop-type jobs the operations of a given job are listed in lexicographically increasing order of operation types Aji , and 6 ∆1k + ∆2k . Since in this section we consider shop scheduling problems with unit processing times, the load of a machine is equal to the number of operations that must be processed on that machine. Since each machine can process at most one operation at a time and since every job can be processed by at most one machine at a time, we obtain the following lower bound on the optimal makespan . ∗ Cmax ≥ L = max max{∆k , ∆1k + 1, ∆2k + 1}. above just for ease of reading) are omitted, we can calculate the input size for both schemes. For the “compact” one it occurs to be 115, while for the “ordinary” scheme it is equal to 3999. It can be easily seen that both encoding schemes meet the two demands on “reasonable” encoding schemes made by Garey and Johnson [11]. Indeed, they admit decoding and are “compact enough”. However, in general, these two encoding schemes are non-equivalent. While the input size in the compact encoding can never be greater than twice the input size in the “ordinary” encoding, the inverse relation between these two amounts can be arbitrarily close to the exponent function 4x . Thus, it might be expected that for some sub-problems of the general mixed shop problem these two schemes can produce distinct complexity results. Surprisingly, as we will ascertain in this paper, for the class of problems under consideration both encoding schemes produce the same results on complexity classification. k The next theorem shows that this lower bound is tight for a special case of the job shop problem. Theorem 1 For any instance of the job shop problem hJ | pij ≤ 1, ν ≤ 2 | Cmax i there exists a sched∗ ule of length Cmax = L which can be found in polynomial time under both encoding schemes of the input data. Proof Consider the following directed multigraph → − − → G = (M, A). The vertices of G correspond to machines, and the arcs (M1j , M2j ) correspond to jobs − → Jj ∈ J , i.e., the jobs with two unit operations on different machines. Thus, ∆1k and ∆2k correspond to the outdegree and indegree of vertex Mk ∈ M. − → A linear factor in multigraph G is a subgraph such that indegree and outdegree of every vertex is at most one. Let δ = maxk max{∆1k , ∆2k } be the − → maximum semi-degree in graph G . − → Given a directed multigraph G , we can define a bipartite multigraph G0 with m vertices in each − → part by assigning to each arc (M 0 , M 00 ) ∈ G an edge (M 0 , M 00 ) ∈ G0 with M 0 in the left part and M 00 in the right part. Clearly, the maximum vertex degree of G0 is equal to δ. In the classical paper [23] König showed that the edges of such a bipartite multigraph G0 can be colored with δ colors. Applying this theorem, we can find a decomposition → − of multigraph G into δ linear factors. Let the numbers 1 to δ be arbitrarily assigned to those linear − → factors. Assign to both operations of job Jj ∈ J the number of the linear factor to which the arc (M1j , M2j ) belongs. Define the schedule, where all first operations on each machine Mk are processed in the time interval [0, ∆1k ] and all second operations are processed in the time interval [L−∆2k , L] in the increasing order of the numbers of the assigned linear factors. The feasibility of this schedule with respect to each machine Mk follows from the inequality L ≥ ∆1k +∆2k , while the feasibility with respect to each job Jj assigned to the k-th linear factor follows from the inequality L ≥ δ + 1 and the evident observation that its first operation O1j is completed 3 Polynomial Time Algorithm for the Mixed Shop Scheduling Problem with at Most Two Unit Operations per Job The multigraph edge coloring theorem due to Melnikov and Vizing [29, Theorem 2.2.1] will be reformulated in this section for the job shop scheduling problem with unit processing times. Next we show how to extend this result to the mixed shop problem. Note that the above graph coloring result was next generalized by Pyatkin [31], and then a very simple proof was provided by Vizing [38]. First it should be noted that zero-length operations can produce no collision in schedule in the case pij ≤ 1, since there are no operations of length greater than 1 that would have to be “split” by zero-length operations. Thus, we may further assume that we have unit length operations only. We partition the set of jobs into two subsets − → − → J = J ∪ Je . The subset J is the set of jobs with exactly two operations that must be processed on different machines, and Je is the set of the remaining (“easy”) jobs, each having all its operations on the same machine. Note that the original proof from [29] works in the case when Je = ∅ but can be easily generalized to handle jobs from Je . P Let ∆k = be the total load Oij |Mij =Mk pijP − p1j of machine Mk , and let ∆1k = J ∈→ j J |M1j =Mk P − p2j be the total length and ∆2k = J ∈→ j J |M2j =Mk of the first and second operations of jobs from − → J on machine Mk respectively. Obviously, ∆k ≥ 7 not later than by time k, while its second operation O1j starts not earlier than at time L − δ + k − 1. Finally, the jobs from Je can be scheduled within time periods [∆1k , L − ∆2k ] in a greedy way. The running time of this algorithm is dominated by that of the algorithm of δ-edge-coloring of the bipartite multigraph G. Applying the edgecoloring algorithm by Cole, Ost and Schirra [6], we can perform the decomposition in O(n log(δ + 1)) time. (“+1” is added for correctness, since δ = 0 is possible in our problem in the case when the set − → of jobs J is empty.) Therefore, the total running time can be bounded by O(n log µ) under the ordinary encoding scheme, where µ is the maximum number of operations per machine. For the bipartite edge coloring problem under the High Multiplicity encoding of input data there are algorithms that also perform well. For instance, the algorithm of Gabow and Kariv [10] has the running time O(mΛ log λ) (where Λ is the number of job types, λ = maxk λk , and λk is the number of jobs of the k-th type) which is, clearly, polynomial in the size of the input under this “compact” encoding. u t an orientation problem is its reduction to Hoffman’s Circulation Theorem ([32, Theorem 61.2]). Finding a circulation is equivalent to the one maximum flow computation ([32, Theorem 11.3]). Recently [39] Vizing solved a somewhat more general problem and presented an algorithm which obtains an orientation of a mixed multigraph in O(|J ||J¯|) time. In Lemma 1 formulated below we provide a more efficient way to compute the orientation O minimizing the function L(O). Let ∆ = maxk ∆k be the maximum machine − → load. In what follows the sets of jobs J¯ and J , as well as the set of arcs A and vertex degrees ∆1k , ∆2k are assumed to be variable (specified for a given partial orientation O0 of edges from E). This means that an orientation of an edge (M 0 , M 00 ) ∈ E immediately transfers the latter from E to A, and the corresponding job — from → − J¯ to J . For the subset E 0 ⊆ E of the remaining (non-oriented) edges and the set M0 of their vertices we define graph G = (M0 , E 0 ). Machine Mk will be called critical if ∆1k = ∆ or ∆2k = ∆. By Theorem 1, under any orientation O of edges from E we have ∆ ≤ L(O) ≤ ∆ + 1, We now consider the mixed shop scheduling b | pij ≤ 1, ν ≤ 2 | Cmax i. In this problem h(J + O) problem the set of jobs is partitioned into three − → → − subsets J = J¯ ∪ J ∪ Je , where J consists of jobshop type jobs with exactly two unit length operations on different machines; J¯ consists of similar open-shop type jobs, and Je consists of the remaining “easy” jobs of both types (each such job has all its operations on the same machine). On the set of vertices M we define the set E of edges (M1j , M2j ) corresponding to jobs Jj ∈ J¯. In any feasible schedule the edges from E acquire an orientation specified by the order of two operations of the corresponding jobs. Thus, specifying an orientation O on edges from E, we come to a − → job-shop problem with a new set of jobs J (O) and the corresponding values ∆1k (O) and ∆2k (O). By Theorem 1, the optimal schedule length for the obtained instance is equal to and the value L(O) = ∆ is attained if and only if there are no critical machines under orientation O. Thus, our aim is to find an orientation O which provides no critical machines (a positive answer ), or to establish that such orientation does not exist (a negative answer ). In particular, we have the negative answer at once if there exists a critical machine for the initial (empty) orientation of edges from E. Since this can be checked immediately (by a single scanning of the input data), we can further assume that the current instance contains no critical machines. The following proposition is evident. Proposition 1 The orientation problem for edges E 0 in graph G can be solved independently for each connected component of G, and the positive answer for the whole graph is attained if and only if it is attained for every connected component. u t L(O) = max max{∆k , ∆1k (O) + 1, ∆2k (O) + 1}. k Thus, while solving the orientation problem, we can assume that graph G is connected. Thus, the considered case of the mixed shop problem can be solved by minimization of function L(O) over all possible orientations O of edges from E. The orientation problems are among well-studied problems of combinatorial optimization (see the survey [32, Chapter 61]). The classical way to solve Definition 1 Given a graph G, machine M ∈ M (and the corresponding vertex) is called a no-problem machine (no-problem vertex ), if no orientation O0 of edges in E 0 can make M a critical machine. 8 Proposition 2 Machine Mk ∈ M is a no-problem machine if and only if it meets one of the following properties: (a) machine Mk contains operations of “easy” jobs; (b) ∆k < ∆; (c) ∆1k > 0 and ∆2k > 0. Due to Proposition 3, we can further assume that graph G contains no no-problem vertices. Proposition 4 If the degree of each vertex in G is at least 2, then the orientation problem has a positive answer which can be obtained in O(|E|) time. Proof If none of the properties (a)–(c) holds, it can be easily shown that machine Mk is not a noproblem machine, because there is an orientation of edges in E 0 that makes the machine critical. Indeed, in this case the degree of vertex Mk is equal to ∆, and at least one of two semi-degrees ∆1k , ∆2k is equal to zero. Let ∆2k = 0 (the case ∆1k = 0 is symmetrical). Then we can orient all edges incident to Mk as arcs outgoing of Mk , thereby making machine Mk critical. Inversely, in each of the cases (a)–(c) it is easily seen that no edge orientation can make the machine critical. u t Proof Starting with an arbitrary vertex M ∈ G and an arbitrary edge incident to M , we easily find a cycle C in graph G. Let us choose one of two possible traversals of cycle C, thereby orienting the edges of C and removing them from graph G. Then each vertex of C will get one additional incoming arc and one additional outgoing arc, thus becoming a no-problem vertex for the obtained partial orientation. After removing the edges of C the resulting graph G0 may become disconnected. But since G was connected, each vertex of G0 is connected with a (no-problem) vertex of cycle C, and we can apply the algorithm of Proposition 3 providing the positive answer. u t Proposition 3 If G is connected and contains a no-problem vertex then the orientation problem has a positive answer which can be obtained in O(|E|) time. Definition 2 Vertex M ∈ M0 of graph G (and the corresponding machine) is called sub-critical if it has the unit degree d(M ) = 1 and one of two possible orientations of the edge incident to M makes machine M critical. Proof Let M0 be a no-problem vertex in G = (M0 , E 0 ). (Due to Proposition 2, we can list all noproblem vertices in G in O(|E|) time.) By scanning the set E 0 , we construct a spanning tree T = (M0 , ET ), compute the tree-degree dT (M ) of each vertex M ∈ M0 , and orient all edges from E 0 \ ET arbitrarily. Scan the set of vertices M0 and make up the list L of leaves of T (i.e., vertices M ∈ M0 with dT (M ) = 1) except M0 . Let M ∈ L be the first leaf in the list, and let e = (M, M 0 ) be the only edge of T incident to M . If M is a no-problem vertex, orient e arbitrarily. Otherwise, M is inci− → dent to an arc e0 ∈ A in graph G defined for jobs → − from J . We may assume w.l.o.g. that e0 is an incoming arc for M . Then we make M a no-problem vertex by making e an outgoing arc for M . Delete M from G and T and decrease dT (M 0 ) by 1.If M 0 becomes a no-problem vertex under this orientation of e (which, due to Proposition 2, can be established in a constant time), we add M 0 to the list of no-problem vertices. If M 0 becomes a leaf (dT (M 0 ) = 1), we add it to the end of list L and continue the above procedure, until vertex M0 remains the only vertex of the tree. Since it was a no-problem vertex, we obtain the desired orientation with the positive answer. It is clear that all steps of the procedure can be implemented in time linear in |E 0 |. u t Suppose now that graph G contains a vertex M of degree 1. It is clear that M may be either a no-problem vertex or a sub-critical one. Since we agreed that the first case is excluded, we should only consider the case when there is a sub-critical vertex M in G. The single edge e incident to M has got the unique “positive” orientation (under which the positive answer is still possible). This justifies the following step of the orientation algorithm. Eliminating the unit-degree vertices. Compute the degrees of all vertices of graph G and make the list SC of all sub-critical vertices. Take the first vertex M ∈ SC, choose the unique “positive” orientation of its single edge e = (M, M 0 ), remove vertex M from the list and from graph G, decrease by 1 the degree of vertex M 0 . If d(M 0 ) became equal to zero, this means that e was the last edge in graph G, and that the process of orientation of edges came to an end. At that, if machine M 0 became critical, this means that the answer is negative and we could not avoid this. Otherwise, we got the positive answer. Alternatively, if d(M 0 ) became equal to 1, there may be two possible cases: M 0 may become either a no-problem machine or a sub-critical machine. 9 b |C ≤ Theorem 3 The decision problem h(J + O) 2 | Cmax ≤ C i is solvable in linear time. In the first case we can complete the orientation process with the positive answer, due to Proposition 3. In the second case we add machine M 0 to the end of list SC and continue the process. Now we are able to prove the ultimate result. Lemma 1 The problem of minimization of the function L(O) over all possible orientations O of edges from E is solvable in linear time (under both encoding schemes). Proof The described above process of eliminating the unit-degree vertices may finish with two possible outcomes. Either it exhausts all edges in G (with the positive or negative answer), or it exhausts all unit degree vertices with the positive answer which, by Proposition 4, can be found in linear time. Obviously, all parts of the described above orientation algorithm (including the algorithms of Propositions 3 and 4 and the procedure of eliminating the unit-degree vertices) can be implemented (under the “ordinary” encoding of the input data) in time linear in the number of edges. At the same time, it can be seen that the orientation algorithm is easy to implement in time O(Λ) under the “compact” encoding scheme. We just need to observe that if we have at least two parallel edges between vertices u and v in graph G, or equivalently, at least two identical “open shop type” jobs, then we can orient them in the opposite directions. Both vertices u and v become no-problem vertices after such orientation. Therefore, it suffices to consider the case when there is a unique job of each “open shop type”, and so, both encoding schemes are equivalent. This completes the proof of Lemma 1. u t Theorem 1 and Lemma 1 imply the following b | Theorem 2 The mixed shop problem h(J + O) pij ≤ 1, ν ≤ 2 | Cmax i can be solved in polynomial time under both encoding schemes. u t In the subsequent sections all results will be formulated and proved under the “ordinary” encoding of the input data. In Section 8 it will be shown that all those results are also valid under the “compact” encoding scheme. Proof Of course, at the very beginning of the checking procedure we should eliminate the case when there is a machine with load more than C or there is a job with length more than C. Next, we can obviously eliminate all zero-length operations of the open-shop-type jobs, as well as the beginning zerolength operations of the job-shop-type jobs (i.e., the operations, preceded by no non-zero operation of its job) and the ending zero-length operations of the job-shop-type jobs (i.e., the operations, succeeded by no non-zero operation of its job) — all these operations should be scheduled either at the beginning or at the end of the interval [0, C]. We can also eliminate the trivial case C ≤ 1, when the decision problem has always the positive answer. So, we can further assume that C = 2. The remaining intermediate zero-length operations of the jobshop-type jobs produce no problem for scheduling if they compete with no operation of length 2 on the same machine. Otherwise, we have got a nonresolvable collision and have to report that “no feasible schedule exists”. So, we can further assume that all operations have non-zero length. Each unit length job can be easily scheduled at the end of the checking procedure by inserting it in an arbitrary empty space on the corresponding machine. There is also no problem with scheduling jobs of length 2 each having all its operations on the same machine. So, we may further consider only the jobs of length 2 consisting of two unit operations on distinct machines. Let J¯ again denote the set of such open-shoptype jobs. It is clear that all other jobs have the only way to be placed in a schedule of length two, in some cases producing an infeasible schedule. In particular, an infeasible schedule appears when there are two “first” or two “second” unit-length operations of job-shop-type jobs on the same machine. If there exists such a collision, the answer to the question of the decision problem is “no”, and we can stop the checking procedure. Otherwise (if there is no collision), only jobs from J¯ remain unscheduled. Thus, the answer can be obtained by the algorithm of Lemma 1 in time linear in the number of jobs. u t Next we show that the problem of deciding whether a given instance of the mixed shop problem has a feasible schedule of length at most 3 is NP-complete in two special cases. While proving these NP-completeness results, we will use a reduction from the same NP-complete problem known in 4 Complexity Results for Short Scheduling of Mixed Shops In this section we consider mixed shop scheduling problems, providing a tight complexity classification for those problems. 10 the literature as MONOTONE-NOT-ALL-EQUAL3SAT. Let us formulate this classical problem. MONOTONE-NOT-ALL-EQUAL-3SAT [11]. We are given a set of boolean variables x1 , . . . , xn and a set of clauses C1 , . . . , Cm . Each clause consists of three unnegated literals of those variables. The goal is to assign values to boolean variables so that each clause would contain at least one literal with the “truth” value and at least one literal with the “false” value. An equivalent graph-theoretical formulation of this problem is known as a cut problem in a 3uniform hypergraph. In fact, the reduction schemes from the sample NP-complete problem to two special cases of the mixed shop scheduling problem have a lot in common. The common part of those constructions is described below. Suppose, we are given an instance of the MONOTONE - NOT - ALL - EQUAL - 3SAT problem. Then we construct an instance of the mixed shop scheduling problem as follows. Let ti be the number of occurrences of variable xi in clauses C1 , . . . , Cm . For each clause Cj = xj1 ∨ xj2 ∨ xj3 we define a clause machine Cj , and for each variable xi we introduce ti machines Mi1 , . . . , Miti and ti openshop-type clause jobs (one for each occurrence of variable xi ). The clause job of the k-th occurrence of xi has two unit-length operations: one on machine Mik and another on the corresponding clause machine. Although the instance of the mixed-shop problem will also contain other, non-clause jobs (they will be defined later), each clause machine will have to process only operations of clause jobs. Assume that for non-clause jobs we can guarantee the following “synchronization” property consisting of the following two parts (it will be shown later how to construct such a gadget). (a) In any feasible schedule of length 3 specified for non-clause jobs and for each variable xi the subschedule defined for machines Mi1 , . . . , Miti meets one of the following alternatives: either all those machines are simultaneously idle in the interval [2, 3] and busy in the interval [0, 2], or all those machines are idle in the interval [0, 1] and busy in the interval [1, 3]. (b) Both variants are realizable at our option independently for each i. Then we can show that there exists a schedule of length 3 for the whole mixed-shop instance, if and only if the MONOTONE-NOT-ALL-EQUAL3SAT instance is satisfiable. First assume that there is a desired assignment to variables {xi } of the MONOTONE-NOT-ALLEQUAL-3SAT instance. Let us show that there exists a schedule of length 3 for the constructed mixed-shop instance. To that end, we define a subschedule for non-clause jobs such that for each i = 1, . . . , n the machines Mi1 , . . . , Miti are kept idle in the time interval [2, 3] if xi =“truth”, and are kept idle in the time interval [0, 1] if xi =“false”. Consider now an arbitrary clause Cj = xj1 ∨ xj2 ∨ xj3 . If it has one literal with the “truth” value and two literals with the “false” values, then the operation on the clause machine Cj that corresponds to the variable with the “truth” value can be scheduled in the time interval [0, 1], while the other two operations of that machine can be feasibly placed in the time period [1, 3]. Alternatively, if clause Cj has one variable with the “false” value and two variables with the “truth” values, the operation on machine Cj that corresponds to the “false” variable should be scheduled in the time interval [2, 3], while the other two operations of that machine can be feasibly placed in the time interval [0, 2]. Inversely, assume that there exists a feasible schedule of length 3. Take the clause jobs corresponding to variable xi and consider their operations on machines Mi1 , . . . , Miti . If all those operations are scheduled in the interval [0, 1], we assign to xi the “false” value (and the corresponding clause jobs will be referred to as “false jobs”). Otherwise (if all those operations are scheduled in [2, 3]), we assign to xi the “truth” value (while its clause jobs receive the name of “truth jobs”). Thus, all variables xi receive their values. Now consider a clause Cj . Since the corresponding clause machine Cj is feasibly scheduled in the interval [0, 3], one of its operations (scheduled in the interval [0, 1]) definitely cannot be a “false job”. Therefore, it corresponds to a variable received the “truth” value. Another operation on machine Cj (scheduled in the interval [2, 3]) cannot be a “truth job”, and therefore, it corresponds to a variable received the “false” value. Thus, the desired NOT-ALLEQUAL property holds for each clause Cj . It remains to show how to define the “gadget” on machines Mi1 , . . . , Miti providing their “synchronization” property. This can be done in different ways for two special cases considered in Theorems 4 and 5. Theorem 4 The mixed shop scheduling problem h(J + O) | pij = 1, ν ≤ 3 | Cmax ≤ 3 i, i.e., the problem of deciding whether a given instance of the mixed shop problem with at most 3 operations 11 per job and unit processing times has a schedule of length at most 3, is NP-complete. direction — in the decreasing order of indices {k}. This provides part (a) of the “synchronization” property. Since it is clear that both variants are realizable, part (b) of the “synchronization” property is also valid, which completes the proof of Theorem 4. u t Proof The “gadget” for machines Mi1 , . . . , Miti is described in Fig. 1. M''i,k-1 M ik M'ik M''ik M''i,k+1 xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx clause machine xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx - clause job xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx - assignment job JikA xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx - blocking job xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx Theorem 5 The mixed shop scheduling problem h(J + O) | pij ∈ {1, 2}, ν ≤ 2 | Cmax ≤ 3 i, i.e., the problem of deciding whether a given instance of the mixed shop problem with at most two operations per job and processing times 1 or 2 has a schedule of length at most 3, is NP-complete. B Jik - consistency job JikC Proof The “gadget” for machines Mi1 , . . . , Miti is described in Fig. 2. C - consistency job Ji,k-1 Fig. 1 The machine block in the gadget of Theorem 4 corresponding to xik M''i,k-1 For each occurrence xik of variable xi we use, beside the machine Mik and the clause job, two 0 00 auxiliary machines Mik and Mik and tree auxB iliary jobs: a job-shop-type blocking job Jik consisting of three operations that must be processed 0 0 on machines Mik , Mik , Mik in this order; a jobC shop-type consistency job Jik whose two opera00 00 tions must be processed on machines Mik , Mi,k+1 00 in a cyclic manner (i.e., machine Mi,t coincides i +1 00 with Mi1 ); and an open-shop-type assignment job A Jik consisting of three operations that must be pro0 00 cessed on machines Mik , Mik , Mik in an arbitrary order. Since the interval [1, 2] is occupied on Mik by B job Jik , it leaves two variants for the assignment A job Jik to be processed on that machine: either in [0, 1] or in [2, 3]. If it is the second variant (like in A Fig. 1), then job Jik occupies the interval [0, 1] on 00 C machine Mik , which leaves to job Jik the only pos00 sibility to be processed: starting on machine Mik in the interval [1, 2], it has to finish on machine 00 Mi,k+1 in [2, 3]. This, in turn, leaves the only possiA bility for the assignment job Ji,k+1 to be processed on that machine: only in the interval [0, 1], thus repeating the schedule configuration of the previous A assignment job Jik . Thus, cyclically rounding the machine blocks corresponding to occurrences xik of variable xi in the increasing order of their indices, we establish the identity of schedule configurations of those blocks. Alternatively, in the case when the assignment job A Jik chooses its first variant, we again establish the identity of schedule configurations, but this time by rounding the machine blocks in the opposite 12 Mik M''ik M''i,k+1 xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx clause machine - clause job xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx - assignment job JikA xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx - consistency jobs JikC xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx - consistency jobs C Ji,k-1 Fig. 2 The machine block in the gadget of Theorem 5 corresponding to xik Here for each occurrence xik of variable xi , we define, beside the machine Mik and the clause job, 00 one auxiliary machine Mik and two auxiliary jobs: C a job-shop-type consistency job Jik consisting of two unit-length operations that must be processed 00 00 on machines Mik , Mi,k+1 in a cyclic manner (i.e., 00 00 ); and an openmachine Mi,ti +1 coincides with Mi1 A shop-type assignment job Jik consisting of two operations (of length 2 and 1) that must be respec00 in an tively processed on machines Mik and Mik arbitrary order. There is no need to present here the proof for the “synchronization” property of the garget, since it is absolutely similar to that presented for Theorem 4. u t 5 Complexity Results for Short Scheduling of Job Shops In this section we present a few NP-completeness results for the job shop problem with a constant bound on schedule length. The following results were previously known. has both negated and unnegated occurrences in formula F (otherwise such a variable can be eliminated together with the corresponding clauses). Assume that variable xi has ti occurrences in formula F denoted as xi1 , . . . , xi ti , and that all unnegated literals (xij = xi ) receive the numbers 1 to ui , while negated ones (xij = x̄i ) receive the numbers ui + 1 to ti . Pk Let N = i=1 ti = 3m denote the total number of occurrences in formula F . We define the corresponding instance I of the hJ | pij ∈ {1, 2}, ν = 2 | Cmax ≤ 4 i problem consisting of 3N + 4k + m machines and 4N + 4k jobs, each consisting of two operations: J = (X1 (y1 ), X2 (y2 )), where Xi denotes the machine processing the i-th operation, and yi denotes the length of that operation. For each variable xi we specify a machine block Mi consisting of Theorem 6 (Williamson et al. [40]) The job shop problem hJ | pij = 1, ν ≤ 3 | Cmax ≤ 4 i, i.e., the problem of deciding whether a given instance of a job shop with at most three operations per job and unit processing times has a schedule of length at most 4, is NP-complete. The matching positive result is obtained by a reduction to the well-known 2SAT problem. Theorem 7 (Williamson et al. [40]) The decision problem hJ || Cmax ≤ 3 i is polynomially solvable. Although Theorem 7 does not provide an answer to the question on the complexity of similar decision problems hJ || Cmax ≤ C i with C = 1 or 2 (which are not subproblems of the problem with C = 3), we can easily design polynomial time procedures for solving these decision problems by implementing the algorithm of Theorem 1 (and by a preliminary elimination of the operations of length 0 and 2). Thus, we can obtain the following – ui + 1 A-machines Aij (j = 0, . . . , ui ) and ui B-machines Bji (j = 1, . . . , ui ) corresponding to unnegated literals of variable xi ; – (ti − ui + 1) “negated” Ā-machines Āij (j = ui , . . . , ti ) and (ti − ui ) “negated” B̄-machines B̄ji (j = ui +1, . . . , ti ) corresponding to negated literals of variable xi ; – ti machines Eji (j = 1, . . . , ti ) corresponding to literals xij ; – two synchronizing machines D1i and D2i for synchronizing the schedules of negated and unnegated machines of block Mi . Corollary 1 The decision problem hJ | C ≤ 3 | Cmax ≤ C i is polynomially solvable. u t Theorems 1, 6 and 7 raise a natural question. What is the complexity status of the job shop scheduling problem with at most two operations per job and non-unit processing times? Besides, we introduce m clause machines Cν (ν = 1, . . . , m) corresponding to clauses Cν (ν = 1, . . . , m). For each literal xij we define 4 jobs, each consisting of two operations: 1 2 Jij = (Ãij−1 (2), B̃ji (1)), Jij = (Ãij (1), B̃ji (1)), i i 4 3 Jij = (Ej (1), B̃j (1)), Jij = (Eji (1), Cν(i,j) (1)), where à = A, B̃ = B for unnegated literal xij = xi and à = Ā, B̃ = B̄ for negated literal xij = x̄i ; here ν(i, j) denotes the index of the clause containing the literal xij . Finally, for each variable xi we define 4 synchronizing jobs: (Ai0 (1), D1i (1)), (Āiui (1), D1i (1)), (Aiui (2), D2i (1)), (Āiti (2), D2i (1)). Suppose that for so defined instance I of the job shop problem there exists a schedule S of length 4. Let us show that there exists an assignment of values to variables x1 , . . . , xk such that each clause Cν (ν = 1, . . . , m) receives the truth value. The assignment of values will be fulfilled in three stages. At the first stage we assign the “truth” value to some literals. It will be shown that the Theorem 8 The decision problem hJ | pij ∈ {1, 2}, ν = 2 | Cmax ≤ 4 i, i.e., the problem of deciding whether a given instance of the job shop problem with two operations per job and processing times 1 or 2 has a schedule of length 4, is NP-complete. Proof First we define the classical NP-complete problem 3SAT [11]. In this problem we are given a set of boolean variables x1 , . . . , xk and a set of clauses C1 , . . . , Cm . Each clause consists of three literals. Each literal is either a variable xi or its negation x̄i . The goal is to find a “truth” assignment to variables xi such that each clause contains at least one “truth” literal. We construct a reduction from 3SAT to our job shop problem. It will be shown that a 3SAT instance F (that will be referred to as formula F ) is satisfiable if and only if the corresponding job shop instance I has a schedule of length 4. Given a formula F , we assume that each clause consists of exactly three literals (otherwise we can duplicate some of its literals) and each variable 13 assignment does not produce a contradiction, i.e., the situation when two opposite literals (an unnegated literal and a negated one) of the same variable receive the “truth” value. At the second stage we assign the “truth” value to those variables that have some of its unnegated literals assigned the “truth” value, and we assign the “false” value to those variables that have some of its negated literals assigned the “truth” value. At the third stage, we assign arbitrary values to the remaining variables. It is clear that only the first stage needs a detailed description, which follows. We start the analysis of schedule S from clause machines Cν . Clearly, each machine Cν processes its three unit length operations in the time interval [1, 4], and one of those operations has to be processed in the interval [1, 2]. Given a clause Cν 0 , let xij be the literal whose operation Cν(i,j) (1) is processed in the time interval [1, 2] on the corresponding clause machine Cν 0 (ν 0 = ν(i, j)). We assign the “truth” value to the literal xij . Thus, in each clause there is a literal which receives the “truth” value. It remains to show that such an assignment produces no contradiction, i.e., two opposite literals of the same variable xi cannot be assigned the “truth” value. Suppose to the contrary that an unnegated literal xij 0 = xi and a negated literal xij 00 = x̄i receive the “truth” value. Consider the schedule of the “left” part of block Mi (corresponding to unnegated literals of variable xi according to Fig. 3). Since we know that the second operation of job 4 i Jij 0 = (Ej 0 (1), Cν(i,j 0 ) (1)) is scheduled in the interval [1, 2], we may conclude that its first operation Eji 0 (1) takes the interval [0, 1]. This implies that 3 i i the first operation of job Jij 0 = (Ej 0 (1), Bj 0 (1)) starts at time 1 or later and finishes its processing not earlier than at time 2. Therefore, its second operation Bji 0 (1) can only be processed within the time interval [2, 4] on machine Bji 0 . The same is 1 i true for the second operation of job Jij 0 = (Aj 0 −1 (2), i Bj 0 (1)) since the length of the first operation is 2. This implies that the second operations of jobs 1 3 Jij 0 and Jij 0 occupy the whole interval [2, 4] on machine Bji 0 . Thus, the second operation of job 2 i i Jij 0 = (Aj 0 (1), Bj 0 (1)) can only be processed in the unique feasible time slot on machine Bji 0 , that is, in the time interval [1, 2], whereas the first operation of this job has to be scheduled on machine Aij 0 in the time interval [0, 1]. Another operation on this machine has length 2 and is completed exactly at time 3. It belongs to 1 0 either job Ji,j 0 +1 (in case that j < ui ) or the syn14 xxxxxxxxxxx xxxxxxxxxxx Clause machine C ν(i1,j1) xxxxxxxxxxx xxxxxxxxxxx i i E j11 E ji22 E j33 xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx i A0 xxxxxx xxxxxx xxxxxx xxxxxx B1 C ν(i,j) xxxxxx xxxxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxx i Ej xxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xxxxxx xxxxxx A j-1 xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx A ij C ν(i,p(i)+1) i A p(i) xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx i B ij i D1 xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx i B j-1 i xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxx xxxx xxxx xxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxxxxxx xxxxxx i xxxxxxxxxx xxxxxx B p(i)+1 xxxxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxx i xxxxxx xxxxxxxxxxxx A p(i)+1 xxxxxx xxxxxxxxxxxx xxxxxxxxxxxx i E p(i)+1 xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxxx xxxxxx xxxxxx B ij+1 xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx A ip(i)xxxxxx xxxxxx xxxxxx xxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxx i xxxxxxx D 2 xxxxxxx xxxxxxx i A n(i) Fig. 3 Machine block Mi and a clause machine chronizing job (Aiui (2), D2i (1)) (in case j 0 = ui ). In 1 the first case, the second operation of job Ji,j 0 +1 has to be processed in the time interval [3, 4]. This 2 implies that the second operation of job Ji,j 0 +1 = i i (Aj 0 +1 (1), Bj 0 +1 (1)) must be processed in somewhere in the time interval [1, 3]. Therefore, its first operation cannot be processed on machine Aij 0 +1 after the operation Aij 0 +1 (2). Thus, it should be processed first in the time interval [0, 1], while the operation Aij 0 +1 (2) should be processed after in the time interval [1, 3], and this property is passed over to all subsequent Ai -machines, till the last machine Aiui . Thus, the second operation of the synchronizing job (Aiui (2), D2i (1)) has to be scheduled on machine D2i in the only possible time interval [3, 4]. The same conclusion follows from the assumption that a negated literal xij 00 = x̄i received the “truth” value. But machine D2i is able to process only one operation in the time interval [3, 4], which means that both assumptions cannot be true simultaneously. Thus, we proved that no contradiction can arise at the first stage of our value assignment procedure. We obtained that our procedure provides the desired assignment to variables {xi } at which all clauses receive the “truth” value. It should be noted here that the construction of our blocks Mi is somewhat redundant. This is done for the sake of simplicity and more rigidity of schedule S. Indeed, it can be shown that schedule S has the following rigid property. In case that an unnegated literal xij = xi receives the “truth” value, at the first stage all Aij (1)-operations (j = 0, . . . , ui ) have to be processed on the corresponding A-machines prior to all Aij (2)-operations, while all Āij (1)-operations (j = ui , . . . , ti ) should be processed after all Āij (2)-operations. In the opposite case that a negated literal xij = x̄i receives the “truth” value, all Aij (1)-operations have to be processed after all Aij (2)-operations, whereas all Āij (1)operations have to be processed prior to all Āij (2)operations. In other words, at the second stage we can assign to variable xi the boolean value: [2, 4], which completes the construction of the desired schedule of length 4. Thus, we proved that a schedule of length 4 for so constructed instance I exists if and only if there exists an assignment for variables of formula F providing the “truth” value for each clause Ci . Theorem 8 is proved. u t 6 Complexity Results for Short Scheduling of Open Shops Tight complexity analysis of the open shop problem with respect to the single parameter, an upper bound on schedule length, was performed in the paper by Williamson et al. [40]. In this section we extend their positive result in Corollary 2 and strengthen their negative result in Theorem 11. xi := “all Aij (1)-operations precede all Āij (1)-operations” Now let us prove the reverse statement. Suppose that there exists an assignment of values to variables x1 , . . . , xk providing the “truth” value to each clause Cν (ν = 1, . . . , m). We prove that for the instance I there exists a schedule S of length 4. For each variable xi we first organize a schedule of length 4 for the operations of block Mi . Let us first consider the operations related to those literals of this variable which received the “false” value. For instance, let they be unnegated literals xij = xi . Then we sequence the corresponding Aij (1)-operations on each A-machine of block Mi after the Aij (2)-operations, while on the Āmachines the order of these operations is reverse: first we process Āij (1)-operations and after that we process the Āij (2)-operations. Then each Bmachine in the left part of block Mi will be busy in the interval [2, 4], and so, we have to schedule 3 the first operation of each job Jij in the interval [0, 1], while retaining the interval [1, 2] to the 4 first operation of job Jij . Thus, the second opera3 tion of “false” job Jij (related to the false literal xij ) can only be scheduled on the corresponding clause machine in the time interval [2, 4]. Since there are at most two false literals per clause we have enough capacity in the interval [2, 4] to process corresponding second operations. On each B̄-machine in the right part of block Mi (currently containing “truth” jobs and opera2 tions) the jobs are sequenced in the order: Jij → 3 1 Jij → Jij . This provides the possibility to sched3 ule the first operation of job Jij in the interval [1, 2], while retaining the interval [0, 1] on machine 4 Eji for the first operation of job Jij . So, its second (“truth”) operation comes to the corresponding clause machine at time 1 and can be easily scheduled in the interval [1, 4]. It is also easily seen how to schedule the operations on machines D1i and D2i in the interval Theorem 9 (Williamson et al. [40]) The decision problem hO | pij ∈ {1, 2}, ν ≤ 3 | Cmax ≤ 4 i, i.e., the problem of deciding whether a given instance of the open shop problem with at most three operations per job and processing times 1 or 2 has a schedule of length at most 4, is NP-complete. The corresponding positive result is obtained by using an algorithm for weighted bipartite matching. Theorem 10 (Williamson et al. [40]) The decision problem hO || Cmax ≤ 3 i is polynomially solvable. Although Theorem 10 does not directly provide an answer to the question on the complexities of similar decision problems hO || Cmax ≤ C i with C = 1 and C = 2, the polynomial time algorithm from [40] can be easily adopted to these cases, too. Furthermore, the algorithm successfully provides a (positive or negative) answer for the more general b (just because the bipartite open shop problem O edge coloring algorithm that the algorithm from [40] uses for unit-length operations works equally successfully both for graphs and multi-graphs). Thus, we can derive the following b|C ≤ 3| Corollary 2 The decision problem hO Cmax ≤ C i is polynomially solvable. t u The following theorem is a refinement of the above negative result (Theorem 9) to a more restrictive set of instances with at most two operations per job. Theorem 11 The open shop problem hO | pij ∈ {1, 2}, ν ≤ 2, µ ≤ 3 | Cmax ≤ 4 i, i.e., the problem 15 of deciding if a given instance of an open shop with at most two operations per job, at most three operations per machine, and processing times 1 or 2 has a schedule of length at most 4, is NP-complete. 1 Mi1 Pij Qij Aij Bij Machine 1 Mij Cν(i,j) 2 Mi,j−1 3 Mij Length 2 1 2 1 Operation Cij Dij Eij Fij Machine 3 Mij 1 Mij 2 Mij 3 Mij 1 2 2 2 Length Pi1 A i2 E i1 (a) Assignment block for the 1st appearance (x i1) of variable xi Clause machines 2 Mi,j-1 A ij C1 1 D ij Mij 2 A i,j+1 3 Mij F ij Mij P ij E ij Qij Cij Bij C ν(i,j) Cm (b) Assignment block for literal x ij(j>1) Proof Again, we reduce the MONOTONE-NOTALL-EQUAL-3SAT to our problem. Suppose, we are given an instance F of that problem represented by a set of clauses {C1 , . . . , Cm }. It will be referred to as “the formula”. W.l.o.g we may assume that each clause consists of exactly three literals. Otherwise, if a clause consists of only two literals, we can add a copy of one of those two literals. Let xij be the j-th occurrence of variable xi in the formula F . Now we construct an instance I of hO | pij ∈ {1, 2}, ν ≤ 2, µ ≤ 3 | Cmax ≤ 4 i as follows. For each clause Cν we define a clause machine Cν . With each occurrence xij of variable xi we associate a clause job with operations (Pij , Qij ), and an assignment block ABij with additional machines and jobs that controls the assignment to the literal xij . For the first occurrence xi1 of variable xi block 1 2 ABi1 consists of two machines Mi1 and Mi1 and one job (Di1 , Ei1 ) (see Fig. 4(a)). For each of the subsequent occurrences xij (j > 1) block ABij 1 2 3 consists of three machines Mij , Mij , Mij and three jobs (Aij , Bij ), (Cij , Dij ), (Eij , Fij ) (see Fig. 4(b)). The length of each operation and the processing machine are specified in Table 1. Operation D i1 ... 2 Mi1 Fig. 4 Assignment blocks and clause machines Suppose that there exists a schedule of length 4 for the instance I. Assign to xij the value: xij = “Qij is in the first half of the makespan”(2) It can be easily seen from Fig. 4 that the assignment blocks guarantee synchronized positions for all Pij -operations corresponding to variable xi . Indeed, if Pi1 is processed in the second half of the makespan (as in Fig. 4), then Ai2 (if there is a second occurrence of xi ) has to be processed in the interval [0, 2] (in the same, 1-st assignment block of variable xi ). This forces the operations Bi2 and Ci2 to be processed in the second half of the interval [0, 4]. So, the operations Di2 and Fi2 have to be scheduled in the interval [0, 2], which forces the operations Pi2 , Ei2 to be scheduled in the interval [2, 4]. Again, Ai3 (if any) has to be scheduled in the interval [0, 2], and so forth. Thus, all literals xij of the same variable xi receive the same value which thereby can be assigned to variable xi . Since three operations Qij corresponding to three literals of the same clause cannot be placed in the same half of the makespan, this implies the NOT-ALL-EQUAL property for each clause. The inverse statement is proved automatically. Suppose that there exists a desirable assignment for the variables xi of formula F satisfying the NOT-ALL-EQUAL property. Place the Qij -operations according to (2) and the values (“truth” or “false”) of the corresponding literals xij . The location of the Qij -operations predetermines the location of all other operations in the assignment blocks and on the clause machines (to a transposition of the neighboring operations Bij and Cij and a transposition of the neighboring Q-operations located in the same half of the makespan on the same clause machine, which is immaterial). Theorem 11 is proved. t u Table 1 Operations and their parameters Edges in Fig. 4 connect operations of the same job. Dashed block designates the vacant place for the A-operation of the next occurrence of variable xi (if any). Obviously, the input length of the instance I is bounded above by a polynomial of the input length of formula F . We now show that for the instance I there exists a schedule of length 4, if and only if for the formula F there exists a “truth” assignment satisfying the property NOT-ALL-EQUAL. 7 Multi-parametric complexity analysis In this section we give a short introduction to the multi-parametric complexity analysis of discrete problems and give some basic notions. 16 Normally, each discrete problem can be described in terms of many parameters, and the boundary separating easy and hard cases can be drawn between some “boundary values” of those parameters. One of such parameters is normally treated as the key parameter with respect to which we perform our complexity analysis of the problem under consideration. In one case this may be the number of machines, in another case this is an upper bound on the number of operations per job, in a third case this is an upper bound on schedule length, etc. Imposing constraints on the key parameter, we thereby define a subproblem of the original problem. ever, the complexity analysis of the problem with respect to each particular parameter still cannot provide us the whole picture of the problem complexity. Much more informative is investigating the problem complexity with respect to various combinations of constraints simultaneously imposed on several key parameters. Such a multi-parametric complexity analysis represents much more difficulties, and the very first question that arises here is the question of completeness of the analysis. The question becomes nontrivial when the number of jointly investigated key parameters becomes greater than three. In this case the notion of a basis system of subproblems relieves a lot. In our paper we consider the most simple and natural type of constraints, when an upper bound x̄ on the admissible values of a key parameter x is specified. Such a bound is called a delimiter. The subproblem Px0 corresponding to a given value x0 of x̄ consists of all instances with values of x ≤ x0 . All possible values of x̄ define a family of subproblems {Px̄ | x̄ ∈ X̄}. This notion was first introduced explicitly in [34], although similar notions (like a system of basis classes of inputs or a system of basis classes of individual problems) were used earlier in [21] and [20]. Suppose that n key parameters (x1 , . . . , xn ) are chosen for the complexity analysis of a given problem P. Then χ(I) = (x1 (I), . . . , xn (I)) will be called a characteristic vector of a given instance I. Let Xi be the set of values of parameter xi , and X̄i ⊇ Xi be an extended set of values. (It will be explained further why we need extended sets of values and what they mean.) We assume that X̄1 , . . . , X̄n are partially ordered sets. Then we can define a partial order on the set X̄ of n-dimensional vectors x̄ = (x̄1 , . . . , x̄n ), x̄i ∈ X̄i . For two vectors x0 = (x01 , . . . , x0n ), x00 = (x001 , . . . , x00n ) ∈ X̄ we write x0 ≤ x00 , if x0i ≤ x00i for all i = 1, . . . , n. Clearly, any two subproblems Px0 , Px00 defined for two different values x0 < x00 of the delimiter x̄ are dependent, namely, Px0 is a subproblem of Px00 , since each problem instance included in Px0 is also included in Px00 . Sometimes a special case of a problem can be encoded more efficiently than the general one. As a result, we may run into a paradoxical situation when a “subproblem of a polynomial time solvable problem is NP-hard”. To avoid such situations, we accept the agreement that every instance of a problem P uses the same encoding scheme within any subproblem of P (including problem P itself). This agreement provides the property that a subproblem can never be harder than a super-problem (from the computational complexity point of view). As a consequence, for any value x0 of the delimiter x̄ the polynomial solvability of the subproblem Px0 implies the polynomial solvability of any subproblem Px00 with x00 ≤ x0 , while the N P -completeness of Px0 implies the N P -completeness of any subproblem Px000 with x000 ≥ x0 . If we are lucky to discover a “boundary value” x0 of x̄ such that for all x00 < x0 the subproblems Px00 are polynomially solvable, while for all x00 ≥ x0 they are N P -complete, we thereby have the dichotomy property for that (may be, infinite) parameterized family of subproblems. Every vector x̄ ∈ X̄ defines a subproblem Px̄ = {I ∈ P | χ(I) ≤ x̄} of problem P and is called a vector-delimiter of problem Px̄ . Thus, we have a class of subproblems P(X̄ ) = {Px̄ | x̄ ∈ X̄ } over all possible values of the vector-delimiter, and we would like to establish the complexity of each subproblem in this class. Let us explain here why we need extended sets of values for delimiters of some parameters. In the case of a numerical parameter xi (e.g., xi is the number of jobs in a given instance) we may permit only finite values of it (since we cannot consider problem instances with infinite input size). Meanwhile, the infinite value of the delimiter x̄i is sensible, because it enables us to consider subproblems containing instances with arbitrarily large values of parameter xi . In this case we extend the set of values of the delimiter x̄i by the infinite value “∞”. As we already mentioned, each discrete problem normally depends on lots of parameters, and each of them can be taken for the key parameter in the complexity analysis of the problem. How- Let PP (X̄ ) and PN P (X̄ ) denote the subclasses of class P(X̄ ) consisting of all polynomially solvable and all N P -complete subproblems respectively, and let X̄P = {x̄ ∈ X̄ | Px̄ ∈ PP (X̄ )} and X̄N P = 17 {x̄ ∈ X̄ | Px̄ ∈ PN P (X̄ )} denote the sets of their vector-delimiters. When the equality P(X̄ ) = PP (X̄ ) ∪ PN P (X̄ ) holds, we say that class P(X̄ ) of subproblems possesses the dichotomy property. case of complexity analysis with respect to a single numerical parameter x that may take arbitrarily large values. It may happen that for any finite value x0 of the delimiter x̄ the corresponding subproblem Px0 is polynomially solvable, while the subproblem P∞ is NP-complete. Then the set X̄Pmax of maximal elements of the set X̄P is empty and cannot majorize X̄P . (In the case of multiparametric analysis the proof of this fact is more sophisticated, but uses the same idea.) So, the pair (X̄Pmax , X̄Nmin P ) does not constitute a fully representative system of vectors (property (c) does not hold), and by Lemma 2, there is no basis system of subproblems. At the same time, there exists a fully representative system of vectors in the set X̄ . (As a consequence, the dichotomy property holds.) In the current paper we establish the existence of a finite basis system for the class of subproblems b deof the mixed shop scheduling problem (J + O) fined by simultaneous constraints on the parameters: M, pij , ν, C. Definition 3 We say that a couple of sets (X 0 , X 00 ) with X 0 , X 00 ⊆ X̄ is a fully representative system of vectors in X̄ , if (a) for any vector x̄ ∈ X 0 problem Px̄ is polynomially solvable; (b) for any vector x̄ ∈ X 00 problem Px̄ is N P complete; (c) any vector x̄ ∈ X̄ is either majorized by X 0 or minorized by X 00 (the latter means that x̄ majorizes some vector from X 00 ). The corresponding couple of sets of subproblems (P(X 0 ), P(X 00 )) is called a fully representative system of subproblems in the class P(X̄ ). It can be seen that if in a fully representative system (X 0 , X 00 ) we have two comparable vectors either in X 0 or in X 00 , then the lesser one can be removed from X 0 in the first case and the larger one — from X 00 in the second case. In both cases the system of vectors remains fully representative. Ideally, to perform the verification of property (c) most efficiently, we are interested in finding a somewhat minimal fully representative system of vectors, in which no two vectors in X 0 (as well as no two vectors in X 00 ) are comparable. If a fully representative system of vectors with this “incomparability” property exists, it coincides with the couple of sets (X̄Pmax , X̄Nmin P ) consisting of all maximal vectors in X̄P and all minimal vectors in X̄N P . In this case the corresponding fully representative system of subproblems is called a basis system of subproblems. From the above definitions we immediately have 8 Complete 4-parametric complexity analysis of the mixed shop problem As was said above, for the multi-parametric complexity analysis we choose the following key parameters: the type of the model (M), the maximum processing time of an operation (pmax ), the maximum number of operations per job (ν), and the upper bound on schedule length (C); χ(I) = (M, pmax , ν, C) stands for the characteristic vector of a given problem instance I. The set X̄ of possible values of the vector-delimiter x̄ = (M, p̄, ν̄, C̄) is defined as X̄ = M × N̄ × N̄ 00 × N̄ 00 , where M = b J, (J + O), (J + O)}, b N̄ = {0, 1, . . . } ∪ {∞}, {O, O, and N̄ 00 = N̄ \ {0, 1}. We consider the infinite class of subproblems P(X̄ ) = {Px̄ | x̄ ∈ X̄ } of the general mixed shop b where each subproblem Px̄ is problem (J + O), defined by its set of instances: Px̄ = {I | χ(I) ≤ x̄}. For the purposes of our analysis we focus on ten subproblems from the class P(X̄ ) whose vectordelimiters are listed in Table 2. Lemma 2 For a parameterized class of problems P(X̄ ) a basis system of subproblems exists if and only if the couple of sets (X̄Pmax , X̄Nmin P ) represents a fully representative system of vectors in X̄ . u t An example of a class of problems P(X̄ ) having no basis system of subproblems was presented in [20], where it was shown that for the class of subproblems of the open shop problem defined by all combinations of constraints on the key parameters (n, ν, m, µ) (the number of jobs, the maximum number of operations per job, the number of machines, the maximum number of operations per machine), the set X̄Pmax does not majorize X̄P . Such a situation can be easily illustrated in the Theorem 12 Ten problems defined by the vectordelimiters listed in Table 2 constitute a basis system of subproblems in class P(X̄ ). Proof The complexity status of all ten basis subproblems is confirmed in the corresponding theorems (see the Third column of Table 2). The incomparability of any two vector-delimiters defining 18 No. x̄1 x̄2 x̄3 x̄4 x̄5 x̄6 x̄7 x̄8 x̄9 x̄10 Problem Px̄i , x̄i = (M, p̄, ν̄, C̄) b 1, 2, ∞) ((J + O), b ∞, ∞, 2) ((J + O), Complexity References (J, ∞, ∞, 3) b ∞, ∞, 3) (O, b 1, ∞, ∞) (O, P P P P P Theorem 2 Theorem 3 Corollary 1 Corollary 2 Gonzalez and Sahni [13] ((J + O), 1, 3, 3) ((J + O), 2, 2, 3) (O, 2, 2, 4) (J, 2, 2, 4) (J, 1, 3, 4) NP-compl. NP-compl. NP-compl. NP-compl. NP-compl. Theorem 4 Theorem 5 Theorem 11 Theorem 8 Williamson et al. [40] a constant upper bounds on schedule length are considered. It can be easily seen that the positive answer for these decision problems is possible for those instances only that have only jobs from a very restrictive set of types (characterized by a limited number of non-zero operations and restricted processing times of operations). The existence (in a given instance) of jobs of other types can be established by the direct looking through the input, which immediately gives the negative answer. In the “positive” case of this verification (when we come to the conclusion that there are no “infeasible” types of jobs), and after the elimination of all jobs having no positive-length operations, it can be seen that there can be at most a constant number of jobs of each type. Therefore, the “compact” encoding is equivalent (by the size of the input) to the “ordinary” encoding scheme, where each job is encoded individually. That is why the complexity results for such problems are equivalent under both encoding schemes. (This provides polynomial solvability of problems Px̄i , i = 2, 3, 4, under the “compact” encoding scheme.) Finally, to ascertain in the polynomial solvability of problem Px̄5 , we can represent its (unit length) operations by edges in an m × n bipartite multi-graph G (where m and n denote the number of machines and the number of jobs) and then apply, for instance, the algorithm by Cole, Ost, and Schirra [6], providing an optimal solution of the corresponding edge-coloring problem in O(M log D) time, where M and D denote the number of edges and the maximum vertex degree in G. This provides a polynomial solvability of our problem in O(|I|oe ·log |I|oe ) time under the “ordinary” encoding (where |I|oe denotes the input size in that encoding). The same problem under the “compact” encoding can be solved in O(min{m, n}|I|2ce ) time by applying the ideas of Gonzalez and Sahni [13] and Gonzalez [12] (where |I|ce denotes the input size in this encoding). As far as N P -completeness results is concerned, the problems Px̄i (i = 6, . . . , 10) whose strong N P completeness was proved under the “ordinary” encoding scheme, cannot be “easier” for more compact encoding of the input data (in particular, for our “compact” encoding scheme). Thus, due to Theorem 12, we have the following Table 2 The basis system of subproblems of class P(X̄ ) polynomially solvable problems (as well as the incomparability of any two vector-delimiters defining N P -complete problems) can be directly checked. Thus, it only remains to show that two sets of vectors — X 0 (the first five vectors in Table 2) and X 00 (the last five vectors) constitute a fully representative system of vectors in X̄ . To that end, we should confirm that every vector x̄ = (M, p̄, ν̄, C̄) ∈ X̄ is either majorized by X 0 or minorized by X 00 . If (p̄ ≤ 1)& (ν̄ = 2) then vector x̄ is majorized by vector x̄1 . So, we further assume that either p̄ ≥ 2 or ν̄ ≥ 3. Any vector x̄ with C̄ = 2 is majorized by vector x̄2 . So, we further consider only cases C̄ ≥ 3. b vector x̄ Case C̄ = 3. If M = J or M ≤ O, is majorized by either vector x̄3 or vector x̄4 . Let b M ∈ {(J + O), (J + O)}. Then in the case that p̄ ≥ 2 vector x̄ majorizes vector x̄7 , while in the case that ν̄ ≥ 3 vector x̄ majorizes vector x̄6 . Case C̄ ≥ 4. In the case that p̄ ≥ 2 vectors x̄ with M ≥ O majorize vector x̄8 , while the vectors x̄ with M = J majorize vector x̄9 . Thus, it only remains to consider the case (p̄ = 1)&(ν̄ ≥ 3). In this case every vector x̄ with M ≥ J majorizes vector x̄10 , while every vector x̄ with M ≤ b is majorized by vector x̄5 . u O t Although the complexities of ten basis problems were established under the “ordinary” encoding of the input data, it can be easily shown that we have the same complexity results for these ten problems under the “compact” encoding scheme, as well. Indeed, Theorem 2 was proved for both encoding schemes. In Theorem 3, as well as in Theorems 7 and 10 due to Williamson et. al. [40], the problems with Theorem 13 Each problem from the infinite class P(X̄ ) has the same complexity under both encoding schemes: the “ordinary” and the “compact” one. To establish the complexity of problem Px̄ (x ∈ X̄ ), 19 it suffices to compare its vector-delimiter x̄ with ten vectors-delimiters of basis problems presented in Table 2. u t 9 Conclusion In this paper we provided a complete complexity classification of the decision problems for job shop, open shop and mixed shop scheduling models with respect to all possible combinations of constraints on the chosen problem parameters, such as the maximum number of operations per job, the maximum processing time of an operation, and the upper bound on schedule length. We established that this class of problems has a basis system consisting of ten subproblems, five of which are polynomially solvable and another five are NP-complete. The natural question is to extend our classification to additional problem parameters, such as the maximum number of operations per machine, the number of machines, and the number of jobs. It would be also interesting to perform a similar complexity analysis of the preemptive shop scheduling problems. The most challenging is comprehending the complexity of the preemptive mixed shop scheduling problem, where there are known instances [2] having no optimal schedules with integral preemptions only. 10 Acknowledgments The research was supported by the Russian Foundation for Basic Research (grants nos. 08-01-00370 and 08-06-92000-HHC-a) and by the Federal Target Grant “Scientific and educational personnel of innovation Russia” for 2009-2013 (government contract no. 02.740.11.0429). References 1. Bansal, N., Mahdian, M., and Sviridenko, M. (2005). Minimizing makespan in no-wait job shops. Mathematics of Operations Research, 30 (4), 817–831. 2. Baptiste, Ph., Carlier, J., Kononov, A., Queyranne, M., Sevastyanov, S., & Sviridenko, M. Integrality Property in Preemptive Shop Scheduling. Discrete Applied Mathematics, to appear. 3. Brucker, P., & Knust, S. (2000). Operations research: Complexity results of scheduling problems, http://www. mathematik.uni-osnabrueck.de/research/OR/class/. 4. Carlier, J., & Pinson, E. (1989). An algorithm for solving the job-shop problem. Management Science, 35 (2), 164–176. 20 5. Chen, B., Potts, C., & Woeginger, G. (1998). A review of machine scheduling: complexity, algorithms and approximability. In: Handbook of combinatorial optimization, Vol. 3. (pp. 21–169) Boston, MA: Kluwer Acad. Publ. 6. Cole, R., Ost, K., & Schirra, S. (2001). Edge-coloring bipartite multigraphs in O(E log D) time. Combinatorica, 21 (1), 5–12. 7. Creignou, N., Khanna, S., & Sudan, M. (2001). Complexity classifications of Boolean constraint satisfaction problems. SIAM Monographs on Discrete Mathematics and Applications. Philadelphia, PA: Society for Industrial and Applied Mathematics (SIAM). 8. Drobouchevitch, I.G., & Strusevich, V.A. (1999). A polynomial algorithm for the three-machine open shop with a bottleneck machine. Annales of Operations Research, 92, 185–214. 9. Fisher, H., & Thompson, G.L. (1963). Probabilistic Learning Combinations of Local Job-Shop Scheduling Rules. In: Muth, J.F. and Thompson, G.L. (Eds.), Industrial Scheduling (pp. 225-551) Englewood Cliffs, N.J.: Prentice-Hall. 10. Gabow, H., & Kariv, O. (1982). Algorithms for edge coloring bipartite graphs and multigraphs. SIAM Journal of Computing, 11, 117–129. 11. Garey, M., & Johnson, D. (1979). Computers and intractability. A guide to the theory of NP-completeness. A Series of Books in the Mathematical Sciences., San Francisco, CA: W.H. Freeman and Co. 12. Gonzalez, T. (1979). A note on open shop preemptive schedules, Unit execution time shop problems. IEEE Transactions on Computing, 28, 782–786. 13. Gonzalez, T., & Sahni, S. (1976). Open shop scheduling to minimize finish time. Journal of the Association for Computing Machinery, 23 (4), 665–679. 14. Joseph Y.-T. Leung (Ed.) (2004). Handbook of scheduling. Algorithms, models, and performance analysis. Chapman & Hall/CRC Computer and Information Science Series. Boca Raton, FL: Chapman & Hall/CRC. 15. Hoogeveen, J., Lenstra, J.K., & Veltman, B. (1994). Three, four, five, six, or the complexity of scheduling with communication delays. Operations Research Letters, 16 (3), 129–137. 16. Hopcroft, J.E., & Karp, R.M. (1975). An O(n2.5 ) Algorithm for Matching in Bipartite Graphs. SIAM Journal of Computing, 4, 225–231. 17. Jackson, J. (1956). An extension of Jhonson’s results on job lot scheduling. Navel Research Logistics Quartely, 3 (3), 201–203. 18. Jeavons, P., Cohen, D., & Gyssens, M. (1997). Closure properties of constraints. Journal of ACM, 44 (4), 527– 548. 19. Kashyrskikh, K.N., Kononov, A.V., Sevastianov, S.V., & Tchernykh, I.D. (2001). Polynomially solvable case of the 2-stage 3-machine open shop problem [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, Ser. 1, 8(1), 23–39. 20. Kashyrskikh, K.N., Sevastianov, S.V., & Tchernykh, I.D. (2000). Four-parametric complexity analysis of the open shop problem [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, Ser. 1, 7(4), 59–77. 21. Kononov, A.V., & Sevastianov, S.V. (2000). On the complexity of the connected list vertex-coloring problem [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, Ser. 1, 7(2), 21–46. 22. Kononov, A., Sevastianov, S., & Sviridenko, M. (2009). Complete Complexity Classification of Short Shop 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. Scheduling, In: A. Frid a.o. (Eds.), Computer Science — Theory and Applications, 4th International Computer Science Symposium in Russia, CSA 2009, Novosibirsk, Russia, August 2009, Proceedings. Lecture Notes in Computer Science, 5675, Springer-Verlag, 227–236. König, D. (1916). Graphok és alkalmazásuk a determinánsok és a halmazok elméletére [Hungarian]. Mathematikai és Természettudományi Értesitö, 34, 104– 119. [German translation: Über Graphen und ihre Anwendung auf Determinantentheorie und Mengenlehre, Mathematische Annalen, 77 (1916), 453-465.] Lawler, E.L., Lenstra, J.K., Rinnooy Kan, A.H.G., & Shmoys, D.B. (1993). Sequencing and scheduling: algorithms and complexity. In: S. Graves, A.H.G. Rinnooy Kan and P. Zipkin (Eds.) Handbooks in Operations Research and Management Science, Volume 4, Logistics of Production and Inventory (pp. 445–522). North Holland, Amsterdam: Elsevier. Lenstra, J.K., & Rinnooy Kan, A.H.G. (1978). Complexity of scheduling under precedence constraints. Operations Research, 26 (1), 22–35. Lenstra, J.K., Rinnooy Kan, A.H.G., & Brucker, P. (1977). Complexity of machine scheduling problems. Annales of Discrete Mathematics, 1, 343–362. Lenstra, J., Shmoys, D., & Tardos, E. (1990). Approximation algorithms for scheduling unrelated parallel machines. Mathematical Programming, Ser. A, 46 (3), 259–271. Masuda, T., Ishii, H., & Nishida, T. (1985). The mixed shop scheduling problem. Discrete Applied Mathematics, 11 (2), 175–186. Melnikov, L., & Vizing, V. (1999). The edge chromatic number of a directed/mixed multigraph. Journal of Graph Theory, 31 (4), 267–273. Neumytov, Ju., & Sevastianov, S. (1993). An approximation algorithm with best possible bound for the counter routs problem with three machines [in Russian]. Upravlyaemye Sistemy, 31, 53–65. Pyatkin, A. (1999). Incidentor Colorings and their applications [in Russian]. Ph.D. Thesis. Schrijver, A. (2003). Combinatorial optimization. Polyhedra and efficiency. Algorithms and Combinatorics, 24B. Berlin: Springer-Verlag. Schaefer, T.J. (1978). The Complexity of Satisfiability Problems. STOC 1978, 216–226. Sevastianov, S. (2005). An introduction to multiparameter complexity analysis of discrete problems. European Journal of Operational Research, 165 (2), 387–397. Shakhlevich, N.V., Sotskov, Yu.N., & Werner, F. (2000). Complexity of mixed shop scheduling problems: A survey. European Journal of Operational Research, 120, 343–351. Timkovsky, V.G. (2003). Identical parallel machines vs. unit-time shops and preemptions vs. chains in scheduling complexity. European Journal of Operational Research, 149, 355–376. Vizing, V.G. (1999). On a connected graph coloring in prescribed colors [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, Ser. 1, 6 (4), 36–43. Vizing, V.G. (2002). A bipartite interpretation of a directed multigraph in problems of the coloring of incidentors [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, Ser. 1, 9 (1), 27–41. Vizing, V.G. (2008). On the coloring of incidentors in a partially ordered multigraph [in Russian]. Diskretnyi Analiz i Issledovanie Operatsii, 15 (1), 17–22. 40. Williamson, D., Hall, L., Hoogeveen, J., Hurkens, C., Lenstra, J.K., Sevastianov, S., & Shmoys, D. (1997). Short shop schedules. Operations Research, 45 (2), 288– 294. 21