我是R的新手,正在尝试使用R解决QP问题。我不断收到以下错误:
Amat and dvec are incompatible.下面是我的代码:
d <- 4
Fr <- as.vector(Fr) ;
Aeq <- matrix(data=1, nrow=1, ncol=d) %*% U
Amat <- rbind(Aeq,U);
bv <- vector( mode= "integer", length = nrow(Amat))
bv[1] <- 1
neq <- 1
output_qp <- solve.QP(S, Fr, Amat, bv, neq, factorized=FALSE)发布于 2013-07-03 05:49:19
?solve.QP文档提到
problems of the form min(-d^T b + 1/2 b^T D b) with the constraints A^T b >= b_0.所以至少你必须改变这一点:Amat by t(Amat)
output_qp <- solve.QP(S, Fr, t(Amat), bv, neq, factorized=FALSE)https://stackoverflow.com/questions/17435939
复制相似问题