coin-or / coin-or/CyLP

Hard to use auxiliary variables

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

Description

Sometimes it is necessary to use one-dimensional variables. These are currently not handled correctly in matrix-style constraint definitions. Let me provide an example based on [this setInteger example](http://mpy.github.io/CyLPdoc/modules/CyClpSimplex.html) (where "from CyLP" should be "from cylp"):

``` Python
import numpy as np
from cylp.cy import CyClpSimplex
from cylp.py.modeling.CyLPModel import CyLPModel, CyLPArray
model = CyLPModel()

x = model.addVariable('x', 3)
y = model.addVariable('y', 1)

A = np.matrix([[1., 2., 0],[1., 0, 1.]])
B = np.matrix([[1., 0, 0], [0, 0, 1.]])
D = np.matrix([[1.],[0]])
a = CyLPArray([5, 2.5])
b = CyLPArray([4.2, 3])
x_u= CyLPArray([2., 3.5])

model += A*x <= a
model += 2 <= B * x + D * y <= b
```

> IndexError: tuple index out of range

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.