Skip to main content

constraints programming

Answered

Comments

2 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?.
  • Alison Cozad
    • Gurobi Staff

    You should be able to use the qp example on the Gurobi Example Tour to get you started on the model.  This will show you how to create a Gurobi model, add variables, add bounds to variables, add constraints, and set an objective. 

    Most of the modeling should be quite straightforward.  However, the nonlinear equality you described will need a bit of care when adding it to the model.  To add this, here are a few tips

    • Gurobi can solve with linear, bilinear, and quadratic terms.  However, the \( p_i\cdot R_i\cdot P_i\cdot M_i\) terms are trilinear.  To use these, I recommend following the recommendations in How do I model multilinear terms in Gurobi?
    • The \(x^{-0.682}\) term also does not fall under the functional forms that Gurobi can use as-is.  Instead, I recommend creating a piecewise linear approximation.  Luckily, Gurobi can do most of the work for you to create such an approximation.  To get started, please check out the documentation on piecewise linear objectives and constraints.  There are also two examples you can review on the Gurobi Example page: piecewise and gc_pwl.
    • Since this is a nonlinear equality constraint, it is also a nonconvex constraint.  Gurobi can certainly handle this type of constraint.  To pass the information along to Gurobi, set the Nonconvex parameter to 2. (e.g., \(\texttt{m.Params.Nonconvex=2}\)).
    0

Post is closed for comments.