[AMPL 24730] final objective value in knitro least squares

Hi all,
I am solving a least squared problem using Knitro’s leastsquares=1 and an objective that is 0.
The statistics of the solver show a final objective value of a small but positive number (~1e-7).
How can I display or print that number? I’ve tried obj and obj.val but it gives always prints 0.

When you display the objective value, AMPL computes it from the current values of the variables. So you should first check whether the objective really is 0, when computed from the values of the variables that Knitro returned. Use the special setting “option display_precision 0;” to request full display precision, and then use the display statement to look at the values of the variables, parameters, and terms in your objective expression. As a simple example, if your objective is sum {j in S} (x[j] - a[j])^2, you could try

option display_precision 0;
display x;
display a;
display {j in S} x[j] - a[j];

After trying this, if you need more help, provide a model and sample data if possible.