I want to be able to do an element-wise multiplication in the constraint (bolded) for a quadratic program as follows:
The (y*y) is throwing an error. How do I get that element-wise multiplication to work?
import gurobipy as gp
m = gp.model("model")
x = m.addMVar(shape=(10), name="x")
y = m.addMVar(shape=(5), name="y")
A = np.random.rand(5, 10)
m.addConstr(A @ x - (y*y) <= A[:,0], name="const")
m.setObjective(x.sum() - (y*y).sum()), GRB.MAXIMIZE)
Please sign in to leave a comment.