@ 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
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
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
Post is closed for comments.
Comments
2 comments