@ operator for 2 Mvars
AnsweredIs it possible to do the following with broadcasting in a constraint? (A and B are 2D MVars)
$$ A @ B \leq \overrightarrow{1} $$
1
-
This is not possible at the moment, but it has been logged as a feature request. In the meantime, you can use matrix semantics to add the constraints individually:
m, n, p = 3, 4, 5
x = model.addMVar((m,n), name='x')
y = model.addMVar((n,p), name='y')
model.addConstrs((x[i,:] @ y[:,j] <= 1 for i in range(m) for j in range(p)), name='matrixcon')0
Please sign in to leave a comment.
Comments
1 comment