norm function should take expressions
回答済みI 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
-
正式なコメント
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
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
投稿コメントは受け付けていません。
コメント
2件のコメント