GUROBIO 11 - Support for Nonlinear Function


The new Gurobi solver (Gurobi 11) supports some nonlinear functions, such as the logarithmic or the logistic ones.
I would like to know whether this functionaliy is available through AMPL. and what AMPL keywords can be used to instruct Gurobi to consider (maximize) a logistic function for example. Can you tell me where I can find some documentation about this?
Best regards,

Gurobi 11 still has the default behavior of using piecewise-linear approximation for nonlinear functions, but you can set options to globally optimize instead. Here is a little example:

var x;
minimize f: 0.2*x^2 + 1/(1+exp(-x));
subj to bounds: -1 <= x <= 1;

This is the solution with no options set:

Gurobi 11.0.0: optimal solution; objective 0.4260218562
394 simplex iterations
35 branching nodes
f = 0.4262241326
x = -0.584057913

(Due to the p-l approximation, the objective value returned by Gurobi is a little different from the objective value computed by AMPL at the solution returned by Gurobi.)

To request global optimization, set the Gurobi option funcnonlinear to 1, by giving the command

option gurobi_options 'funcnonlinear=1';

before solving (or if you are already defining a gurobi_options string, by adding ‘funcnonlinear=1’ to it.) Then Gurobi gives the following results:

Gurobi 11.0.0: optimal solution; objective 0.4262087102
33 simplex iterations
18 branching nodes
absmipgap=6.49552e-06, relmipgap=1.52402e-05

f = 0.4262087102
x = -0.575911649

Note that AMPL does not have a built-in logistic function, so you need to give an expression like 1/(1+exp(-x)) for it.