Skip to content

Conversation

@ZedongPeng
Copy link
Contributor

Summary/Motivation:

Primal integral, dual integral and primal-dual gap integral are performance measures that reward a balance of speed and solution quality for global and local solvers. This PR adds the calculation of primal integral, dual integral and primal-dual gap in MindtPy.

Changes proposed in this PR:

  • solve_data.LB, solve_data.UB, solve_data.LB_progress and solve_data.UB_progress are all replaced by solve_data.primal_bound, solve_data.dual_bound, solve_data.primal_bound_progress and solve_data.dual_bound_progress. The log has also been modified.

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.

Copy link
Contributor

@bernalde bernalde left a comment

Choose a reason for hiding this comment

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

Hi Zedong, great first pass. We need to add also tests for the new functionality. Consider a list of primal and dual bound progress and compute the value of the integral as a test.
This could also be the change to add more unit tests to other pieces of MindtPy, especially cut_generation
Great work as always

# TODO determine solve_data.LB, solve_data.UB is inf or -inf.
'Final bound values: Primal Bound: {} Dual Bound: {}'.
format(solve_data.primal_bound, solve_data.dual_bound))
# TODO determine solve_data.primal_bound, solve_data.dual_bound is inf or -inf.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO still active or can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. Is there a case where cycling happens and no feasible solution has been found?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, cycling requires you to go back to the previously found solution.

else:
solve_data.UB_progress.append(solve_data.UB)
# TODO: can we remove the following line?
# solve_data.dual_bound_progress.append(solve_data.dual_bound)
Copy link
Contributor

Choose a reason for hiding this comment

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

At the end is the dual_bound_progress complete? If so, we can remove it.

@codecov
Copy link

codecov bot commented Feb 14, 2022

Codecov Report

Merging #2285 (391fcb9) into main (ea1f36f) will decrease coverage by 0.05%.
The diff coverage is 96.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2285      +/-   ##
==========================================
- Coverage   85.29%   85.24%   -0.06%     
==========================================
  Files         611      617       +6     
  Lines       76025    77932    +1907     
==========================================
+ Hits        64849    66431    +1582     
- Misses      11176    11501     +325     
Flag Coverage Δ
linux 82.76% <95.53%> (+0.05%) ⬆️
osx 72.97% <4.46%> (+0.07%) ⬆️
other 82.71% <95.53%> (+0.05%) ⬆️
win 79.85% <95.53%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
pyomo/contrib/mindtpy/feasibility_pump.py 80.64% <ø> (ø)
pyomo/contrib/mindtpy/initialization.py 79.50% <ø> (ø)
pyomo/contrib/mindtpy/mip_solve.py 84.76% <ø> (+0.25%) ⬆️
pyomo/contrib/mindtpy/nlp_solve.py 86.98% <66.66%> (+1.01%) ⬆️
pyomo/contrib/mindtpy/iterate.py 83.56% <81.81%> (+5.83%) ⬆️
pyomo/contrib/mindtpy/single_tree.py 50.15% <93.33%> (+0.31%) ⬆️
pyomo/contrib/mindtpy/MindtPy.py 100.00% <100.00%> (ø)
pyomo/contrib/mindtpy/config_options.py 93.42% <100.00%> (+8.65%) ⬆️
pyomo/contrib/mindtpy/util.py 91.72% <100.00%> (+0.84%) ⬆️
...o/contrib/interior_point/linalg/mumps_interface.py 43.95% <0.00%> (-31.05%) ⬇️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea1f36f...391fcb9. Read the comment docs.

@blnicho blnicho requested a review from michaelbynum February 15, 2022 19:33
Copy link
Contributor

@bernalde bernalde left a comment

Choose a reason for hiding this comment

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

I left behind some comments and we are still missing a little more tests. I'm reviewing this almost real-time but no pressure!

Copy link
Contributor

@bernalde bernalde left a comment

Choose a reason for hiding this comment

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

Great PR Zedong, thank you for addressing all of my comments. This is ready for review @michaelbynum @jsiirola

@ZedongPeng
Copy link
Contributor Author

I think the code coverage has been improved. Can we call CodeCov to generate the coverage report again?

@jsiirola
Copy link
Member

@ZedongPeng, it looks like the coverage of MindtPy has improved, and should not hold up this PR. Reporting is a bit problematic at the moment (the Jenkins builds are currently not running correctly - and are not reporting coverage results, so everything is looking worse than it should in practice).

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.

A couple questions, but nothing to prevent merging (given that the tests are passing). Updated coverage information should be available in ~60 minutes.

from pyomo.contrib.mcpp import pyomo_mcpp

required_solvers = ('baron', 'cplex_persistent')
required_solvers = ('ipopt', 'cplex_persistent')
Copy link
Member

Choose a reason for hiding this comment

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

Do you not need a global solver for these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the Pyomo servers don't have baron installed, so these tests are skipped previously, lowering the code coverage. For these selected models, ipopt is enough to find a global optimal solution.

Copy link
Member

Choose a reason for hiding this comment

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

Baron is present on all testing platforms. On GHA it runs in demo mode (because that is a public testing platform). A licensed version of Baron is available through the Jenkins tests (although Jenkins was down for a couple days, it should be back up now).

Copy link
Contributor

Choose a reason for hiding this comment

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

Although IPOPT is able to converge in the current version to the optimal solution, I think that this is a fragile test as we have no guarantees that with any newer version of the solvers it will keep working. I would be for reverting this back to baron

Copy link
Member

Choose a reason for hiding this comment

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

OK. @ZedongPeng, if you get the global tests updated this afternoon, we should be able to get this merged in tonight in time for tomorrow's release.

Copy link
Contributor

Choose a reason for hiding this comment

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

All the problems that we are testing are small enough for the demo license of BARON to work with the NLPs. Let's revent this back to baron but not skip if the license is valid (as the demo version should work)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just updated the global test. Hope it's not too late.

Copy link
Contributor Author

@ZedongPeng ZedongPeng Feb 22, 2022

Choose a reason for hiding this comment

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

BARON demo mode handles up to 10 constraints and variables and up to 50 nonlinear operations.

I just added the baron license check, since several models exceed this limitation. @bernalde

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.

5 participants