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

Retrieving last parameter value from Python after roundoff limit #513

Open
wbthomason opened this issue Jun 1, 2023 · 1 comment
Open

Comments

@wbthomason
Copy link

Currently, it seems that the Python API does not expose the last value of the optimization parameters when exiting early due to an exception. This is in contrast to the C API (I think - haven't actually experimented with it yet), as the C API takes the optimization parameters as double* (directly modifying the input), but the low-level Python API assumes it's given a const double* (modifying a copy of the input).

Accessing the last value of the parameters would mostly be useful for failure due to roundoff - as the docs mention, their value is often still useful in this case.

Is there some way I'm missing, other than using a closure and copying every value of the optimization parameters in the objective function, to handle this problem in Python? If not, and if you're interested, I'd be happy to PR a patch to copy the last value over to the input parameters on roundoff exit, or to expose a method to access the last parameter value.

Thanks!

@jschueller
Copy link
Collaborator

sure, patches are always welcome

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