[R] Subset sum problem.

David Winsemius dwinsemius at comcast.net
Tue Dec 8 15:27:31 CET 2009


On Dec 8, 2009, at 9:14 AM, Geert Janssens wrote:

> On Tuesday 8 December 2009, David Winsemius wrote:
>> On Dec 8, 2009, at 8:29 AM, Geert Janssens wrote:
>>> Thank you for your reply.
>>>
>>> Unfortunately, I don't have any experience with this kind of
>>> mathematics. I don't understand what the wiki page tries to tell me.
>>>
>>> Please don't misinterpret his, but I simply don't have the time to
>>> learn a) how to interpret the math description on wikipedia and b)  
>>> how that
>>> translates into a new environment for me. I tried what I could,  
>>> but just like all
>>> volunteers on this list, my time is limited. I do have a practical
>>> use for a subset sum solving algorithm and R seems like a quite  
>>> capable
>>> package. But for my novice eyes it looks I'll need to understand  
>>> more of it than
>>> entering a simple formula which needs time I currently don't have.
>>
>> Dangerously close to:
>>
>> library(fortunes)
>> fortune("brain surgery")
>>
> I understand. The problem in this case is easily described, but not  
> easily
> solved. When I started to look for a solution, I didn't realize that.
>
>>> That's why I asked if someone had solved it before, and was willing
>>> to share his/her program with me. I would be very grateful if  
>>> someone can
>>> help me here.
>>
>> An implementation was described in the last few months on this list.
>>
> I did find "The 'Subset matching' challenge" thread before asking any
> questions myself
> (https://stat.ethz.ch/pipermail/r-help/2009-October/216604.html)
>

That's the one. I didn't test the code that the OP offered. He said it  
was inefficient but implied that it did the job. "Inefficiency" is  
pretty much what you would expect after considering the combinatoric  
explosion that would occur, so I thought the request for code was  
satisfied.

> That's where I learned the "Subset sum" name in the first place,  
> which I used
> to search further. The thread itself does not provide a solution in  
> R, unless
> I'm really mistaking.
>
> If you were thinking of another thread on the list, I sure could use  
> a hint on
> what keywords to search for.
>
> I also tried google in various incantations, but "R" is not really a  
> useful
> search term in google... I find lots of theoretical descriptions of  
> the subset
> sum problem, but no implementation in R.

When I search with Google, I use "r-project", since that is a  
reasonably specific term that would be found in citations and links to  
the website.

>
> Geert

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list