Define the problem $W$:
Input: A multi-set of numbers $S$, and a number $t$.
Question: What is the smallest subset $s \subseteq S$ so that $\sum_{k \in s} k = t$, if there is one? (If not, return
none
.)
I am trying to find some polytime equivalent decision problem $D$ and provide a polytime algorithm for the non-decision problem $W$ assuming the existence of a polytime algorithm for $D$.
Here is my attempt at a related decision problem:
$\mathrm{MIN\text{-}W}$:
Input: A multi-set of numbers $S$, two numbers $t$ and $k$.
Question: Is there a subset $s \subseteq S$ so that $\sum_{k \in s} k = t$ and $|s| \leq k$?
Proof of polytime equivalence:
Assume $W \in \mathsf{P}$.
solveMIN-W(S, t, k):
1. S = sort(S)
2. Q = {}
3. for i=1 to k:
4. Q.add(S_i)
5. res = solveW(Q, t)
6. if res != none and res = t: return Yes
7. return No
I'm not sure about this algorithm though. Can anyone help please?