Is the Subset Sum Problem Truly Solved by Generating Large Random Sets?

  • Thread starter Thread starter LolipopDragon
  • Start date Start date
  • Tags Tags
    P vs np Sum
AI Thread Summary
The discussion centers on the Subset Sum problem, an NP-complete issue, and the effectiveness of a newly developed algorithm for finding subsets of random integers that sum to a specified number. The algorithm initially performed well with a million random integers but faced skepticism regarding its polynomial time efficiency and the impact of upper bounds on generated numbers. Critics pointed out that the algorithm's success may stem from the limited range of generated integers, suggesting that larger, unbounded sets should be tested for a more accurate assessment. After removing the upper limits, the algorithm failed to produce the desired results, raising questions about its viability. The conversation highlights the complexities of algorithm design in relation to established theories like P vs NP and references Pisinger's linear time algorithm as a relevant benchmark.
LolipopDragon
Messages
2
Reaction score
0
Hello,

My hobby is to design algorithms especially data compression algorithms, but when I can't find a solution to my problems I usually go find myself a different problem to solve because it helps me think differently or maybe it lights a bulb about the original problem …today I stumbled on the P vs NP problem for the first time, 5 minutes reading through Wikipedia I found the Subset Sum problem https://en.wikipedia.org/wiki/Subset_sum_problem which Wikipedia mentions is an important problem and is NP Complete…. So I decided to try and write an algorithm that finds the elements of any set of random integers that sum up to any random number S Fast, first what I did is generate an array of one million random numbers between one and one million, then told the computer to generate a random number also between one and one million, then applied my algorithm which finds elements in the array that sum to the random number S in seconds. The Bigger the set of RANDOM numbers the easier to find a solution!

So the answer was too simple and easy, my question is what am I missing/doing wrong here?
 
Last edited:
Physics news on Phys.org
So, where's your proof that your algorithm runs in polynomial time?
Secondly, a million is a very small number. Efficient algorithms are known for small N. Try your algorithm with, say, 2 raised to the power of a million. I doubt that your algorithm will terminate.
Thirdly, you said you generated a million numbers, but with a upper bound of a million on each number. Well, there's a very high probability that you generated the majority of numbers from 1 to 1,000,000. So yeah, obviously any algorithm should be fast. Try again but remove the million upper limit.

Edit: This
The Bigger the set of RANDOM numbers the easier to find a solution!
indicates that it's the third point that's making it easy for you.
 
Last edited:
From the Wikipedia article:

"For the case that each xi is positive and bounded by a fixed constant C, Pisinger found a linear time algorithm having time complexity O(NC)."
 
Samy_A said:
From the Wikipedia article:

"For the case that each xi is positive and bounded by a fixed constant C, Pisinger found a linear time algorithm having time complexity O(NC)."
Does this mean i should not pursue this any longer?
pwsnafu said:
So, where's your proof that your algorithm runs in polynomial time?
Secondly, a million is a very small number. Efficient algorithms are known for small N. Try your algorithm with, say, 2 raised to the power of a million. I doubt that your algorithm will terminate.
Thirdly, you said you generated a million numbers, but with a upper bound of a million on each number. Well, there's a very high probability that you generated the majority of numbers from 1 to 1,000,000. So yeah, obviously any algorithm should be fast. Try again but remove the million upper limit.

Edit: This

indicates that it's the third point that's making it easy for you.

thanks for your input, i will remove the upper bounds and test again, one thing tho,

I don’t know where/how you came up with that number (2 power million (around 300000 zeros of numbers to store!)) but I don’t think any pc or any ram can handle even storing such amount of number to try and perform operations on it, the maximum array size in my programming language is 16 million, I could use multiple arrays and cycle through them but even then the number wouldn’t come close to 2 power million. anyway i think I've cleared my head and its time to head back to data compression...

Edit: yes, you are correct, after removing the upper limits the algorithm did not yield the desired results...
 
Last edited:
LolipopDragon said:
Does this mean i should not pursue this any longer?
I don't know your algorithm. Just to mention: you are not allowed to use random guesses.
 
LolipopDragon said:
Does this mean i should not pursue this any longer?
Pisinger's algorithm, published in 1995, does seem to address the case you treated. It's an interesting paper by the way, if you like this subject you may like his paper.
 
I was reading documentation about the soundness and completeness of logic formal systems. Consider the following $$\vdash_S \phi$$ where ##S## is the proof-system making part the formal system and ##\phi## is a wff (well formed formula) of the formal language. Note the blank on left of the turnstile symbol ##\vdash_S##, as far as I can tell it actually represents the empty set. So what does it mean ? I guess it actually means ##\phi## is a theorem of the formal system, i.e. there is a...
Back
Top