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

  • Context: Undergrad 
  • Thread starter Thread starter LolipopDragon
  • Start date Start date
  • Tags Tags
    P vs np Sum
Click For Summary

Discussion Overview

The discussion revolves around the Subset Sum problem, particularly in relation to the participant's attempts to develop an algorithm that efficiently finds subsets of random integers summing to a specified number. The conversation explores algorithmic efficiency, the implications of problem constraints, and the relevance of existing solutions in the context of NP-completeness.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes their approach to solving the Subset Sum problem using a large set of random integers and questions what they might be missing in their findings.
  • Another participant challenges the validity of the algorithm by questioning its polynomial time complexity and suggests testing with significantly larger sets of numbers.
  • Concerns are raised about the distribution of generated numbers, with a suggestion that the upper bound on the random integers may skew results.
  • A reference is made to Pisinger's linear time algorithm for specific cases of the Subset Sum problem, prompting questions about the relevance of this algorithm to the participant's approach.
  • There is a mention of the impracticality of handling extremely large sets of numbers, with a focus on the limitations of current computational resources.
  • One participant expresses uncertainty about whether to continue pursuing their algorithm after receiving feedback on its limitations and the existence of established solutions.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness and validity of the original algorithm, with some questioning its assumptions and others suggesting it may not be a viable approach. The discussion remains unresolved regarding the participant's next steps and the applicability of existing algorithms to their problem.

Contextual Notes

Limitations include assumptions about the distribution of random numbers, the computational feasibility of testing large sets, and the constraints of the algorithm's design. The discussion does not resolve the implications of Pisinger's algorithm on the participant's approach.

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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K