Why does Gurobi struggle with a simple nonlinear constraint y^3?
AnsweredI’m trying to solve a simple optimization problem using Gurobi, but I’m running into issues when including a cubic nonlinear constraint.
Problem formulation:
Minimize:
f(x, y) = x + 2y
Subject to:
-1 ≤ y³ ≤ 1
0.3 ≤ x ≤ 1
Issue:
Gurobi does not allow me to directly include constraints like:
y³ ≥ -1 or y³ ≤ 1
It seems nonlinear constraints must be written in a specific form, and general inequality constraints involving nonlinear expressions are not accepted.
Questions:
- Why does Gurobi not support nonlinear inequality constraints like y³ ≤ 1 directly?
- How should constraints involving simple nonlinear functions like y³ typically be handled in Gurobi?
- More generally, how does Gurobi handle nonlinear (especially nonconvex) functions?
Any clarification or guidance would be appreciated.
-
Hi Perapat,
Although Gurobi has supported nonlinear constraints for a few years now, the new interface, which allows us to write expressions like this:
model.addGenConstrNL(y2, nlfunc.sin(2.5 * x1) + x2,was only introduced recently in v13.
We are continuing to work on it and forming constraints such as y³ ≤ 1 directly will be likely possible in a future release.
To learn more about the interface, and how nonlinear functions are handled, please refer to the following resources
* Genconstrnl Examples
* What's New in Version 13 - Nonlinear
* Nonlinear solution strategies (reference manual)
* Tech Talk - A Practical Tour Through Non-convex Optimization (spatial branching 18m25s)- Riley
0
Please sign in to leave a comment.
Comments
1 comment