[R] Testing optimization solvers with equality constraints

Abby Spurdle @purd|e@@ @end|ng |rom gm@||@com
Sun May 23 07:25:47 CEST 2021

For a start, there's two local minima.

Add to that floating point errors.
And possible assumptions by the package authors.

----begin code----
f <- function (x, y, sign)
{   unsign.z <- sqrt (1 - x^2 - y^2)
    2 * (x^2 - sign * y * unsign.z)

north.f <- function (x, y) f (x, y, +1)
south.f <- function (x, y) f (x, y, -1)

N <- 100
p0 <- par (mfrow = c (1, 2) )
plotf_cfield (north.f, c (-1.1, 1.1),
    ncontours=10, n=N, raster=TRUE, hcv=TRUE)
plotf_cfield (south.f, c (-1.1, 1.1),
    ncontours=10, n=N, raster=TRUE, hcv=TRUE)
par (p0)
----end code ----

Please ignore R warnings.
I'm planning to reinvent this package soon.
And also, it wasn't designed for circular heatmaps.

On Sat, May 22, 2021 at 8:02 PM Hans W <hwborchers using gmail.com> wrote:
> Yes. "*on* the unit sphere" means on the surface, as you can guess
> from the equality constraint. And 'auglag()' does find the minimum, so
> no need for a special approach.
> I was/am interested in why all these other good solvers get stuck,
> i.e., do not move away from the starting point. And how to avoid this
> in general, not only for this specific example.
> On Sat, 22 May 2021 at 09:44, Abby Spurdle <spurdle.a using gmail.com> wrote:
> >
> > Sorry, this might sound like a poor question:
> > But by "on the unit sphere", do you mean on the ***surface*** of the sphere?
> > In which case, can't the surface of a sphere be projected onto a pair
> > of circles?
> > Where the cost function is reformulated as a function of two (rather
> > than three) variables.
> >

-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt_sphere.png
Type: image/png
Size: 37702 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210523/d243b26a/attachment.png>

More information about the R-help mailing list