Re: [R] Increasing precision of rgenoud solutions

From: Paul Smith <phhs80_at_gmail.com>
Date: Thu, 10 May 2007 19:15:49 +0100

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

On 5/10/07, Jasjeet Singh Sekhon <sekhon_at_berkeley.edu> wrote:
>
> Hi Paul,
>
> Solution.tolerance is the right way to increase precision. In your
> example, extra precision *is* being obtained, but it is just not
> displayed because the number of digits which get printed is controlled
> by the options("digits") variable. But the requested solution
> precision is in the object returned by genoud().
>
> 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.000001)
>
> I get
>
> > a$par
> [1] 0.7062930 0.7079196
>
> But if I set options("digits"=12), and without rerunning anything I check
> a$par again, I observe that:
>
> > a$par
> [1] 0.706293049455 0.707919577559
>
> Cheers,
> Jas.
>
> =======================================
> Jasjeet S. Sekhon
>
> Associate Professor
> Survey Research Center
> UC Berkeley
>
> http://sekhon.berkeley.edu/
> V: 510-642-9974 F: 617-507-5524
> =======================================
>
>
> 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_at_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. Received on Thu 10 May 2007 - 18:24:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 May 2007 - 18:31:31 GMT.

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