首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >quadprog R中不兼容的类型

quadprog R中不兼容的类型
EN

Stack Overflow用户
提问于 2013-07-03 05:13:02
回答 1查看 2.2K关注 0票数 1

我是R的新手,正在尝试使用R解决QP问题。我不断收到以下错误:

代码语言:javascript
复制
Amat and dvec are incompatible.

下面是我的代码:

代码语言:javascript
复制
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)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-03 05:49:19

?solve.QP文档提到

代码语言:javascript
复制
   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)

代码语言:javascript
复制
 output_qp <- solve.QP(S, Fr, t(Amat), bv, neq, factorized=FALSE)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17435939

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档