CyLP
CyLP copied to clipboard
Why the basis inverse for artifical variable at first iteration is the identity matrix?
From the code in OSI
, I know that the artifical variable is defined as lb <= s <= ub, Ax - s = 0
.
As a result, the basis matrix of the artificial variables s
should be the -I
instead of I
(identity matrix), but in s.basisInverse
, I still see I
.
Can anyone explain this confusion?
Could you post a minimal script that shows exactly what you're doing?
I'm just trying to understand relationship and difference between the structural variables and artifical variables in CyLP.
Assume the problem is max c'x s.t. lA <= Ax <= uA, l <= x <= u
. In CLP, the problem will become max c'x s.t. lA <= s <= uA, l <= x <= u, Ax = s
. x
are the structural variables and s
are the artificial variables.
However, at the first iteration, I found that all the artifical variables are set to basic
and with basisInverse
same as the identity matrix, which is confused since the constraints are Ax - s = 0
, the basisInverse
of s
should be -I
instead of I
.
I'm sure I make some mistakes. Can you help me about this?
Your understanding is pretty much correct, but precisely what should be expected is a function of the exact form of the problem you hand to CyLP, so I was asking you to post actual code that builds an instance and passes it to CyLP where things don't behave as you expect. Then I can try to see why. It's often some minor detail of the code that is important in explaining things like this.