If the "can't evaluate" error message is occurring while IPOPT is running, then IPOPT must be generating an iterate in which the variable a is outside its bounds -- in fact very slightly less than zero. This is an algorithmic issue so you will have to raise it with the developers of IPOPT -- see
https://projects.coin-or.org/Ipopt.
You could also try a larger initial value than 0.0001 for a, to see if that makes a difference to IPOPT's iteration path. Consider setting the initial value to a guess of the optimal value. There is no guarantee that this will make a difference, however -- you may get the same error.
There is no rule as to whether you should reformulate by taking the logarithm. The best thing to do is to try solving with different formulations and to use the one that works best for your particular combination of problem and solver.
Bob Fourer
4...@ampl.com
-----Original Message-----
From:
am...@googlegroups.com [mailto:
am...@googlegroups.com]
On Behalf Of Cavern Chang
Sent: Thursday, June 07, 2012 9:44 AM
To: AMPL Modeling Language
Subject: [AMPL 5879] Re: Problem about "log(0)"
Thank you very much! The "log(0)" problem has been settled.
However, now a new problem comes out that when I set "var a >=0.00000001 default 0.0001" and solve the model by IPOPT under AMPL, it would return the error information "can't evaluate log(-3.05e-10)" in equations including the "log(a)" term. So why would this phenomenon happen? It seems that the lower bound doesn't take effect. How can I avoid this error?
Besides, if there are some terms like exp(a) or a^b (a,b are variables) in equations, do we always need to change them to the logarithm form (e.g. a^b becomes b*log(a) )? Does this reformulation do make the solving process more efficient?