lpSolve - 没有可行的解决方案

时间:2017-09-18 19:12:21

标签: r linear-programming lpsolve

请帮助,也许我是傻瓜,但我错过了什么? lpSolve没有收敛。

首先,我尝试解决这个问题并且正在运作

  

f.obj    [1] 0.02708294 0.02677628 0.05480254 0.09362836 -0.13018085 0.01081241 0.02723422 0.10048414 0.04800000 0.00750000 0.01400000

 > f.con
          [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
     [1,]    2    3    4    5    6    2    3    5    1     1     1
     [2,]    1    1    1    1    1    1    1    1    1     1     1
     [3,]    1    0    0    0    0    0    0    0    0     0     0
     [4,]    0    1    0    0    0    0    0    0    0     0     0
     [5,]    0    0    1    0    0    0    0    0    0     0     0
     [6,]    0    0    0    1    0    0    0    0    0     0     0
     [7,]    0    0    0    0    1    0    0    0    0     0     0
     [8,]    0    0    0    0    0    1    0    0    0     0     0
     [9,]    0    0    0    0    0    0    1    0    0     0     0
    [10,]    0    0    0    0    0    0    0    1    0     0     0
    [11,]    0    0    0    0    0    0    0    0    1     0     0
    [12,]    0    0    0    0    0    0    0    0    0     1     0
    [13,]    0    0    0    0    0    0    0    0    0     0     1
    > f.dir
     [1] "<=" "="  "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<="
    > f.rhs
     [1] 2.00000000 1.00000000 0.11194472 0.06814353 0.30487805 0.10031507 0.30487805 0.50000000 0.30487805 0.30487805 0.50000000 0.50000000
    [13] 0.50000000
    > lp ("max", f.obj, f.con, f.dir, f.rhs)$solution # solution
     [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.25 0.50 0.00 0.25

但是我想为变量添加条件&gt; 0.3如果出现在解决方案中那么我补充说:

> f.obj
 [1]  0.02708294  0.02677628  0.05480254  0.09362836 -0.13018085  0.01081241  0.02723422  0.10048414  0.04800000  0.00750000  0.01400000
> f.con
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
 [1,]    2    3    4    5    6    2    3    5    1     1     1
 [2,]    1    1    1    1    1    1    1    1    1     1     1
 [3,]    1    0    0    0    0    0    0    0    0     0     0
 [4,]    0    1    0    0    0    0    0    0    0     0     0
 [5,]    0    0    1    0    0    0    0    0    0     0     0
 [6,]    0    0    0    1    0    0    0    0    0     0     0
 [7,]    0    0    0    0    1    0    0    0    0     0     0
 [8,]    0    0    0    0    0    1    0    0    0     0     0
 [9,]    0    0    0    0    0    0    1    0    0     0     0
[10,]    0    0    0    0    0    0    0    1    0     0     0
[11,]    0    0    0    0    0    0    0    0    1     0     0
[12,]    0    0    0    0    0    0    0    0    0     1     0
[13,]    0    0    0    0    0    0    0    0    0     0     1
[14,]    1    0    0    0    0    0    0    0    0     0     0
[15,]    0    1    0    0    0    0    0    0    0     0     0
[16,]    0    0    1    0    0    0    0    0    0     0     0
[17,]    0    0    0    1    0    0    0    0    0     0     0
[18,]    0    0    0    0    1    0    0    0    0     0     0
[19,]    0    0    0    0    0    1    0    0    0     0     0
[20,]    0    0    0    0    0    0    1    0    0     0     0
[21,]    0    0    0    0    0    0    0    1    0     0     0
[22,]    0    0    0    0    0    0    0    0    1     0     0
[23,]    0    0    0    0    0    0    0    0    0     1     0
[24,]    0    0    0    0    0    0    0    0    0     0     1
> f.dir
 [1] "<=" "="  "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" "<=" ">=" ">=" ">=" ">=" ">=" ">=" ">=" ">=" ">=" ">=" ">="
> f.rhs
 [1] 2.00000000 1.00000000 0.11194472 0.06814353 0.30487805 0.10031507 0.30487805 0.50000000 0.30487805 0.30487805 0.50000000 0.50000000
[13] 0.50000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000 0.30000000
> lp ("max", f.obj, f.con, f.dir, f.rhs)   # linear programming
Error: no feasible solution found

为什么?

0 个答案:

没有答案