Source: PARTITION
Target: SUBSET SUM
Motivation: Establishes NP-completeness of SUBSET SUM via polynomial-time reduction from PARTITION. This is a textbook-canonical reduction: PARTITION is the special case of SUBSET SUM where the target B equals half the total sum. The reduction is essentially an embedding -- the PARTITION instance is directly re-interpreted as a SUBSET SUM instance with B = S/2. Referenced in Karp (1972) and Garey & Johnson (1979, SP13).
Reference: Garey & Johnson, Computers and Intractability, SP13, p.223
GJ Source Entry
[SP13] SUBSET SUM
INSTANCE: Finite set A, size s(a) in Z^+ for each a in A, positive integer B.
QUESTION: Is there a subset A' <= A such that the sum of the sizes of the elements in A' is exactly B?
Reference: [Karp, 1972]. Transformation from PARTITION.
Comment: Solvable in pseudo-polynomial time (see Section 4.2).
Reduction Algorithm
Summary:
Given a PARTITION instance (finite set A with sizes s(a) in Z^+), construct a SUBSET SUM instance as follows:
- Elements: Keep the same set A with the same sizes s(a). That is, the SUBSET SUM element set is identical to the PARTITION element set.
- Target: Set B = S / 2, where S = Sum_{a in A} s(a) is the total sum of all element sizes. If S is odd, the PARTITION instance has no solution; in this case, return a trivially infeasible SUBSET SUM instance with sizes = [] and target = 1.
- Correctness: PARTITION asks: "Is there A' <= A with Sum_{a in A'} s(a) = Sum_{a in A\A'} s(a)?" This is equivalent to asking "Is there A' <= A with Sum_{a in A'} s(a) = S/2?", which is exactly the SUBSET SUM question with target B = S/2. The reduction is a trivial embedding.
- Solution extraction: The SUBSET SUM solution A' (the subset summing to B = S/2) is directly one side of the balanced partition. The other side is A \ A'.
Size Overhead
Symbols:
- n = |A| =
num_elements of source PARTITION instance
| Target metric (code name) |
Polynomial (using symbols above) |
num_elements |
num_elements (= n) |
Derivation: The SUBSET SUM instance has exactly the same n elements as the PARTITION instance. The target B is computed as S/2, a data parameter. Construction is O(n).
Validation Method
- Closed-loop test: reduce source PARTITION instance, solve target SUBSET SUM with BruteForce, extract solution, verify on source
- Compare with known results from literature
- Edge cases: test with odd total sum (no solution), test with all-equal elements (always solvable if n is even)
Example
Source instance (PARTITION):
A = {a_1, a_2, a_3, a_4, a_5, a_6, a_7} with sizes s = {5, 3, 8, 2, 7, 1, 4} (n = 7 elements)
Total sum S = 5 + 3 + 8 + 2 + 7 + 1 + 4 = 30
A balanced partition exists iff a subset summing to S/2 = 15 can be found.
Constructed SUBSET SUM instance:
Items: same 7 elements with sizes {5, 3, 8, 2, 7, 1, 4}
Target B = 15.
Solution:
Select A' = {a_1, a_3, a_4} = {5, 8, 2} (sum = 5 + 8 + 2 = 15 = B). YES.
Solution extraction:
Partition side 1: A' = {5, 8, 2} (sum = 15)
Partition side 2: A \ A' = {3, 7, 1, 4} (sum = 3 + 7 + 1 + 4 = 15)
Balanced partition confirmed.
Negative case:
A = {5, 3, 8, 2, 7, 1, 3} (n = 7 elements), total sum S = 29 (odd).
Since S is odd, the reduction returns a trivially infeasible SUBSET SUM instance: sizes = [], target = 1. No empty subset sums to 1, so the answer is NO. PARTITION has no solution because no balanced partition can exist when S is odd.
References
- [Karp, 1972]: [
Karp1972] Richard M. Karp (1972). "Reducibility among combinatorial problems". In: Complexity of Computer Computations. Plenum Press.
Source: PARTITION
Target: SUBSET SUM
Motivation: Establishes NP-completeness of SUBSET SUM via polynomial-time reduction from PARTITION. This is a textbook-canonical reduction: PARTITION is the special case of SUBSET SUM where the target B equals half the total sum. The reduction is essentially an embedding -- the PARTITION instance is directly re-interpreted as a SUBSET SUM instance with B = S/2. Referenced in Karp (1972) and Garey & Johnson (1979, SP13).
Reference: Garey & Johnson, Computers and Intractability, SP13, p.223
GJ Source Entry
Reduction Algorithm
Summary:
Given a PARTITION instance (finite set A with sizes s(a) in Z^+), construct a SUBSET SUM instance as follows:
Size Overhead
Symbols:
num_elementsof source PARTITION instancenum_elementsnum_elements(= n)Derivation: The SUBSET SUM instance has exactly the same n elements as the PARTITION instance. The target B is computed as S/2, a data parameter. Construction is O(n).
Validation Method
Example
Source instance (PARTITION):
A = {a_1, a_2, a_3, a_4, a_5, a_6, a_7} with sizes s = {5, 3, 8, 2, 7, 1, 4} (n = 7 elements)
Total sum S = 5 + 3 + 8 + 2 + 7 + 1 + 4 = 30
A balanced partition exists iff a subset summing to S/2 = 15 can be found.
Constructed SUBSET SUM instance:
Items: same 7 elements with sizes {5, 3, 8, 2, 7, 1, 4}
Target B = 15.
Solution:
Select A' = {a_1, a_3, a_4} = {5, 8, 2} (sum = 5 + 8 + 2 = 15 = B). YES.
Solution extraction:
Partition side 1: A' = {5, 8, 2} (sum = 15)
Partition side 2: A \ A' = {3, 7, 1, 4} (sum = 3 + 7 + 1 + 4 = 15)
Balanced partition confirmed.
Negative case:
A = {5, 3, 8, 2, 7, 1, 3} (n = 7 elements), total sum S = 29 (odd).
Since S is odd, the reduction returns a trivially infeasible SUBSET SUM instance: sizes = [], target = 1. No empty subset sums to 1, so the answer is NO. PARTITION has no solution because no balanced partition can exist when S is odd.
References
Karp1972] Richard M. Karp (1972). "Reducibility among combinatorial problems". In: Complexity of Computer Computations. Plenum Press.