[Couenne] Unknown operator error

sguazt marco.guazzone at gmail.com
Thu Sep 8 10:14:55 EDT 2011


On Thu, Sep 8, 2011 at 3:32 PM, Pietro Belotti <pbelott at clemson.edu> wrote:
>
>> 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]);
>

Interesting, I will try with it!


> 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.

Hmmm I'm not sure with it.
If I replace
  sum{j in J} (y[i,j]+eps)*ur[i]*...)^r[i]
with
  sum{j in J} y[i,j]*ur[i]*...)^r[i]

I get several warnings suggesting to enable the "halt_on_ampl_error"
option to see more details (nevertheless the optimal solution is
reached).
If I enable that option, couenne stops with the following error (in
this case r[i] == 0.355):

couenne: halt_on_ampl_error=yes

ANALYSIS TEST: NLP0012I
              Num      Status      Obj             It       time
          Location
NLP0014I             1         OPT 0.917700545.5g      785 2.121677g
Error evaluating objective function: can't evaluate pow'(0,0.355).
exit code 1
<BREAK>



>
>> 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.
>
Very helpful suggestiions!

Thank you very much,

-- Marco

> Pietro
>
>




More information about the Couenne mailing list