Skip to main content

How to linearize the nonlinear constraint in modelling

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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 why not try our AI Gurobot?.
  • Jaromił Najman
    • Gurobi Staff

    Hi,

    Could you please elaborate why you have to linearize the nonlinear terms on your own?

    Gurobi can solve non-convex quadratically constrained problem meaning that you can introduce the term \(z^2 = x^2 - y^2\) as a constraint via

    m.addConstr(z*z == x*x - y*y, name="myConstr")

    For terms such as \(\exp\) or \(\log\), you can use the general constraint methods.

    Best regards, 
    Jaromił

    0
  • Cass C
    • Gurobi-versary
    • Curious
    • Conversationalist

    Hi Jaromił

    Thanks for you replying. If I try NLP in my model, it will be tough to solve as there are a large amount of variables. So that is why I have to linearise it. I tried SOCP before and it was fast but the accuracy is not good, so I am going to use PWL.

    Many thanks!

     

     

    0

Post is closed for comments.