coin-or / coin-or/CyLP

addConstraint ignored

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

Description

I was wondering why the constraint "x[0] == 1" is violated in the following program:

``` Python
m = CyClpSimplex()
x = m.addVariable('x', 2)
m.addConstraint( x[0] == 1 )
# does not work either:
# m += x[0] == 1
# this works:
# m += scipy.matrix([1, 0])*x == 1
m.objective = x[0]
m += 0 <= x[0]
cbcModel = m.getCbcModel()
cbcModel.solve()
print(cbcModel.primalVariableSolution['x'])
# output: [ 0. 0.]
```

It works when I remove the nonnegativity constraint or when I use the scipy.matrix constraint. Note that I use two variables instead of 1 for this example due to Issue #22.

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.