Skip to content

Fix: mosek_direct updated to use putqconk instead of putqcon #3199

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

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

Utkarsh-Detha
Copy link
Contributor

Fixes

This fix concerns QCQP models when solved using mosek. In MOSEK's Optimizer API, the putqcon method resets the Q matrix entries for all constraints to zero, while putqconk does so only for k-th constraint. The _add_constraints method in mosek_direct would call putqcon, but this would lead to loss of Q info with every subsequent call to the _add_constraints (if new Q info was given). This is now fixed, because the Q matrix in each constraint is updated in its own call to putqconk.

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.

This fix concerns QCQP models when solved using mosek. In MOSEK's
Optimizer API, the putqcon method resets the Q matrix entries for
all constraints to zero, while putqconk does so only for k-th
constraint. The _add_constraints method in mosek_direct would
call putqcon, but this would lead to loss of Q info with every
subsequent call to the _add_constraints (if new Q info was given).
This is now fixed, because the Q matrix in each constraint is
updated in its own call to putqconk.
@Utkarsh-Detha
Copy link
Contributor Author

Could someone help me figure out how to get this merged? Maybe @jsiirola? Thank you.

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.39%. Comparing base (c849905) to head (9376b6b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3199      +/-   ##
==========================================
- Coverage   88.40%   88.39%   -0.01%     
==========================================
  Files         846      846              
  Lines       95156    95153       -3     
==========================================
- Hits        84118    84107      -11     
- Misses      11038    11046       +8     
Flag Coverage Δ
linux 86.33% <0.00%> (+<0.01%) ⬆️
osx 76.17% <0.00%> (+<0.01%) ⬆️
other 86.53% <0.00%> (-0.01%) ⬇️
win 83.82% <0.00%> (-0.01%) ⬇️

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.

@mrmundt
Copy link
Contributor

mrmundt commented Mar 19, 2024

@Utkarsh-Detha - This looks fine to me. Our guidelines say that we need two approvals, and most of the Pyomo team is unfortunately on travel this week, so I think the earliest I can get someone else to look over it is Thursday. Apologies for the delay!

@jsiirola
Copy link
Member

This looks fine - One question: is there a significant performance difference between putqcon and putqconk? If so, is it worth tracking if this is the first time add_constraints() was called for a model (allowing the interface to use putqcon the first time and putqconk for all subsequent calls)?

@Utkarsh-Detha
Copy link
Contributor Author

Good question/suggestion, @jsiirola! My expectation was that for large problems putqcon should be faster than using a for-loop with putqconk. However, surprisingly enough, passing an n-by-n (dense) Q matrix in each constraint in an n-constraint problem is faster when using a for-loop with putqconk!

We are looking at as to why this is the case in Optimizer API. In the meantime, as far as mosek_direct is concerned, I think the incoming changes already implement the fastest way to do things!

@mrmundt mrmundt merged commit 39e8a72 into Pyomo:main Mar 25, 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.

4 participants