Bir matrisin çekirdeğinin, girişleri -1, 0 veya 1 olan sıfır olmayan bir vektör içerip içermediğine karar verin


27

Bir m ile n ikili matris M (girişler 0 ya da 1 ), problem iki ikili vektör olup olmadığını tespit etmektir, v1v2öyle ki Mv1=Mv2 ( üzerinde gerçekleştirilen tüm işlemler Z). Bu sorun NP zor mu?

Tanık olarak iki vektör verebileceğinizden, açıkça NP’de.


Eşdeğer: Verilen M , sıfır olmayan bir vektör vardır v{1,0,1}n , öyle ki Mv=0 ?

Eşdeğer: Verilen n vektörleri X={x1,,xn} , {0,1}m , olmak üzere iki farklı altküme var mı ,A,BX öyle ki xAx=xBx ?


I yanlış anlamak soruya sürece, sıfır olmayan bir olup olmadığının belirlenmesi eşdeğer bu değil v böyle Mv=0 ? Ve bu rütbesini belirleyerek çözülmedi Mmi?
21'de

8
@mhum no, it's equivalent to determining if there is a nonzero v{1,0,1}n such that Mv=0.
Sasho Nikolov

Ah. I missed that vi also had to be binary. My mistake.
mhum

2
Seems like the feasibility problem for 0/1-Integer Programming. Are operations over Z or over Z2?
Kaveh

3
Sorun yeniden formüle: göz önüne alındığında vektörler X = { x 1 , ... , x , n } üzerinde { 0 , 1 } m . İki farklı alt kümeleri olup A , B X öyle ki Σ x A x = Σ x B x ? Toplamlar modulo 2 alınmazsa, işlemlerin ZnX={x1,,xn}{0,1}mA,BXxAx=xBxZ
John D

Yanıtlar:


7

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,BX such that

xAx=xBx

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}ntAX

xAx=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

xB1x=xB2x

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}.

AXxAx=t; we set B1=A{b} and B2=BB1=X{A}{b}; we have

xB1=b+xAx=tt+S=2S
xB2=b+xXAx=b+SxAx=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+2SB1; we have:

t+2S+xB1{b}x=t+S+xB2{b}x

