Re: question on variation of subset sum problem
- From: "Babua" <pinaki@xxxxxxxxxxxxx>
- Date: 28 Mar 2007 21:27:53 -0700
On Mar 28, 3:34 pm, "Babua" <pin...@xxxxxxxxxxxxx> wrote:
On Mar 27, 9:33 pm, "amandeep.par...@xxxxxxxxx"
<amandeep.par...@xxxxxxxxx> wrote:
Hi,
The problem I have is a variation of subset sum. Given $n$ numbers
a_1, a_2 , ..., a_n and b. Does there exists sets S_1 and S_2
disjoint, subsets of {1,2,...,n} such that
Sum_{i in S_1} a_i + 1/2 Sum_{i in S_2} a_i = b ?
I think this is a NP-complete problem but I cant seem to show it. Any
comments would be greatly appreciated. Thanks,
-aman
Put another extra element in to the set S of n numbers = 2*Sum_{i in
S}a_i = 2X (suppose).
Reduce subset sum problem with sum b to this problem with k = X + b.
Thanks.
--- Pinaki
====================================================================
Sorry I was wrong. The if part is correct. But in the only if part of
the
reduction we may have difficulty in extracting the answer for subset
sum
from the current problem.
The new element to be included in S is not needed at all.
The correct reduction will be:
Subset sum problem with sum b to the current problem with sum = N-b/
2 (Assume b is even)
Here I am using N instead of X which denote the sum of all elements of
S.
W.l.o.g we can assume b to even in subset sum problem. We can reduce
general subset
sum to the problem of subset sum with b is even.
The if part of the reduction is obvious.
To extract the answer of the subset sum we can give the following
proof:
Let S_1 = X U Y and S_2 = Z U W. Let the sum of elements of X, Y, Z, W
be denoted by
A, B, C, D.
Then we have the following 2 equations :
A + D/2 = N-b
B + C/2 = b/2
Since N = A + B + C + D
B + C + D/2 = b
B + C/2 = b/2
From the above two equations we have :
C + D = b
Thus the elements of the set S_2 will give the desired answer in the
only if part
of the reduction.
Thanks.
--- Pinaki
=================================================================================
.
- References:
- question on variation of subset sum problem
- From: amandeep.parmar@xxxxxxxxx
- Re: question on variation of subset sum problem
- From: Babua
- question on variation of subset sum problem
- Prev by Date: Re: Hoare's triples question
- Next by Date: Re: My LP Formulation of the TSP: Conclusions
- Previous by thread: Re: question on variation of subset sum problem
- Next by thread: DBPL 2007 Call for Papers
- Index(es):
Relevant Pages
|