メインコンテンツへスキップ

norm function should take expressions

回答済み

コメント

2件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    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.
  • Riley Clement
    • Gurobi Staff

    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

投稿コメントは受け付けていません。