[R] The smallest enclosing ball problem
Hans W.Borchers
hwborchers at googlemail.com
Sun Nov 17 12:20:46 CET 2013
Berend Hasselman <bhh <at> xs4all.nl> writes:
>
It seems you are absolutely right. I always assumed a quadratic programming
solver will -- as all linear programming solvers do -- automatically require
the variables to be positive.
I checked it for some more examples in 10 and even 100 dimensions, and the
results now agree. Still, it's a bit disappointing that 'quadprog' will not
solve problems with 10 points in R^3, because the corresponding matrices are
not positive definite.
Thanks
Hans Werner
>
> After having a closer look at this problem, I believe you did not include
> the constraint x_i >= 0 in the call to solve.QP.
> So with this modification of your code
>
> A <- matrix(rep(1,3),nrow=4,ncol=3,byrow=TRUE)
> A[2:4,] <- diag(3)
> b <- c(1,0,0,0)
>
> sol3 <- solve.QP(D, d, t(A), b, meq = 1) # first row of A is an equality
> sol3
> p0 <- c(C %*% sol3$solution)
> r0 <- sqrt(-sol3$value)
> p0
> r0
> sqrt(colSums((C - p0)^2))
>
> one gets the correct answer.
> BTW LowRankQP seems to postulate x_i >=0 if I read its manual correctly.
>
> Berend
More information about the R-help
mailing list