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

Importing MemoizeJac from SciPy raises a deprecation warning. #160

Closed
moorepants opened this issue Dec 9, 2022 · 6 comments · Fixed by #183
Closed

Importing MemoizeJac from SciPy raises a deprecation warning. #160

moorepants opened this issue Dec 9, 2022 · 6 comments · Fixed by #183

Comments

@moorepants
Copy link
Collaborator

See #157, but that didn't seem to help. See this issue on SciPy: scipy/scipy#17572

@nrontsis
Copy link
Contributor

nrontsis commented Dec 9, 2022

What is the reason for using (the now seemingly private) MemoizeJac? Does caching function/Jacobian evaluations help noticeably in continuous optimisers like Ipopt? I would assume it has no effect?

@moorepants
Copy link
Collaborator Author

I don't know. I didn't write that code.

@moorepants
Copy link
Collaborator Author

My guess would be that has little to no effect because those functions would rarely be called with the same arguments.

nrontsis added a commit to nrontsis/cyipopt that referenced this issue Dec 9, 2022
@nrontsis
Copy link
Contributor

nrontsis commented Dec 9, 2022

Opened a PR to remove it: #161

@jhelgert
Copy link
Contributor

Does caching function/Jacobian evaluations help noticeably in continuous optimisers like Ipopt? I would assume it has no effect?

Depends on the optimization problem.

For instance, for an objective function that contains some expensive-to-evaluate expression tmp which depends on the optimization variables and arises in the gradient as well, you can avoid duplicated computations of tmp by evaluating the objective and the gradient with a single function call and using the jac=True option. Here, the effect would be huge because you save one expensive calculation per iteration. An illustrative example of tmp might be an inverse matrix that depends on the optimization variable.

IIRC, the main intention for adding this feature to cyipopt's scipy interface was because it's in scipy.optimize.minimize too.

@moorepants
Copy link
Collaborator Author

Yes, I think we should leave it in. After watching the discussion over at SciPy I think we will just have to import from scipy.optimize._optimize and risk breaking changes or we can copy MemoizeJac into this library (and the license of SciPy).

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

Successfully merging a pull request may close this issue.

3 participants