Skip to content
Prev 65837 / 398513 Next

Simplex(boot) returning invalid answer

On Fri, 11 Mar 2005 09:09:15 -0800, Andrew Stoneman
<stoneman at otsys.com> wrote :
You missed this in the help page:
The reason for this requirement is that the origin should be a
feasible solution; that's where the algorithm starts.

It's been a while since I looked at this stuff so I forget if there's
an easier transformation, but one way to solve the problem you're
interested in (-x-y <= -1) is to multiply through by -1 giving (x + y
i.e.

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

lbMatrix <- matrix(c(1,1), 1, 2)
lbVector <- 1

objective <- c(0,1)

simplex(a = objective, A1 = ubMatrix, b1 = ubVector, A2 = lbMatrix, b2
= lbVector)

which gives the answer you were looking for.

I suppose you might suggest to the maintainer to add

stopifnot(all(c(b1, b2, b3) >= 0))

to the beginning of the function rather than giving a bad answer for
bad input.

Duncan Murdoch