Erwin Kalvelagen-2 wrote:
Hans W Borchers hwborchers at googlemail.com writes:
# Prepare inputs for MILP solver
obj - c(rep(0, n), 0, 1, 1, 0)
typ - c(rep(B, n), B, C, C, B)
mat - matrix(c(s, -z, -1, 1, 0,# a = a_p + a_m
rep(0, n), 1, 0, 0,
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
Given vector of numbers x, I wish to select an n-subset with sum closest
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
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
Thank you very much, Erwin. If I may ask some follow-up questions
1. GAMS R, ad it's just not entirely clear how to move the soltion to R.
(At most trivial, how do I bring in the subsettable vector into the
solver?)
2. The quadratic
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
Is it a subset of a vector containing 100 elements, or 1ths?
I need to pick 2-40 elements out of a 50-200-element-long vector.
A random number of elements that should be chosen, or the best 10 values
which sums up to a defined
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
A 40-element subset proves too much :(
Error: cannot allocate vector of size 554.1 Mb
Thanks, Bart!
I could solve a problem with n=200, k=40 with Cplex's MIQP solver in less than
a
minute, but that may depend heavily on the
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
This is a subset sum problem and has been discussed here in December
Thanks a lot! Will investigate.
Can you settle for an approximate solution?
Absolutely.
You can use the script from the thread subset sum problem to find
Dimitri Shvorob dimitri.shvorob at gmail.com writes:
?!! Erwin, may I ask for a working code sample? (Including appropriate
package(s))
Thank you.
I used GAMS + CPlex. The models are here:
http://yetanothermathprogrammingconsultant.blogspot.com/2010/01/solving-
7 matches
Mail list logo