[Couenne] Unknown operator error

Pietro Belotti pbelott at clemson.edu
Thu Sep 8 09:32:49 EDT 2011


> Indeed, I use a *lot* of if-then-else to prevent singularities (like
> division by zero).
> I've just tried to replace if-then-else operators in some way.
> In most cases, I have replaced them with a binary variable.
> For instance, the constraint:
>  sum{j in J} (if y[i,j] then ur[j]*Cr/(C[i]*(s[i,j]+eps)) else 0) <= 1;
> has become:
>  sum{j in J} y[i,j]*ur[j]*Cr/(C[i]*(s[i,j]+eps)) <= 1;
> where y is a binary variable, s is a positive variable, eps is a
> parameter set to 1e-5 and the others are all parameters.

This seems to me the correct way to do that. You might as well consider

ur[j]*Cr/(C[i]*(s[i,j]+eps)) <= 1 + M * (1-y[i,j]);

with M large enough.

> I have some trouble in replacing if-then-else in the objective function:
>  minimize cost: ... + sum{i in I} c2[i]*(sum{j in J} (if y[i,j] then
> ur[j]*Cr/(C[i]*s[i,j]) else 0))^r[i]
> where all are parameters, but y  and s that are variables (as above).
> Actually I replaced it with:
>  minimize cost: ... + c2[i]*(sum{j in J}
> (y[i,j]+eps)*ur[j]*Cr/(C[i]*(s[i,j]+eps)))^r[i])
> that is I have exploited the binary variable y and the use of the
> correction factor eps.
> The idea here is to use:
> * eps to prevent a division-by-zero
> * (y[i,j]*eps) both to prevent a pow(0,r[i]) (which does not like to
> Couenne/AMPL since 0 < r[i] < 1) and to assign a nearly zero cost when
> y[i,j] = 0.

If r[i]>0, Couenne should be fine with it, though numerical problems may 
arise for r[i] very small.

> I'm not completely satisfied with this trick since it produces
> inaccurate results.
>
> Can someone suggest a better workaround?

You could create a new nonnegative variable z[i,j] that replaces

(if y[i,j] then ur[j]*Cr/(C[i]*s[i,j]) else 0))

in the objective function, (i.e. put c2[i]*z[i,j]^r[i,j] in the 
objective) and then add a constraint for each i,j as 
follows:

z[i,j] >= ur[j]*Cr/(C[i]*s[i,j]) - M * (1-y[i,j]);

again with M large.

Hope this helps.

Pietro



More information about the Couenne mailing list