Hence we must have xB1{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 x2i1,x2i for 1in (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 x2i1 and x2i 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 x2i1,1im we build a vector y2i1 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,1im1 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.


what you call 0-1 vector partition is equivalent to the problem of determining if a set system has discrepancy 0. this is NP hard, since it captures e.g. the 2-2-set-splitting problem, see thm 9 in this paper by guruswami cs.cmu.edu/~venkatg/pubs/papers/ss-jl.ps; my paper has a bit more on the hardness of discrepancy paul.rutgers.edu/~anikolov/Files/charikarM.pdf
Sasho Nikolov

also I believe you mis-state the even-odd partition problem. if no two consecutive vectors can be in the same set the problem is trivial. i believe you mean that |Xi{x2j1,x2j}|=1 is required for all i{1,2} and 1jm
Sasho Nikolov

@SashoNikolov: yes, I mean that for every pair (x2i1,x2i) (and in the proof (x2i1,x2i)) exactly one is included in X1; I'll edit the answer
Marzio De Biasi

8

EDIT: My original proof had a bug. I now believe that it is fixed.

We reduce the problem of EQUAL SUM SUBSETS to this problem. EQUAL SUM SUBSETS is the problem of: given a set of m integers, find two disjoint subsets which have the same sum. EQUAL SUM SUBSETS is known to be NP-complete.

Suppose these bit strings were not vectors but representations of n-bit numbers in binary. Then the problem would be NP-complete by a reduction from EQUAL SUM SUBSETS. I will show how to make these vectors behave like they are binary numbers. What we need is to be able to do carries; that is, for every pair of adjacent coordinates, we need to be able to replace the vector ..02.. by ..10.. .

How can we do that? We need a gadget that lets us do that. In particular, we need two subsets whose sums are ..02.. x and ..10.. x, where x is a bit string using new coordinates (i.e., coordinates which aren't any of the n coordinates making up the binary representations), and where there is only one way to create two subsets with the same sum in the new bit positions corresponding to x.

This is fairly easy to do. For every pair of adjacent bit positions, add three vectors of the following form. Here the last two bits are coordinates which are non-zero only in these three vectors, and every bit not explicitly given below is 0.

..10.. 11
..01.. 10
..01.. 01

Let me do an example. We want to show how 5+3=8 works.

Here is 8 = 5 + 3 in binary:

1000

=

0101
0011

These bit strings give the same sum in binary, but not in vector addition.

Now, we have carries in the 1, 2, 4 places, so we need to add three sets of three vectors to the equation so as to perform these carries.

1000 00 00 00
0001 00 00 01
0001 00 00 10
0010 00 01 00
0010 00 10 00
0100 01 00 00
0100 10 00 00

=

0101 00 00 00
0011 00 00 00
0010 00 00 11
0100 00 11 00
1000 11 00 00

These sets now have the same sum in vector addition. The sums are:

1222 11 11 11

in both cases.

This construction works great if there is only one carry per position, but there could potentially be up to n carries per position, and you need to make sure that your construction can handle up to n carries, and that the different carries don't interfere with each other. For instance, if you added two different sets of three vectors for the same pair of adjacent positions (which is what I proposed in my original proof):

..01.. 01 00
..01.. 10 00
..10.. 11 00
..01.. 00 01
..01.. 00 10
..10.. 00 11

you have the problem that you get two different sets of vectors giving the same sum:

..01.. 01 00
..01.. 10 00
..10.. 00 11

=

..01.. 00 01
..01.. 00 10
..10.. 11 00

How to fix this? Add one set of vectors which lets you carry 1, one set which lets you carry 2, and one set for 4, 8, , 2logn. I'm not going to go work out the details of this construction right now, but it should be fairly straightforward. Since each number has a unique binary representation, this will let you carry any number up to n. For carrying 4, for example, you need find four vectors which have the same sum as two vectors, and for which this is the only linear relation between the two sets. For example, the set

..01.. 11000
..01.. 00100
..01.. 00010
..01.. 00001
..10.. 10001
..10.. 01110

works. You can easily check that the relation

11000
00100
00010
00001

=

10001
01110

is the only possible relation among these six vectors because the matrix formed by these six rows has rank 5.


A clarification, you say "Now, we have carries in the 1, 2, 4 places"; but in the problem we don't know which vectors are selected so we must add the carry gadget to every adjacent bit position? And in the first list of the example there are 7 vectors, is it correct?
Marzio De Biasi

Suppose have a solution for the subset sum problem. That is: we have 3+5=8. Now, we can look at the addition in this witness and find out where the carries are. This gives us the solution for the vector addition problem. One problem has a solution if and only if the other does.
Peter Shor

But how the reduction works for example if the instance of the subset sum is 2,3,5,7 and target sum 8 (what is the corresponding vector instance)?
Marzio De Biasi

P.S. I also found a proof that the problem is NP-complete, but it is much longer than yours, so I'm trying to understand it ... simpler is better :-)
Marzio De Biasi

This means that for the second problem, we have to add the carry gadget to every adjacent bit position. In fact, since we might have n1 carries in that position, we have to add n1 copies of the carry gadget to that bit position. And I just realized that doesn't work — we have to be cleverer. I know how to do it, but I'll have to revise the answer.
Peter Shor

3

This doesn't answer the question but might contain some helpful observations. I didn't want to put it as a comment because I find long, fragmented comments bothersome to read

The reformulation of the problem as stated in my comment to the question:

Input: n vectors X={x1,,xn} over {0,1}m, m is part of the input

Question: Are there two different subsets A,BX such that

xAx=xBx

Maybe I should note that one should regard X,A,B as multisets(the vectors must not be unique) and the sums are over N.

I propose to call this problem 2SUBSET-BINARY-VECTOR-SUM due to the fact that we are looking for 2 subsets of binary vectors.

Some observations:

  • If X contains one vector multiple times the answer becomes trivial. Let xi,xjX and xi=xj. Then A={xi},B={xj} works as witness.

  • If one of the vectors in X contains only 0's it is trivial. Let 0X be that vector. Then for every AX{0} it follows B=A{0} is a witness.

  • Assume there exists a witness such that AB. This implies that every vector that is in B but not in A must consist of zeroes only.

  • To subsume the above two points: a witness A,B with AB exists iff at least one of the vectors in X contains only zeroes

  • Assume there exists a witness A,B such that AB. You can remove the common elements in both sets and still have a correct witness.

These points essentialy mean that you are looking for a partition of X into two sets(AB=X) or three sets. The third set represents the vectors which weren't choosen for either A or B. Let S(n,k) be the Stirling numbers of the second kind - the number of ways to partition a set of n objects into k non-empty partitions. Then there are S(n,3)+S(n,2) possible solutions, so brute force isn't feasible here.

If you allow the vectors to be over Nm (2SUBSET-VECTOR-SUM), then we can try to reduce UNIQUE-PARTITION to this problem. Let m=1 and simply pass the instance of UNIQUE-PARTITION(if it contains 0, remove it first to avoid trivial solutions). However, this doesn't work since possible solutions A,B don't necessarily contain all input elements:

Consider {1,2,3,5}. This isn't in UNIQUE-PARTITION but A={1,2},B={3} in 2SUBSET-VECTOR-SUM. Maybe using m>1 we can use the additional vector entries to force A,B to partition the input.

Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.