Skip to content

Sending piecewise-linear approximations to Gurobi's local nonlinear solver #278

@4er4er4er

Description

@4er4er4er

Gurobi's new local nonlinear solver behaves in an interesting way when it sees certain native AMPL functions. For example:

ampl: var x >= -3, <= 3;
ampl: minimize obj: sinh(x);
ampl: option solver gurobi;
ampl: option gurobi_options 'alg:optimalitytarget=1';

ampl: solve;
Gurobi 13.0.0:   alg:optimalitytarget = 1

------------ WARNINGS ------------
WARNING:  "PLApprox_Sinh"
  An expression of type 'Sinh' has been
piecewise-linearly approximated. Set cvt:plapprox:reltol
to control precision (currently 0.010000).
------------ WARNINGS ------------
WARNING:  "PLApprox_Sinh"
  An expression of type 'Sinh' has been
piecewise-linearly approximated. Set cvt:plapprox:reltol
to control precision (currently 0.010000).

Gurobi 13.0.0: Call failed: 'GRBoptimize(model())' with code 10016,
Gurobi message: PWL functions cannot be handled in local optimization

Apparently, Gurobi's local nonlinear solver can only handle functions that are smooth and that Gurobi knows about. But AMPL has some smooth built-in functions that aren't known to Gurobi. When one of those functions is used in a model and sent to the local solver, MP creates a piecewise-linear approximation, and then Gurobi rejects the approximation because it isn't smooth.

If MP could recognize this case, it could avoid having to go through the piecewise-linearization for no benefit.

But maybe the current MP implementation of this case is more robust. It will continue working properly if in some future Gurobi version the local solver is extended to handle some kinds of piecewise-linear functions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions