pyoptsparse icon indicating copy to clipboard operation
pyoptsparse copied to clipboard

IPOPT: getting major iterations info

Open kanekosh opened this issue 5 years ago • 9 comments

Description of feature

Add a capability to the IPOPT wrapper so that it gets the major iterations info, including objective, (primal) infeasibility, optimality (which appears as dual infeasibility).

Potential solution

I will try to do this.

kanekosh avatar Oct 26 '20 23:10 kanekosh

This bug is reported as #182 .

Also, there seems to be a bug in the current history recorder. Objective and constraint calls seem to be recorded duplicately when they're called at the same x. As a result, the optimization history plot has more number of iterations in abscissa than the actual number of iteraions.

kanekosh avatar Oct 26 '20 23:10 kanekosh

I don't follow what you mean here, can you elaborate? An example might be helpful too.

ewu63 avatar Oct 27 '20 00:10 ewu63

When the optimizer evaluates the objective and constraint at a point x, it should be recorded as a single iteration. But it seems that it's recorded as two iterations with the same variable/function values. In the end, for example, IPOPT.out says it finished after 100 objective evaluations and 100 constraint evaluations, whereas I see 200 iterations in the OptView plot.

kanekosh avatar Oct 27 '20 00:10 kanekosh

Okay I see what you mean now, and I can confirm that I can reproduce the issue. Would you mind opening a bug report on this? The history file for IPOPT seems a bit messed up, for example isMajor is always set to False somehow, and I'd like to get that sorted. Would you be willing to look into this issue? If not I'd be happy to try and fix this.

ewu63 avatar Oct 27 '20 00:10 ewu63

Sure, I will open another issue and try to fix it (most likely will ask you questions on the way!)

kanekosh avatar Oct 27 '20 01:10 kanekosh

To add to this, this information is provided by IPOPT via intermediate_callback, which already has a wrapper within pyOptSparse.

ewu63 avatar May 23 '21 14:05 ewu63

@kanekosh did you end up looking into how to extract info from IPOPT? we might get more people involved this time

marcomangano avatar Aug 30 '21 15:08 marcomangano

I didn't have time to work on this. And I'm a bit ashamed but I don't remember what exactly I meant by "major iterations" for IPOPT. I suppose line search calls vs calls that determine search direction. As far as I understand, IPOPT calls f, c, df/dx, dc/dx in the latter, but it only calls function evaluations (no gradients) in line search. Therefore we could use this fact to detect in the hist file whether each call is of line search or not.

kanekosh avatar Aug 30 '21 20:08 kanekosh

I was thinking to use intermediate_callback to extract iter, in the same way we extract major iteration number in SNSTOP for SNOPT.

ewu63 avatar Aug 30 '21 21:08 ewu63