I use the user17410 equivalent formulation:
Input: n vectors X={x1,…,xm} over {0,1}n, n is part of the input
Question: Are there two different subsets A,B⊆X such that
∑x∈Ax=∑x∈Bx
The hardness proof involve many intermediate reductions that follow the same "chain" used to prove the hardness of the standard EQUAL SUBSET SUM problem:
X3C ≤ SUBSET SUM ≤ PARTITION ≤ EVEN-ODD PARTITION ≤ EQUAL SUBSET SUM
(I'm still checking it so it may be wrong :)
STEP 1
Aşağıdaki sorun ( 0-1 VEKTÖR SUBSET TOPLAMI ) NP tamamlandı: verilen , x i , { 0 , 1 } n üzerinde vektörler ve bir hedef toplamı vektör t olup olmadığına karar verin bir ⊆ X, öyle ki
Σ x ∈ bir x = t Korumalı : 3-seti (X3C) İLE belirlenen kapsamı direkt azaltılması: verilen bir dizi n elemanları , Y = { yX={x1,…,xm}xi{0,1}ntA⊆X
∑x∈Ax=t
nY={y1,...,yn} and a collection
C of
m three elements subsets
C={C1,...,Cm} we build the corresponding 0-1 VECTOR SUM instance setting
xi[j]=1 if and only if element
j is included in
Ci;
t=[1,1,...1].
ADIM 2
Bulma iki eşit miktar alt kümeleri arasında m fazla 0-1 vektörleri { 0 , 1 } , n , iki eşit miktar alt grupları bulmak eşdeğerdir bir , B sınırlı boyutta elemanı ile vektörlerinin x 1 . . . x m burada m a x ( x i } = sabit k için O ( ( m n ) k ) .A,Bm{0,1}nA,Bx1...xmmax{xi}=O((mn)k)k
Örneğin, vektörler kümesi:
x1 2 1 0 1
x2 1 2 3 1
0-1 vektörlere eşdeğerdir:
x1 1 1 0 1 1 0 0 0 0
1 0 0 0 0 1 0 0 0
0 0 0 0 1 1 0 0 0
^ ^
+-- 0 elsewhere
x2 1 1 1 1 0 0 1 0 0
0 1 1 0 0 0 0 1 0
0 0 1 0 0 0 0 0 1
0 0 0 0 0 0 1 1 1
^ ^ ^
+-- 0 elsewhere
Informally the 0-1 vectors are grouped (if you select one vector of the x2 group and add
it to subset A, then you are forced to include in A the other two and put the last in subset B) and the sums are done in unary (this is the reason why the corresponding non binary vectors must contain elements that are polynomially bounded with respect to mn).
So the following problem is NP-complete.
STEP 3
B={x1,…,xm}, xi vectors over {0,1}n decide if X can be partitioned in two subsets B1,B2 such that
∑x∈B1x=∑x∈B2x
Proof: Reduction from 0-1 VECTOR SUM: given X={x1,…,xm}
and the target sum vector t; let S=∑xi, we add to X the following vectors: b′=−t+2S and b′′=t+S: B=X∪{b′,b′′}.
⇒A⊆X∑x∈Ax=t;
we set B1=A∪{b′} and B2=B∖B1=X∖{A}∪{b′′}; we have
∑x∈B1=b′+∑x∈Ax=t−t+S=2S
∑x∈B2=b′′+∑x∈X∖Ax=b′′+S−∑x∈Ax=2S
(⇐) Suppose that B1 and B2 have equal sum. b′,b′′ cannot both belong to the same set (otherwise their sum is ≥3S and cannot be "balanced" by the elements in the other set). Suppose that b′=−t+2S∈B1; we have:
−t+2S+∑x∈B1∖{b′}x=t+S+∑x∈B2∖{b′′}x
Hence we must have ∑x∈B1∖{b′}x=t and B1∖{b′} is a valid solution for the 0-1 VECTOR SUM.
We only allow 0-1 vectors in the set B, so vectors b′,b′′ must be "represented
in unary" as shown in STEP 2.
STEP 3
x1,...,x2n and
the two subsets X1,X2 must have equal size and we require that X1 contains exactly one of x2i−1,x2i for 1≤i≤n (so, by the equal size constraint, the other element of the pair must be included in X2) (0-1 VECTOR EVEN-ODD PARTITION).
Proof:: The reduction is from 0-1 VECTOR PARTITION and is similar to the reduction from PARTITION to EVEN-ODD PARTITION. If X={x1,...,xm} are m vectors over {0,1}n replace each vector with two vectors over {0,1}2n+2m:
1 2 n
--------------------
x_i b_1 b_2 ... b_n
becomes:
1 2 ... 2i ... 2m
--------------------------
x'_2i-1 0 0 ... 1 ... 0 b_1 b_2 ... b_n 0 0 ... 0
x'_2i 0 0 ... 1 ... 0 0 0 ... 0 b_1 b_2 ... b_n
Due to the 2i element, the vectors x′2i−1 and x′2i cannot be contained in the same subset; and a valid solution to the 0-1 VECTOR EVEN-ODD PARTITION correspond to a valid solution of the original 0-1 VECTOR PARTITION (just pick elements 2m+1..2m+n of each vector of the solution discarding vectors that contain all zeros in those positions).
STEP 4
0-1 VECTOR EQUAL SUBSET SUM (the problem in the question) is NP-complete: reduction from 0-1 VECTOR EVEN-ODD PARTITION similar to the reduction from EVEN-ODD PARTITION to EQUAL SUM SUBSET, as proved in Gerhard J. Woeginger, Zhongliang Yu, On the equal-subset-sum problem: given an ordered set A={x1,...,x2m} of 2m vectors over {0,1}n, we build a set Y of 3m vectors over {0,1}2m+n.
For every vector x2i−1,1≤i≤m we build a vector y2i−1 over {0,1}2m+n in this way:
1 2 ... i i+1 ... m m+1 m+2 ... m+i ... 2m 2m+1 ... 2m+n
------------------------------------------------------
0 0 ... 2 0 ... 0 0 0 1 0 x_{2i-1}
For every vector x2i,1≤i≤m−1 we build a vector y2i over {0,1}2m+n in this way:
1 2 ... i i+1 ... m m+1 m+2 ... m+i ... 2m 2m+1 ... 2m+n
------------------------------------------------------
0 0 ... 0 2 ... 0 0 0 1 0 x_{2i}
We map element x2m to
1 2 ... ... m m+1 m+2 ... . 2m 2m+1 ... 2m+n
------------------------------------------------------
2 0 ... ... 0 0 0 1 x_{2m}
Finally we add m dummy elements:
1 2 ... ... m m+1 m+2 ... ... 2m 2m+1 ... 2m+n
------------------------------------------------------
4 0 ... ... 0 0 0 0 0 ... 0
0 4 ... ... 0 0 0 0 0 ... 0
...
0 0 ... ... 4 0 0 0 0 ... 0
Note again that vectors containing values >1 can be represented in "unary" using a group of 0-1 vectors like showed in STEP 2.
Y has two disjoint Y1,Y2 subsets having equal sum if and only if X has an even-odd partition.