Thursday, February 5, 2009

floor in MINLP model

> My MINLP model (in AMPL) does not solve: 
> the relaxed NLP is declared infeasible.
> The model contains the floor() function.

Unless you are using a global solver, MINLP solvers assume the relaxations (NLPs formed by fixing or relaxing the integer variables) are smooth. The floor function is discontinuous, so it is dangerous to use. There is a simple reformulation however, which moves the complexity from the NLP to the MIP part:

var x;
var flx integer;

flx ≤ x ≤ flx + 1

To get slightly more predictable behavior when x is (close to) integer, use:

flx ≤ x ≤ flx + 0.9999

In AMPL you may want to rewrite this as:

0 ≤ x − flx ≤ 0.9999

as this can be written as a single constraint. 

This formulation adds an integer variable, but has substantially simplified the NLP: it just adds a linear inequality and removes a discontinuous function.