Re: [R] optim with specific constraints on possible values

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sat 20 May 2006 - 02:31:11 EST

          Searching over a finite set of possible values sounds like a variant of integer programming. If the finite number is small, then the most efficient algorithm may be just to compute them all.

          However, if it's a number like 13^13, then that's not feasible. If the objective function is sufficiently smooth and well defined over all real numbers (at least in some convex set, preferably rectangular), then a good "integer programming algorithm" may be to find the optimum ignoring the integer constraint first, then search all integer combinations in an appropriate region of the non-integer optimum.

          Have you tried RSiteSearch("integer programming")? This just produced 205 hits for me. Some were relevant, some weren't. Google also seemed to produce some potentially useful hits.

          What problem are you trying to solve? If a grid search is used just to simplify the problem, I think that's wise if the objective function is known to have multiple local optima, discontinuities, etc. If, however, the objective function is smooth, then I think 'optim' or 'nlminb' might work better for you, especially if your "finite set" is merely an attempt to reduce the compute time.

	  Hope this helps,
	  Spencer Graves

Camarda, Carlo Giovanni wrote:
> Dear R-users,
>
> I am working with some grid-search optimization for 13 values of an
> object function.
>
> At glance one may compute the object function for each possible
> combination of set of parameters, but in my case would not be feasible:
> taking for example 13 possible values for each parameters like, in
> logarithm scale, 10^seq(-3,3,.5) will lead to 13^13 combinations of
> results.
>
> As a second trial I use the general-purpose function "optim" both
> without and with constraints from the candidate values (of course the
> latter is fast and fine with me), but I am wondering whether there is
> kind of optim-function which optimize using only a series of values to
> give as additional arguments. Just inventing, something like:
>
> possible1 <- 10^seq(-3,3,0.5)
> possible2 <- 10^seq(-3,3,0.5)
> ...
> possible13 <- 10^seq(-3,3,0.5)
>
> new.optim(par=rep(median(possible1), 13),
> fn=my.object.function,
> from=cbind(possible1, possible2,..., possible13))
>
> Instead of just:
> optim(par=rep(median(possible1), 13),
> fn=my.object.function,
> method=c("L-BFGS-B"),
> lower=rep(min(possible1), 13),
> upper=rep(min(possible1), 13))
>
>
> Thanks in advance,
> Carlo Giovanni Camarda
>
> ===========================================
> Camarda Carlo Giovanni
> PhD-Student
> Max Planck Institute for Demographic Research
> Konrad-Zuse-Strasse 1
> 18057 Rostock, Germany
> Tel: +49 (0)381 2081 172
> Fax: +49 (0)381 2081 472
> camarda@demogr.mpg.de
> ===========================================
>
>
> ----------
> This mail has been sent through the MPI for Demographic Rese...{{dropped}}
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 20 02:37:28 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 20 May 2006 - 04:10:12 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.