I forgot to attach the problem data, 'quadprog.Rdata' file, in my prior email.

I want to report a following error with quadprog. The solve.QP function
finds a solution to the problem below that violates the last equality
constraint. I tried to solve the same problem using ipop from kernlab
package and get the solution in which all equality constraints are
enforced. I also tried an old version of quadprog, Version: 1.4-11,
Date: 2007-07-12 and my problem is solved correctly.

I have tried to contact Berwin A. Turlach <berwin.turl...@gmail.com>
(maintainer for quadprog package) a week ago, with no success.


##############################################################
load(file='quadprog.Rdata')             

        # solve QP using quadprog       
        require(quadprog)
        sol = solve.QP(Dmat, dvec, Amat, bvec, meq)
                x = sol$solution
                check = x %*% Amat - bvec       
                # for some reason last equality constraint is violated
                round(check[1:meq], 4)


        # solve QP using kernlab
        require(kernlab)        
        n = nrow(Amat)
        sv = ipop(c = matrix(dvec), H = Dmat, A = t(Amat[,1:meq]),
                        b = bvec[1:meq], l = rep(-1000, n),
                        u = rep(1000, n), r = rep(0,meq))
                                
                x = primal(sv)
                check = x %*% Amat - bvec       
                # all constraints are ok
                round(check[1:meq], 4)





______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to