Skip to main content

Quadratic equality constraints Python

Answered

Comments

3 comments

  • Riley Clement
    • Gurobi Staff

    Hi Nan,

    This may be a bug in the display function.  If the equality really was being converted to an inequality then constraints of the form

    sum([x[j] * y[j] for j in range(NR_VS)]) == -1

    would be considered feasible, since the corresponding inequality could be satisfied by setting all variables to zero, but if you try and solve this it will be reported as infeasible.

    I will check with our developers and confirm this for you.

    - Riley

    0
  • Marika Karbstein
    • Gurobi Staff

    If you want to check your model, we recommend using Model.write(), for example model.write("model.lp"). You can then display the lp file for example with print(open("model.lp", "r").read()).

    Note that display() is not a Gurobi Python API function and may not work as expected.

    0
  • Nan D
    • Gurobi-versary
    • Conversationalist
    • Curious

    Thank you, Marika and Riley. I now use model.write() and indeed, the constraint that I see is:

    - x[0] + [ x[0] * x[0] + x[1] * x[1]] = 0

     

    0

Please sign in to leave a comment.