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

Modelling squared euclidean distance in objective function (C-API)

回答済み

コメント

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 Christian,

    I'm guessing you have a typo and your objective is meant to be \(\min \quad (x-1)^2 + (y-1)^2 \)

    You can add a constant to the objective like so:

    error = GRBsetdblattr(model, "ObjCon", 2.0);

    This is also a valid alternative:

    \[\begin{align*} \min \quad w^2 + z^2 \\ w = x-1 \\ z = y-1 \end{align*}\]

    - Riley

    0

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