0

我需要解决混合方程/不等式:

a1 + a2 + a3 >= 50
b1 + b2 + b3 <= 40
c1 + c2 + c3 <= 10
a1 + b1 + c1  = 50
a2 + b2 + c2  = 35
a3 + b3 + c3  = 15

有九个变量和六个方程/不等式,但我将一次将三个变量归零(我必须检查所有组合)。

我在 R (limSolve,matlib)中尝试了几个包,但没有成功。

#The matrix representation:
X1 <- c(1,1,1,0,0,0,0,0,0)
X2 <- c(0,0,0,1,1,1,0,0,0)
X3 <- c(0,0,0,0,0,0,1,1,1)
Y1 <- c(1,0,0,1,0,0,1,0,0)
Y2 <- c(0,1,0,0,1,0,0,1,0)
Y3 <- c(0,0,1,0,0,1,0,0,1)
A1 <- matrix(c(X1,X2,X3,Y1,Y2,Y3),c(9,9))
A2 <- t(A1); colnames(A2) <- c("a1","a2","a3","b1","b2","b3","c1","c2","c3")
b <- c(50,40,10,50,35,15)

任何帮助将不胜感激。

4

1 回答 1

1

这可以使用线性规划来解决。没有什么可以优化的,你只是在寻找一个可行的解决方案。

library(lpSolve)

res=lp(
  "min",
  rep(0,ncol(A2)),
  A2,
  c(">=","<=","<=","==","==","=="),
  b
)

res$solution

[1] 50 35 15  0  0  0  0  0  0
于 2021-01-22T09:23:19.497 回答