Quadprog违反约束

时间:2017-07-10 09:01:00

标签: r optimization quadratic convex-optimization quadprog

您好我正在尝试使用R中的Quadprog包解决二次约束优化问题。但是非负性约束被违反

 library(quadprog)
options(scipen=999)
A=c(0,0,0,0)
Amat=cbind(diag(1, length(A)), rep(1, length(A)), rep(-1, length(A)))

bvec=c(rep(0, length(A)), 1, -1)

Dmat=matrix(c(2.00044131893129, 2.00049178814425,   2.00041839697958,   2.00030559324023,   2.00049178814425,   2.00064972136399,   2.00053994496836,   2.00037532914833,   2.00041839697958,   2.00053994496836,   2.00049628996226,   2.00032367551724,   2.00030559324023,   2.00037532914833,   2.00032367551724,   2.00031018936379)
,nrow=4,byrow=TRUE)
Dvec=c(2.00014726495946,    2.0002164445682,    2.00016868307137,   2.00014845293229)
Opt_quad=solve.QP(Dmat,Dvec,Amat,bvec)

然而输出正在变得越来越明显

0 个答案:

没有答案