Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBasisStatus influence primalVariableSolutionAll #110

Open
abdxyz opened this issue Dec 8, 2020 · 0 comments
Open

getBasisStatus influence primalVariableSolutionAll #110

abdxyz opened this issue Dec 8, 2020 · 0 comments

Comments

@abdxyz
Copy link

abdxyz commented Dec 8, 2020

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant