0

I have this problem which is described as follows:

Input: You are given a multi-set $M$ (a set that can contain duplicates), and two numbers $P$ and $T$. $M = {(x_1,y_1), (x_2,y_2), ..., (x_n,y_n)}$. Each $x$ and $y$ is an integer $>= 0$. $P$ in an integer $>= 0$. $T$ is an integer $> 0$.

Question: Is there a subset $G$ of $M$, such that the sum of every $x$ value of $G$ is $> P$ and the sum of every $y$ value of $G$ is $< T$? (Note: You are basically taking from $M$. For example: if $M$ has two $(1,1)$'s then $G$ can contain at most two $(1, 1)$'s)

I want to reduce it to from the subset sum problem, but I am not sure how because there's two conditions to solve for...

Can anyone help with this problem?

Raphael
  • 73,212
  • 30
  • 182
  • 400
omega
  • 553
  • 2
  • 7
  • 17

2 Answers2

2

Suppose that you have an instance of SUBSET SUM:

$0 \leq x_1, x_2, ..., x_n$ and an integer $0 \leq t$

You must find $b_i \in \{0,1\}$ such that $b_1*x_1+b_2*x_2+...+b_n*x_n = t$

Which is equivalent to:
$b_1*x_1+b_2*x_2+...+b_n*x_n \geq t$ AND $b_1*x_1+b_2*x_2+...+b_n*x_n \leq t$

$b_1*x_1+b_2*x_2+...+b_n*x_n > t-1$ AND $b_1*x_1+b_2*x_2+...+b_n*x_n < t+1$

pick $P=t-1$, $T=t+1$, $M = \{ (x1,x1),....,(x_n,x_n)\}$

Vor
  • 12,743
  • 1
  • 31
  • 62
1

I think to be the same problem as with the sum of the series.
So, for example, if there is a set $G_1$, such that the sum of all x > P ($G_1=\{(x,y): \sum{x} > P\}$) and then a set of $G_2$ such that the sum of all y < T ($G_2=\{(x,y): \sum{y} < T\}$), then i think the set of G is the intersection of these two sets ($G = {G_1\bigcap{G_2}}$). These sets can be more, depending on the sum of the many ways to create.
And if it depends on which element is to be taken, it should be a set of sets such that if $ G = {G_1\bigcap{G_2}} = {(x_1, y_1),(x_2, y_2),...: (x_1, y_1)\space contained\space k_1 times, (x_1, y_1)\space contained\space k_2\space times,...}$, then you can create $k_1k_2k_3...$ sets.
I think this depends on the specific need for the processing of the result(s).
If $M=\{(1, 1), (1,1)\}$, and $P=1$, $T=3$ then $G_1=\{(x,y): \sum{x} > 1\} = M$, $G_2=\{(x,y): \sum{y} < 3\} = M$ and $G = G_1\bigcap{G_2} = M$.
If $M=\{(1, 1), (1,1)\}$, and $P=1$, $T=2$ then $G_1=\{(x,y): \sum{x} > 1\} = M$, $G_2=\{(x,y): \sum{y} < 2\} = {(1,1)}$ and $G = G_1\bigcap{G_2} = {(1,1)}$ and is irrelevant if $G$ contains first or second pair.