Skip to content
Prev 333267 / 398506 Next

The smallest enclosing ball problem

On 17-11-2013, at 11:32, Hans W.Borchers <hwborchers at googlemail.com> wrote:

            
See my second reply to your original post.
Modify your code with

A <- matrix(rep(1,3),nrow=4,ncol=3,byrow=TRUE)
A[2:4,] <- diag(3)   
b <- c(1,0,0,0)

to include constraints x_i>=0 (which LowRankQP includes automatically!) and run solve.QP as follows

sol2 <- solve.QP(D, d, t(A), b, meq = 1)
sol2

p0 <- c(C %*% sol2$solution) 
r0 <- sqrt(-sol2$value) 
p0
r0
# distance of all points to the center
sqrt(colSums((C - p0)^2))
 
and the answers now agree with LowRankQP.

Berend