Thanks a lot, Jasjeet. That is it. Paul
On 5/10/07, Jasjeet Singh Sekhon <[EMAIL PROTECTED]> wrote: > > Hi Paul, > > I see. You want to increase the population size (pop.size) > option---of lesser importance are the max.generations, > wait.generations and P9 options. For more details, see > http://sekhon.berkeley.edu/papers/rgenoudJSS.pdf. > > For example, if I run > > a <- genoud(myfunc, nvars=2, > > Domains=rbind(c(0,1),c(0,1)),max=TRUE,boundary.enforcement=2,solution.tolerance=0.0000001, > pop.size=6000, P9=50) > > options("digits"=12) > > I obtain: > > #approx analytical solution > sum(c(0.707106781186548,0.707106781186548)) > [1] 1.41421356237 > > #genoud solution > #a$value > [1] 1.41421344205 > > #difference > a$value-sum(c(0.707106781186548,0.707106781186548)) > > [1] -2.91195978441e-09 > > If that's not enough precision, increase the options (and the > run-time). This would be faster with analytical derivatives. > > Cheers, > Jas. > > ======================================= > Jasjeet S. Sekhon > > Associate Professor > Travers Department of Political Science > Survey Research Center > UC Berkeley > > http://sekhon.berkeley.edu/ > V: 510-642-9974 F: 617-507-5524 > ======================================= > > > > Paul Smith writes: > >Thanks, Jasjeet, for your reply, but maybe I was not enough clear. > > > >The analytical solution for the optimization problem is the pair > > > >(sqrt(2)/2,sqrt(2)/2), > > > >which, approximately, is > > > >(0.707106781186548,0.707106781186548). > > > >The solution provided by rgenoud, with > > > >solution.tolerance=0.000000001 > > > >was > > > >$par > >[1] 0.7090278 0.7051806 > > > >which is not very precise comparing with the values of the > >(analytical) solution. Is it possible to increase the degree of > >closeness of the rgenoud solutions with the analytical ones? > > > >Paul > > > >Paul Smith writes: > > > Dear All > > > > > > I am using rgenoud to solve the following maximization problem: > > > > > > myfunc <- function(x) { > > > x1 <- x[1] > > > x2 <- x[2] > > > if (x1^2+x2^2 > 1) > > > return(-9999999) > > > else x1+x2 > > > } > > > > > > genoud(myfunc, nvars=2, > > > Domains=rbind(c(0,1),c(0,1)),max=TRUE,boundary.enforcement=2,solution.tolerance=0.000001) > > > > > > How can one increase the precision of the solution > > > > > > $par > > > [1] 0.7072442 0.7069694 > > > > > > ? > > > > > > I have tried solution.tolerance but without a significant improvement. > > > > > > Any ideas? > > > > > > Thanks in advance, > > > > > > Paul > > > > > > > > > ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.