SCM

[#2293] Equality constraints

Date:
2012-10-02 21:33
Priority:
2
State:
Open
Submitted by:
Arne Henningsen (arne)
Assigned to:
Nobody (None)
Hardware:
All
Product:
None
Operating System:
All
Component:
None
Version:
None
Severity:
minor
Resolution:
Accepted As Bug
URL:
Summary:
Equality constraints

Detailed description
In some (many?) circumstances, solveLP() does not correctly work if the model includes equality constraints. This is demonstrated with the following simple example:

min x1 + x2, s.t. x1 + 0.5 * x2 = 2

> cvec <- c( 1, 1 )
> Amat <- matrix( c( 1, 0.5 ), nrow = 1 )
> bvec <- 2
> aa=solveLP( cvec, bvec, Amat, const.dir = "=" )
> aa$solution
1 2
0 0

Function lp(), which is available in the R package "lpSolve" and can be called through solveLP(), can cope with equality constraints:

> aa=solveLP( cvec, bvec, Amat, const.dir = "=", lpSolve = TRUE )
> aa$solution
1 2
2 0


I am grateful to Chun He for making me aware of this problem.

Comments:

Message  ↓
Date: 2012-10-16 19:22
Sender: Arne Henningsen

Another 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.

Attached Files:

Changes

No Changes Have Been Made to This Item

Thanks to:
Vienna University of Economics and Business Powered By FusionForge