[R] Quadratic programming with semi-definite matrix

Hans W Borchers hwborchers at googlemail.com
Mon Dec 6 19:01:18 CET 2010

Andreas Jensen <bentrevisor <at> gmail.com> writes:

> Hello.
> I'm trying to solve a quadratic programming problem of the form min
> ||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog
> package but I'm having problems with Dmat not being positive definite,
> which is kinda okay since I expect it to be numerically semi-definite
> in most cases. As far as I'm aware the problem arises because the
> Goldfarb and Idnani method first solves the unconstrained problem
> requiring a positive definite matrix. Are there any (fast) packages
> that allows me to do QP with (large) semidefinite matrices?
> Example:
> t <- 100
> y <- signalConvNoisy[1,]
> D <- crossprod(H,H)
> d <- crossprod(H,y)
> A <- cbind(rep(-1, nrow(H)), diag(ncol(H)))
> b0 <- c(t, rep(0, ncol(H)))
> sol <- solve.QP(Dmat=D, dvec = d, Amat = A, bvec = b0)$solution
> Error in solve.QP(Dmat = D, dvec = d, Amat = A, bvec = b0) :
>   matrix D in quadratic function is not positive definite!
> Thanks in advance,
> Andreas Jensen

See the Optimization task view, there are several packages that promise to
handle quadratic programming problems. You may also try one of the nonlinear
optimization packages, they are not much slower nowadays.

Your code cannot be executed as "signalConvNoisy" is unknown.

Hans Werner

More information about the R-help mailing list