Given vector of numbers x, I wish to select an n-subset with sum closest to fixed value s. Can anyone advise me how to approach this, in R?
I have considered Rcplex package, which handles integer/binary linear/quadratic optimization problems, but have difficulty setting up the quadratic form for [sum(x) - s]^2. (Dynamic programming over [0, sum(x)]? A genetic algorithm? Can anyone contribute a binary GA optimization sample?) Thank you. -- View this message in context: http://n4.nabble.com/Solving-an-optimization-problem-selecting-an-optimal-subset-tp1446084p1446084.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.