From my understanding, if I want to create a natural number (positive only) representation of a whole number (positive and negative) array, it is quite straight forward... take the absolute value of the smallest element in the array plus 1, and add it to each number in the array, this gives me a positive only array starting from 1 and maintaining the relevant distance between elements.

However, if I want to use this newly transformed array in a subset sum problem, my target sum will no longer be accurate.

I have found a work around, where by I add the factor used on the array, times by the number of elements currently being considered as a subset to the sum.

However, this can cause false positives and also causes it to be more computationally complex.

Has anyone had success with a similar issue, or know of a more reliable approach.

0

There are 0 best solutions below