Skip to main content

Gurobi: Highly non-linear objectives possible?

Answered

Comments

6 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff 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 Gurobi Staff

    Hi Quentin,

    There are two approaches which you can use in Gurobi to model your nonlinear function.

    You can model the polynomial term via piecewise-linear approximation using the addGenConstrPoly function or via a reformulation with auxiliary variables and equality constraints as explained in How do I model multilinear terms in Gurobi?

    The division terms can be modeled as explained in How do I divide by a variable in Gurobi?

    Best regards,
    Jaromił

    1
  • Quentin De Boever
    Gurobi-versary
    First Comment
    Curious

    Thank you for the helpful info Jaromil!

    0
  • Saeid Ghafouri
    Gurobi-versary
    Curious
    Conversationalist

    Hi Jaromil,


    Is there a way to have non-linear functions explained above in the objective function and not in the constraints?

    Best,

    Saeid

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Saeid,

    Say you have a non-linear objective f(x).  Introduce a variable z, and a constraint z = f(x), and set the objective to z.  Now you have a non-linear constraint and can proceed as above.

    - Riley

    1
  • Saeid Ghafouri
    Gurobi-versary
    Curious
    Conversationalist

    Hi Riley,

    Awesome! Thank you for your quick response.

    Best,

    Saeid

    0

Post is closed for comments.