How to add a matrix variable to a matrix/array?
Awaiting user inputI have defined an array and a matrix variable in the concrete model. Then I add the constraint below. However, "Incompatible dimension" is casted. What's wrong with my code?
y_i = [[3, 2, 1, 1, 2],
[3, 2, 1, 1, 2],
[3, 2, 1, 1, 2]]
## y_ii's dimension: B * 1, i = 1, ..., N
y_ii = locals()
for i in range(N):
y_ii['y_'+str(i+1)+str(i+1)] = m.addMVar(len(B),
name = 'y_{}{}'.format(i+1, i+1))
for i in range(N):
### (1c)
m.addConstr(y_ii['y_'+str(i+1)+str(i+1)] == y_i[i])
0
-
Hi Jacob,
Please post a minimal working example reproducing this issue. In particular, in your code snippet the values of \(N\) and \(B\) are missing.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment