Обратите внимание, что 580X1 + 600X2 + 800X3 + 300X4 ≤ 1000 делает модель неосуществимой. Это очень простой решатель LP из учебника, и, похоже, он не очень изящно справляется с этим.
> library(linprog)
> cvec <- c(120,230,410,100) # obj coefficients
> Amat <- rbind(
+ # x1 x2 x3 x4
+ c(580,600,800,300), # 580X1 + 600X2 + 800X3 + 300X4 ≤ 10000
+ c( 1, 0, 0, 0), # x1 <= 10
+ c( 0, 1, 0, 0), # x2 >= 6
+ c( 0, 1, 0, 0), # X2 <= 10
+ c( 0, 0, 1, 0), # x3 >= 5
+ c( 0, 0, 1, 0), # x3 <= 12
+ c( 0, 0, 0, 1)) # x4 <= 10
> bvec <- c(10000,10,6,10,5,12,10) # RHS values
> dir <- c("<=","<=",">=","<=",">=","<=","<=")
> res <- solveLP(cvec, bvec, Amat, maximum = TRUE, const.dir = dir, verbose = 1)
> print(res)
Results of Linear Programming / Linear Optimization
Objective function (Maximum): 4660
Iterations in phase 1: 2
Iterations in phase 2: 1
Solution
opt
1 0
2 6
3 8
4 0
Basic Variables
opt
2 6
3 8
S 2 10
S 4 4
S 5 3
S 6 4
S 7 10
Constraints
actual dir bvec free dual dual.reg
1 10000 <= 10000 0 0.5125 2400
2 0 <= 10 10 0.0000 10
3 6 >= 6 0 77.5000 4
4 6 <= 10 4 0.0000 4
5 8 >= 5 3 0.0000 3
6 8 <= 12 4 0.0000 4
7 0 <= 10 10 0.0000 10
All Variables (including slack variables)
opt cvec min.c max.c marg marg.reg
1 0 120 -Inf 297.2500 -177.2500 4.13793
2 6 230 -Inf 307.5000 NA NA
3 8 410 306.667 Inf NA NA
4 0 100 -Inf 153.7500 -53.7500 8.00000
S 1 0 0 -Inf 0.5125 -0.5125 2400.00000
S 2 10 0 -177.250 Inf 0.0000 NA
S 3 0 0 -Inf 77.5000 -77.5000 4.00000
S 4 4 0 -77.500 Inf 0.0000 NA
S 5 3 0 -103.333 Inf 0.0000 NA
S 6 4 0 NA 103.3333 0.0000 NA
S 7 10 0 -53.750 Inf 0.0000 NA
>
Есть гораздо лучшие инструменты и решатели.