ASL: evaluation error cannot be caught


I’m developing a nonlinear optimization solver that loads NL files using the AMPL Solver Library. While solving the CUTEst instance dallasl.mod, I ran into the following issue: the variable x18 lies in [-150, 150] and occurs in the objective as abs(x18)^0.85. It is therefore allowed to take the value 0, which results in an evaluation error. Although evaluation errors can usually be caught by checking the ASL flag nerror, here ASL crashes with the error
Error evaluating "var =" definition -1: can't evaluate pow'(0,0.85)
in the objective gradient. That is, the ASL function does not even return with a positive nerror. It looks like an ASL bug, can you reproduce the error?
Thank you,


I was able to reproduce the can't evaluate pow'(0,0.85) part of the error message, for example with the MINOS solver:

MINOS 5.51: Error evaluating objective obj gradient: can't evaluate pow'(0,0.85).
MINOS 5.51: solution aborted.

This is at least a reasonable message, since the derivative of abs(x18)^0.85 is infinite at zero.

However the reference to "var =" definition -1 is surprising, since there aren’t any "var =" definitions – also called defined variables – in this model (and I wouldn’t expect them to be enumerated with negative numbers). This part of the error message is typically solver-specific, however, so I would suggest to first determine why your solver interface produces it, and how it should be fixed. Maybe in fixing it, the cause of the problem with the nerror flag will become apparent, but if not then some other tests can be suggested.

Thank you for the insight Robert, I’ll try to figure out where this defined variable comes from. As a workaround for the moment, I set err_jmp1 to catch the evaluation error.