[R] constrained input for optimization algorithm

Prof. John C Nash nashjc at uottawa.ca
Fri Jul 31 13:04:01 CEST 2009


As someone very involved with optim and its evolution I can say it is 
not at all suited to this sort of combinatoric optimization. I don't 
know if there are packages in R to help out -- it would be nice.

If (this may be a big IF) your set of possible combinations is not too 
large, combn() generates the C(n,r) combinations and, assuming the 
function is not too expensive to compute, one can use enumeration and be 
certain of having the optimum.

choose(60,5) shows about 5.5 million sets. A bit tedious, but likely 
doable over lunchtime. But choose(600,5) is >600 billion, and probably 
too heavy.

John Nash

 >From: Zhi Xie <xiezhi at gmail.com>

 >It seems that optimization algorithm, optim, tries to find optimized
 >parameters within defined lower and upper bounds. In my problem, all
 >the parameters are integers. My question is that if there is any means
 >that I can let "optim" only tries mutual exclusive integers. To be
 >specific, I am giving an example here.

 >I tried to find a set parameters with five elements with the lowest
 >value for the cost function. The parameter set that "optim" returned
 >is "5, 5, 49, 51, 51". However, I only wanted to search unique
 >parameter values, such as "5, 6, 49, 50, 51".




More information about the R-help mailing list