Hello, here is an example from the manual. How to turn this minimization problem into maximization problem, i.e. -(0 5 0) %*% b - 1/2 b^T b? # Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b # under the constraints: A^T b >= b0 # with b0 = (-8,2,0)^T # and (-4 2 0) # A = (-3 1 -2) # ( 0 0 1) # we can use solve.QP.compact as follows: # library(quadprog) Dmat <- matrix(0,3,3) diag(Dmat) <- 1 dvec <- c(0,5,0) Aind <- rbind(c(2,2,2),c(1,1,2),c(2,2,3)) Amat <- rbind(c(-4,2,-2),c(-3,1,1)) bvec <- c(-8,2,0) solve.QP.compact(Dmat,dvec,Amat,Aind,bvec=bvec) Thanks, Serguei