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.
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:
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.