Skip to main content

Use Yalmip+Gurobi to solve an MINLP problem

Answered

Comments

6 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    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
  • Yuan Chang
    Gurobi-versary
    First Comment
    First Question

    Thanks for your answer!

    Do AMPL+Gurobi can solving these general nonlinear constraints?

    1
  • Robert Fourer
    Collaborator
    Gurobi-versary

    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
  • Yuan Chang
    Gurobi-versary
    First Comment
    First Question

    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
  • Eli Towle
    Gurobi Staff Gurobi Staff

    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
  • Yuan Chang
    Gurobi-versary
    First Comment
    First Question

    Thank you very much! I will try it as you said. Thanks a lot!

    0

Please sign in to leave a comment.