Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 15

The NP-Hardness of F3||Cmax

Recommended resources

Hello! Welcome to the next lesson in our journey through scheduling theory.

In the previous lessons, we explored the two-machine flow shop problem () in detail. We saw that it can be solved optimally and efficiently using Johnson's algorithm, and we even proved its optimality. The existence of such an algorithm places in a class of problems we consider "computationally easy."

A natural question arises: what happens if we add just one more machine? This lesson tackles that question, addressing the learning outcome: Explain why the three-machine flow shop problem (F3||Cmax) is NP-hard.

This topic marks a critical turning point in our course and for your thesis preparation. It's the moment we cross the boundary from problems with elegant, efficient, optimal solutions to the vast landscape of "hard" problems where such solutions are believed not to exist. Understanding this distinction is the fundamental motivation for using the heuristics, metaheuristics, and advanced optimization methods that are central to modern scheduling research and your work on the Flexible Job Shop Problem.

Our lesson will be structured in three parts:

  1. Understanding Computational Complexity: We'll define the concepts of P, NP, and NP-hard to build a formal vocabulary for discussing problem difficulty.
  2. The Proof Technique of Reduction: We will learn about the primary method used to prove a problem is NP-hard.
  3. The Complexity of F3||Cmax: We will see how these concepts are applied to demonstrate that the three-machine flow shop problem is NP-hard and discuss the profound implications of this fact.

1. What Makes a Problem "Hard"?

In our last lesson, we noted that Johnson's algorithm is efficient, running in time. This is an example of a polynomial-time algorithm. The time it takes to run grows as a polynomial function of the input size (e.g., , ). Problems that can be solved by such algorithms are considered "tractable" or "easy" and belong to the complexity class P.

However, many problems, including most scheduling problems, have no known polynomial-time algorithm. The best-known algorithms to find an optimal solution for them can take exponential time (e.g., , ). As the number of jobs increases, the required time becomes astronomically large, making them practically unsolvable for anything but small instances.

To understand the theory behind this, we need to introduce the classes NP, NP-hard, and NP-complete. The following video provides an excellent conceptual introduction.

8. NP-Hard and NP-Complete Problems

This video from Abdul Bari introduces the fundamental concepts of computational complexity. It explains the difference between polynomial and exponential time, defines the complexity classes P and NP, and introduces the idea of non-deterministic algorithms as a way to think about NP problems.

Please watch the video from the beginning until the timestamp 13:45. Focus on these key ideas: The practical difference between polynomial and exponential time complexity (00:37 - 03:05). The concept of a non-deterministic algorithm as a theoretical tool (04:54 - 10:50). The formal definitions of the classes P (deterministic polynomial time) and NP (non-deterministic polynomial time) (10:50 - 13:45).

