Skip to main content

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

Answered

Comments

1 comment

  • Riley Clement
    Gurobi Staff 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

Please sign in to leave a comment.