Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortran iteration callback method #382

Closed
jacobwilliams opened this issue Jun 19, 2020 · 3 comments
Closed

Fortran iteration callback method #382

jacobwilliams opened this issue Jun 19, 2020 · 3 comments

Comments

@jacobwilliams
Copy link

jacobwilliams commented Jun 19, 2020

In the Fortran example, the ITER_CB() function can be called once per iteration. Is it possible to know what the x vector is in this routine for that iteration? It doesn't look like it. Can we assume that it will be the same x as was last called in EV_F(), or will that not always be the case?

@svigerske
Copy link
Member

I am not so sure that you can assume that.
The iteration callback is called for the current iterate, but the eval-function may have been called for some trial points that were eventually not accepted before.

Ipopt 3.14 provides functions to get the current iterate during the iteration callback: https://github.com/coin-or/Ipopt/blob/stable/3.14/src/Interfaces/IpStdFInterface.c#L530
The hs071_f example has been extended to show a way how to call this function. However, it is a bit hackish. Maybe a proficient Fortran programmer has an elegant solution: https://github.com/coin-or/Ipopt/blob/stable/3.14/examples/hs071_f/hs071_f.f.in#L157-L161

@jacobwilliams
Copy link
Author

Thanks! I will test it and can also suggest updates to this example. This F77 style has been obsolete for 30 years. Would there be any interest in a modern Fortran example?

@svigerske
Copy link
Member

I wouldn't mind to add one in modern Fortran in addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants