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

Add call_before_subproblem_solve callback in MindtPy #3251

Merged
merged 5 commits into from
May 8, 2024

Conversation

ZedongPeng
Copy link
Contributor

Summary/Motivation:

This Pull Request introduces the call_before_subproblem_solve callback in MindtPy, enabling customized warm-starts for solving NLP subproblems. This feature has been thoroughly tested by @jialuw96 and @adowling2.

Changes proposed in this PR:

  • call_before_subproblem_solve callback in MindtPy

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@adowling2
Copy link
Member

I confirm I was able to run this code 2 weeks ago to reproduce paper results.

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.45%. Comparing base (6393961) to head (e4920cb).
Report is 126 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3251      +/-   ##
==========================================
- Coverage   88.45%   88.45%   -0.01%     
==========================================
  Files         849      852       +3     
  Lines       95329    98139    +2810     
==========================================
+ Hits        84327    86808    +2481     
- Misses      11002    11331     +329     
Flag Coverage Δ
linux 86.44% <100.00%> (+0.03%) ⬆️
osx 75.65% <10.00%> (-0.61%) ⬇️
other 86.63% <100.00%> (+0.02%) ⬆️
win 83.95% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@emma58 emma58 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused that the docstrings say 'after' when I think the callback is 'before', but otherwise this looks fine.

pyomo/contrib/mindtpy/config_options.py Outdated Show resolved Hide resolved
pyomo/contrib/mindtpy/algorithm_base_class.py Outdated Show resolved Hide resolved
@ZedongPeng
Copy link
Contributor Author

Thank you @emma58 . I just corrected 'after' to 'before'.

Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, although it could be improved by adding a test that exercises the "new" option (adding the test will help ensure that we don't accidentally break the functionality in the future).

@ZedongPeng
Copy link
Contributor Author

ZedongPeng commented May 7, 2024

The callback test has been added.
The callback test is designed to make the algorithm cycle and terminate without finding the optimal solution, which is different from the case when the callback function is not invoked.

@blnicho blnicho merged commit ca3c34f into Pyomo:main May 8, 2024
33 checks passed
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 this pull request may close these issues.

6 participants