To summarize and clarify the key definitions from the video:

  • Class P (Polynomial Time): The set of decision problems that can be solved by a deterministic algorithm in polynomial time. Example: Is the makespan for this F2 schedule less than K? (We can run Johnson's algorithm and check).
  • Class NP (Nondeterministic Polynomial Time): The set of decision problems for which a proposed solution ("certificate") can be verified in polynomial time. The name comes from a formal definition involving non-deterministic Turing machines, but the "verifiability" intuition is the most useful one. Example: Given a sequence for an F3 problem, can you verify if its makespan is less than K? Yes, you can calculate the makespan in polynomial time and check.

Notice that every problem in P is also in NP. If you can solve a problem from scratch in polynomial time, you can certainly verify a given solution in polynomial time. A major open question in computer science is whether P = NP. It is widely believed that P ≠ NP, meaning there are problems in NP that cannot be solved in polynomial time.

This brings us to the "hardest" problems in NP.

NP-Complete Complexity Classes Venn Diagram
This diagram illustrates the relationship between complexity classes. It is generally assumed that P is a proper subset of NP, and the NP-Complete problems represent the hardest problems within NP. NP-Hard problems are at least as hard as any problem in NP.

2. Proving Hardness: The Concept of Reduction

We don't prove a problem is "hard" from scratch every time. Instead, we use a powerful technique called reduction.

A reduction is a way of transforming an instance of one problem (Problem A) into an instance of another problem (Problem B). If we can perform this transformation efficiently (in polynomial time) and a solution to the instance of B gives us a solution to the instance of A, we say that "A reduces to B".

The implication is powerful: If A reduces to B, then B is at least as hard as A. If we had an efficient algorithm for B, we could use it to solve A efficiently as well.

This leads to the definitions of NP-hard and NP-complete:

  • NP-hard: A problem is NP-hard if every problem in NP can be reduced to it in polynomial time. These problems are the "hardest" ones—at least as hard as anything in NP. They don't necessarily have to be in NP themselves (i.e., they might not be easy to verify).
  • NP-complete: A problem is NP-complete if it is both NP-hard and is also in NP. These are the hardest problems within NP. The first NP-complete problem ever identified was the Boolean Satisfiability Problem (SAT).

The following segment of the video explains the concept of reduction using SAT as the foundational NP-complete problem.

8. NP-Hard and NP-Complete Problems

This part of the video explains the crucial concept of reduction, which is the cornerstone of proving NP-hardness.

Please watch from 14:08 to 24:50. Focus on how solving one problem can lead to solving another through a transformation or 'reduction'. Understand that if a known NP-hard problem like Satisfiability can be reduced to your new problem, your new problem must also be NP-hard.

For scheduling problems, we don't usually reduce directly from SAT. Instead, researchers use a few well-known NP-hard problems that are more structurally similar to scheduling. Two of the most famous are Partition and 3-Partition.

Scheduling Problems and Solutions

This excerpt from Michael Pinedo's book, 'Scheduling: Theory, Algorithms, and Systems', formally defines the Partition and 3-Partition problems and states the rule for how they are used to prove NP-hardness in scheduling.

Please read the section titled 'Complexity Preliminaries', starting from 'Problem Classification' and ending after the definition of '3-Partition' and 'Proof of NP-Hardness'. Pay close attention to: The definition of the Partition problem. The definition of the 3-Partition problem. The rule stated under 'Proof of NP-Hardness': a problem is strongly NP-hard if 3-Partition can be reduced to it.

The key takeaway is that to prove a scheduling problem is NP-hard (specifically, strongly NP-hard, which is a more robust type of hardness), the standard method is to show that you can convert any instance of the 3-Partition problem into an instance of that scheduling problem.


3. The Verdict: F3||Cmax is Strongly NP-hard

Now we can put all the pieces together to answer our main question.

1 Flow Shop In a flow shop problem, there are m machines ...

Let's look at another resource that directly states the complexity of the three-machine flow shop problem.

Please read the short introductory paragraph in Section 1 and the first sentence of Section 3 ('Approximation algorithms for F||Cmax'). Both sections explicitly state the complexity of the flow shop problem as the number of machines increases.

As the resources confirm, the problem is strongly NP-hard.

The formal proof, first established by Garey, Johnson, and Sethi in 1976, is a complex reduction from the 3-Partition problem. The details of the reduction are highly technical and beyond the scope of this course, but the conclusion is what matters for us. It means:

  1. There is no known polynomial-time algorithm that can guarantee an optimal solution for .
  2. It is widely believed that no such algorithm will ever be found (unless P=NP, which is considered highly unlikely).
  3. To find an optimal solution, you would likely have to use methods that, in the worst case, explore a number of possibilities that grows exponentially with the number of jobs.

This is a profound result. The jump from two machines to three machines transforms the problem from "easy" to "intractable." This explains why your thesis, which deals with the even more complex Flexible Job Shop Problem, focuses on methods like metaheuristics and constraint programming. These methods are designed to find very good, but not necessarily optimal, solutions in a reasonable amount of time.

Test your understanding!

A colleague suggests they have discovered a new, revolutionary algorithm that can solve any problem to optimality in time. Based on what you've learned in this lesson, why should you be skeptical of this claim? What would be the broader implication for computer science if their claim were true?

Show answer

You should be highly skeptical because is a known strongly NP-hard problem. An algorithm with time complexity is a polynomial-time algorithm. The existence of such an algorithm would imply that P=NP, as it would provide a polynomial-time solution to an NP-hard problem.

If the claim were true, it would solve one of the biggest open problems in computer science and mathematics, a feat worth a million-dollar prize from the Clay Mathematics Institute. It would mean that all NP-complete problems (like Traveling Salesperson, 3-Partition, etc.) could also be solved efficiently, revolutionizing fields like logistics, cryptography, drug design, and artificial intelligence. It is far more likely that there is a flaw in the colleague's algorithm or proof.


Conclusion

In this lesson, we bridged the gap between solvable and computationally hard problems, a cornerstone of scheduling theory.

Key Takeaways:

  • Scheduling problems can be classified by their computational complexity. "Easy" problems are in class P, solvable in polynomial time (e.g., ).
  • Many problems are in class NP, where solutions can be verified quickly, but finding them is hard.
  • NP-hard problems are at least as hard as any problem in NP. We prove a problem is NP-hard via reduction from a known NP-hard problem (like 3-Partition).
  • The three-machine flow shop problem, , is strongly NP-hard. This means there is no known efficient algorithm to find the optimal schedule.

This result is not a point of despair, but of motivation. It is the very reason the field of heuristics and metaheuristics is so rich and vital. Since we cannot guarantee finding the absolute best solution efficiently, the challenge becomes: how do we find high-quality solutions in a practical amount of time?

Preview of the Next Lesson:
Now that we've established that we can't solve (and by extension, ) optimally and efficiently, we will turn our attention to practical methods. In the next lesson, you will learn how to apply the NEH heuristic, one of the most effective and widely-used constructive heuristics for constructing high-quality flow shop schedules.