Modification of the subset sum problem - "perfect coverage" of the set with good solutions

100 Views Asked by At

I have a problem.

We have a set.

$S = (a_1, a_2 ... a_k)$ and an integer $x$.

We know that there is a sum of elements to $x$ in it.

We also know that:

  • if there is only one sum to $x$ then it must contain all elements of the set;

  • if there are many sums, elements from these sums must "ideally cover" all elements of the set.

For example, take the set $S = (1, 2, 3, 5, 7)$ and $x = 13$.

Possible sums up to 13 are:

$1 + 2 + 3 + 7 = 13$

$1 + 5 + 7 = 13$

These totals contain all elements of the $S$.

A bad example is the set $S = (1, 2, 3, 5, 7)$ and $x = 5$:

$2 + 3 = 5$

and

$5 = 5$

The set of elements adding up to 5 is therefore: $(2, 3, 5)$.

It is not identical to the set S.

Elements not "covered" in the set S are: $(1, 7)$.

In my issue, we always consider that the "perfect coverage" of the set exists.

We're looking for any subset that sums up to $x$.

How can we find him quickly? Maybe someone knows the polynomial method?