The problem is NP-Complete and the real problem is how you can solve it.
According to the wiki page, you can use the bottom algorithm(Polynomial time
approximate algorithm) to solve your problems.
If you had trouble with writing R code, you can read ``R-introduction''.
regards
Guo-Hao Huang
--------------------------------------------------
From: "Geert Janssens" <janssens-ge...@telenet.be>
Sent: Monday, December 07, 2009 10:56 PM
To: <r-help@r-project.org>
Subject: [R] Subset sum problem.
Hi,
I'm quite new to the R-project. I was suggested to look into it because I
am
trying to solve the "Subset sum" problem", which basically is:
Given a set of integers and an integer s, does any non-empty subset sum to
s?
(See http://en.wikipedia.org/wiki/Subset_sum_problem)
I have been searching the web for quite some time now (which is how I
eventually discovered that my problem is called subset sum), but I can't
seem
to find an easily applicable implementation. I did search the list
archive,
the R website and used the help.search and apropos function. I'm afraid
nothing obvious showed up for me.
Has anybody tackled this issue before in R ? If so, I would be very
grateful
if you could share your solution with me.
Thank you very much.
Geert
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.