Date: 2012-10-16 19:22 Sender: Arne HenningsenAnother example:
cvec <- c(27,9)
bvec <- c(8,74)
Amat <- matrix(c(1,1,-1,1),nrow=2)
solveLP(cvec, bvec, Amat, maximum=TRUE, const.dir=c("==","<="))
solveLP() returns the solution 74 and 0 but the correct solution is 41 and 33. The correct solution can be obtained by function lp(), which is available in the R package "lpSolve" and can be called through solveLP() by setting argument "lpSolve" to "TRUE".
solveLP(cvec, bvec, Amat, maximum=TRUE, const.dir=c("==","<="), lpSolve=TRUE)
I am grateful to Ulrike Grömping for reporting this bug and for providing this example. |