Skip to content
Prev 274005 / 398506 Next

Linear programming problem, RGPLK - "no feasible solution".

Liu Evans, Gareth <Gareth.Liu-Evans <at> liverpool.ac.uk> writes:
Please have a closer look at the help page "?Rglpk_solve_LP". The way to
define the bounds is a bit clumsy, but then it works:

    sol <- Rglpk_solve_LP(obj, mat, dir, rhs, types = NULL, max = FALSE,
            bounds = list(lower=list(ind=1:4, val=rep(-100,4)),
                          upper=list(ind=1:4, val=rep(100,4))),
            verbose=TRUE)
                
    GLPK Simplex Optimizer, v4.42
    9 rows, 4 columns, 19 non-zeros
          0: obj =  -1.000000000e+02  infeas =  1.626e+03 (2)
    *    10: obj =   1.000000000e+02  infeas =  0.000e+00 (0)
    *    13: obj =   2.247686558e+00  infeas =  0.000e+00 (0)
    OPTIMAL SOLUTION FOUND

    > sol
    $optimum
    [1] 2.247687
    $solution
    [1] -2.247687e+00 -6.446292e-31  2.247687e+00  2.247687e+00
If you can reproduce that R crashes -- which it shall never do -- inform the
maintainer of this package. On Mac it doesn't crash, it goes into an infinite
loop with "Execution aborted.Error detected in file glplib03.c at line 83".

Regards, Hans Werner