Gurobi: Highly non-linear objectives possible?
AnsweredHi there,
I was wondering if there is a way or workaround to include non-linear objectives? I have tried to put the non-linear portion as a constraint, but that does not seem to work.
I'm not sure if Gurobi can handle something like this. My program is effectively a MINLP problem. All of my constraints are linear, some equality and some inequality.
Below is a simpler example of what I am trying to implement, where g(x(n)) is the nonlinear function which is part of the objective function C:
Thanks in advance!
-
Official comment
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?. -
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 -
Thank you for the helpful info Jaromil!
0 -
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 -
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 -
Hi Riley,
Awesome! Thank you for your quick response.Best,
Saeid
0
Post is closed for comments.
Comments
6 comments