[R] Simplex(boot) returning invalid answer

From: Andrew Stoneman <stoneman_at_otsys.com>
Date: Sat 12 Mar 2005 - 04:09:15 EST


In trying to use simplex() from the boot package, I have run into a situation that doesn't seem like it should be possible. It is claiming that it has solved the LP, but returns a vector of all zeros, which does not satisfy the constraints I passed in. A small example:

> ubMatrix <- matrix(c(1,1,-1,0,-1,-1), 3, 2)
> ubVector <- c(2,1,-1)
> objective <- c(0,1)

> ubMatrix

      [,1] [,2]

[1,]    1    0
[2,]    1   -1
[3,]   -1   -1

> ubVector

[1] 2 1 -1

> smplx <- simplex( a = objective, A1 = ubMatrix, b1 = ubVector)

> smplx$solved

[1] 1
> smplx$soln

x1 x2
  0 0

> ubMatrix %*% smplx$soln <= ubVector

       [,1]

[1,]  TRUE
[2,]  TRUE
[3,] FALSE

The correct answer to the problem, which also has a value of 0, but satisfies the constraints is [1, 0] :

> ubMatrix %*% c(1,0) <= ubVector

      [,1]

[1,] TRUE
[2,] TRUE
[3,] TRUE

Any ideas what's going on here? Am I missing something obvious? Any advice on how I might work around this problem would be greatly appreciated.

Andrew



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Mar 14 10:34:06 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:47 EST