multiplication of CyLPExpr by constant not commutative
- Dominant language
- JetBrains MPS
- Stars
- 192
- Forks
- 70
- PR merge metrics
- No merged PRs in 30d
Description
When multiplying by a constant before or after a variable.sum() I get a wrong / good answer
```python
from cylp.cy.CyClpSimplex import CyClpSimplex
s = CyClpSimplex()
x = s.addVariable("x", 2)
y = s.addVariable("y", 2)
s += y >= 0
s += y.sum() - x.sum() * 3 <= -1 # ==> gives wrong solution x=[0,1]
# s += y.sum() - 3 * x.sum() <= -1 # ==> gives correct solution x=[0,0.3333]
s.objective = x.sum()
s.primal()
```
The two expressions `y.sum() - x.sum() * 3 <= -1` and `y.sum() - 3 * x.sum() <= -1` should represent the same constraint and give the same results but only the second gives the correct model.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.