Step 1: Prove
A problem is in NP if a proposed solution can be verified in polynomial time. For :
- Given a candidate set of size , we check:
- Constraints : For each , verify .
- Forbidden pairs : For each , verify .
- Both checks run in , polynomial in the input size.
Conclusion: .
Step 2: Prove is NP-hard via 3SAT reduction
We reduce 3SAT (NP-complete) to .
Reduction Construction
Given a 3-CNF formula with variables and clauses , construct as:
-
Activities :
- For each variable , create .
- Total: .
-
Constraints :
- Variable constraints: Add for each (force selection of at least one literal).
- Clause constraints: For each clause , add .
-
Forbidden pairs :
- For each , add to .
-
Days : Set .
Correctness
-
If is satisfiable:
Let be a satisfying assignment. Select .- , satisfying .
- All variable constraints are met.
- All clause constraints are met (since satisfies ).
- No forbidden pairs are violated.
-
If has a solution :
Define if , else .- is consistent (no ).
- satisfies all clauses (since intersects every clause constraint).
Runtime
The reduction constructs constraints and forbidden pairs, polynomial in .
Conclusion
- is NP-hard because .
- Since is in NP and NP-hard, it is NP-complete.