Search code examples
optimizationmodelingampl

Numerical argument out of domain in AMPL


I am stuck into this error since weeks. I don't know what is wrong with this. Either AMPL or my model definitely has some bug in the declaration and definitions of the parameters.

I am using NEOS solver and it gives me error:


Error at _cmdno 23 executing "let" command (file amplin, line 85, offset 1582): can't evaluate pow(-82.15570137754236,-3.5): Numerical argument out of domain os-7.neos-server.org Error (2) in /opt/ampl/ampl -R amplin


line 85 is here in my data file as:

let rate[kl,is] := B*log(1+((Pmax/NPRBs[kl,is])*h[kl,is])/NoB);

The error occurs in a "let" command in line 85 of my input. The error is that something in the model is raising a negative number to a fractional negative power, which is an operation that does not have a valid result as a real number.

In the model I use: let h[kl,is]:=beta*(d[kl,is]^(-alpha));
(-alpha is also here that might raise the error)

Any way out?


Solution

  • I have fixed this error. I was using Normal() function from AMPL that was generating negative values due to which this error was coming.

    I used another AMPL function max(Normal(),1) to wrap the Normal() with argument 1. It means that when left side of the max() is having negative number. It will use the positive value which is 1 here. You can apply the value you want.