coin-or / coin-or/CyLP

getBasisStatus influence primalVariableSolutionAll

Open
#110 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JetBrains MPS
Stars
192
Forks
70
PR merge metrics
No merged PRs in 30d

Description

When I add one more line model.getBasisStatus(). The result changes.

```
import numpy as np
from cylp.cy import CyClpSimplex
from cylp.py.modeling.CyLPModel import CyLPArray

A = [[50, 31], [-3, 2, ]]
b = [250, 4]
c = [-1, -0.64]
l = [1, 0]
u = [10000, 10000]

model = CyClpSimplex()
x = model.addVariable('x', len(c))
A = np.matrix(A)
b = np.matrix(b)
l = CyLPArray(l)
u = CyLPArray(u)
c = CyLPArray(c)
model += (A * x <= b)
model += l <= x <= u
model.objective = c * x

model.primal()
#print(model.getBasisStatus())
print(model.primalConstraintSolution) #row value
print(model.primalVariableSolutionAll) #row slack

print(model.dualConstraintSolution) #dual variable
print(model.dualVariableSolution) #dual slack
```
model.primalVariableSolutionAll will output [1.94818653e+000 4.92227979e+000 2.31462827e-152 1.63041663e-322]
But If uncoment the model.getBasisStatus(), primalVariableSolutionAll will return [1.94818653e+000 4.92227979e+000 3.22302250e+160 1.63041663e-322]

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.