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.


  1. Please help.

    I am trying to solve a problem as follows:

    tLsEq1(t).. tLs1(t) =e= (sum((p,w), f(p,t,w) * Vb(p,t,w) ) - sum((p,s,w), spotd(p,t,w)* Vs(p,s,t,w)));

    LEq(t)$(tLs1(t) > 0).. Ls(t) =e= (sum((p,w), f(p,t,w) * Vb(p,t,w) ) - sum((p,s,w), spotd(p,t,w)* Vs(p,s,t,w)));

    CVEq1.. Vv + (1/(1-alp))* sum(t,Ls(t) ) =L= tau;

    whenever I run I get:

    52 Endogenous $-control operations not allowed.

    But variable Ls(t) has to be positive (either 0 or the evaluated value).
    Also Vb(p,t,w) and Vs(p,s,t,w) are variables.

    How can I solve this problem. Please help

  2. Depending on the rest of the model (especially the objective) you may need to add binary variables for this. Basically you want to model:

    Ls(t) = 0 or f(t)
    Ls.lo(t) = 0

    For further technical support wrt GAMS please contact