Use Yalmip+Gurobi to solve an MINLP problem
AnsweredHello!
I am a beginner in using Gurobi, and I would like to seek your assistance with the following questions, if possible.
In my MINLP problem, there are nonlinear constraints involving terms such as the product of three variables and trigonometric functions. I learned in the Document that I shoud use genconsin, genconpoly, etc.
Could you please guide me on how to utilize Gurobi+yalmip in MATLAB to invoke functions like genconsin and genconpoly?
Thank you very much for your kind attention and support.
-
The current version of YALMIP does not support solving general nonlinear models with Gurobi. If you are interested in using Gurobi's general constraints through MATLAB, you can use Gurobi's native MATLAB interface.
0 -
Thanks for your answer!
Do AMPL+Gurobi can solving these general nonlinear constraints?
1 -
You can write a formulation such as the following in AMPL, and it will be accepted by the AMPL-Gurobi interface:
subj to cons1 {i in 2..N+1}:
x1[i] - x1[i-1] - x2[i-1] * x3[i-1] * cos(x4[i-1]) >= -Mx * (1-a1);
subj to cons2 {i in 2..N+1}:
x1[i] - x1[i-1] - x2[i-1] * x3[i-1] * cos(x4[i-1]) <= -mx * (1-a1);By default, the cos(x4[i-1]) terms will be handled by piecewise-linear approximation in Gurobi. If you want to try Gurobi 11's features for global optimization, write to discuss.ampl.com for information on the options to specify.
0 -
Thank you very much! I still have two question:
Q1: The version of my Gurobi is 10.0.3. In this version, is the general nonlinearities accepted in AMPL+Gurobi?
Q2: I have applied for 1 year of Gurobi usage permission. If I should update my Gurobi to 11.0.0, how to do it?
Thank you very much for your kind attention and support.
0 -
1. Gurobi 10.0.3 constructs piecewise-linear approximations of the nonlinear \(cos\) functions. By default, Gurobi 11 does the same. However, you can ask Gurobi 11 to model these nonlinear functions directly (thereby solving a non-convex problem) by setting Gurobi's FuncNonlinear parameter to 1. In AMPL:
option gurobi_options 'funcnonlinear=1';
2. If you are using Gurobi through AMPL, Gurobi 11 is included in the latest version of the AMPL & Solvers bundle, available for download in the AMPL Portal.
0 -
Thank you very much! I will try it as you said. Thanks a lot!
0
Please sign in to leave a comment.
Comments
6 comments