coin-or / coin-or/CyLP

Indexing by one-dimensional tuples

Open
#89 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'm converting symbolic tensors of different shapes into CyLP variables. This works well with one exception: when the shape is one-dimensional (it is still a tuple) you cannot reference individual variables by their tuple indices.

Example:

```
import cylp.cy

model = cylp.cy.CyClpSimplex()

s = model.addVariable('s', (2, 2))
r = model.addVariable('r', 2)
t = model.addVariable('t', (2, ))

# this works
print(s[(1, 1)])

# this works
print(r[1])

# this works
print(t[1])

# this doesn't work
print(t[(1,)])
```

The workaround is stated in the code above, but still it would be nice to be able to access elements of one-dimensional and higher-dimensional tensors in a consistent way.

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.