如何用一个自由变量解决这个受约束的线性规划 (LP) 问题?

How do I solve this constrained linear programing (LP) problem with one free variable?

我正在研究对预测进行排名的方法并找到这篇论文,A novel ranking procedure for forecasting approaches using Data Envelopment Analysis,我一直在研究这篇文章并设置我的数据,但我似乎无法在 R 中复制他们的 LP 公式?

这是我指的公式:LP Formulation

这是我正在尝试使用上述公式作为参考来尝试复制其结果的示例。数据基于上述文章中的 'Table 2. Log values of data of illustrative example'。

library(lpSolve)
library(nonparaeff)

DMU = c("FOR01", "FOR02", "FOR03", "FOR04", "FOR05")

log.data = matrix(data = as.numeric(c("1.794","1.575","3.576"
                                      ,"2.228","2.106","6.628"
                                      ,"2.399","1.871","6.354"
                                      ,"2.619","1.983","5.849"
                                      ,"2.559","1.541","5.676")), ncol = 3, byrow = TRUE)

colnames(log.data) = c("M1", "M2", "M3")
rownames(log.data) = DMU

THETA = c(-1,-1,-1,0)

add.to.one = c(1,1,1,1,1) # Constraint so each lambda adds up to one.

f.obj = c(1)

f.con = cbind(THETA, rbind(t(log.data), add.to.one))

f.dir = c("<=","<=","<=","=")

f.rhs = c(1.794,1.575,3.576,1)

lp2(direction = "min", f.obj, f.con, f.dir, f.rhs, free.var =  c(1))

我正在使用包 lpsolve 和 nonparaeff; nonparaeff 扩展了 lp() 函数,因此它可以处理自由变量。

使用这段代码我最终得到了错误:

"Error: no feasible solution found".

然而,在文章中他们以 0 或 1 的 theta 结尾,第一个 lambda 返回 1。所以我一定是做错了什么。

我是否正确应用了第四个约束条件 ('add.to.one')?此外,lp() 已经假设每个变量 >= 为零,但它是否假设其他任何变量?

我是否正确地将公式转换为 R?我是否正确使用了 lp2 函数?

我在这里查看了其他类似的 lp 问题,但我没有看到很多关于自由变量的问题。但如果您不这么认为,请 link 我回答其他问题。

提前致谢。

lpSolve 使用起来有点痛苦。但是,使用称为变量拆分的技术实现自由变量应该不会太困难。 IE。用 xplus,xmin>=0 替换 xplus-xmin 的自由变量 x。两者都不能为非零(那么基矩阵将是奇异的)。

我认为这是正确的更新代码:

library(lpSolve)

DMU = c("FOR01", "FOR02", "FOR03", "FOR04", "FOR05")

log.data = matrix(data = as.numeric(c("1.794","1.575","3.576"
                                      ,"2.228","2.106","6.628"
                                      ,"2.399","1.871","6.354"
                                      ,"2.619","1.983","5.849"
                                      ,"2.559","1.541","5.676")), ncol = 3, byrow = TRUE)

colnames(log.data) = c("M1", "M2", "M3")
rownames(log.data) = DMU

theta = c(-1,-1,-1,0)

add.to.one = c(1,1,1,1,1) # Constraint so each lambda adds up to one.

f.obj = c(0,0,0,0,0,1,-1)

f.con = cbind(rbind(t(log.data), add.to.one),theta,-theta)

f.dir = c("<=","<=","<=","=")

f.rhs = c(1.794,1.575,3.576,1)

r <- lp(direction = "min", f.obj, f.con, f.dir, f.rhs)

最好使用功能更强大的工具,例如 CVXR。