norm function should take expressions
AnsweredI want to be able to code like this:
m.setObjective(gp.norm(x-y, 2), minimize);
where x is a variable (or list of variables or MVar) and y is a numpy array.
0
-
Hi Brannon,
It is possible to model what you are after, just with extra steps, eg
x = m.addMVar((5))
z = m.addMVar((5))
m.addConstr(z == x - np.array([1,4,3,0,-2]))
w = m.addVar()
m.addConstr(w == gp.norm(z,2))
m.setObjective(w)I can pass your request onto our developers. I suspect it is a case of syntactic sugar, and ultimately these auxiliary variables (such as z and w) have to be added either explicitly, like above, or implicitly under the hood.
- Riley
0
Please sign in to leave a comment.
Comments
1 comment