Skip to content

BUGFIX: Add logic for highspy versions#3509

Merged
michaelbynum merged 3 commits intoPyomo:mainfrom
mrmundt:highspy-patch
Mar 7, 2025
Merged

BUGFIX: Add logic for highspy versions#3509
michaelbynum merged 3 commits intoPyomo:mainfrom
mrmundt:highspy-patch

Conversation

@mrmundt
Copy link
Copy Markdown
Contributor

@mrmundt mrmundt commented Mar 7, 2025

Fixes #3489

Summary/Motivation:

There is a new feature in highspy that allows keyboard interruption. It's not available in old versions. This PR checks the version to make sure it meets the minimum requirement.

Changes proposed in this PR:

  • Ensure that version is at least 1.8 before setting keyboard interrupt

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.

@mrmundt mrmundt requested a review from michaelbynum March 7, 2025 18:42
@michaelbynum michaelbynum merged commit db80ff9 into Pyomo:main Mar 7, 2025
62 of 63 checks passed
@mrmundt mrmundt deleted the highspy-patch branch March 7, 2025 23:12
Comment on lines +276 to +277
if self.version()[0] >= 1 and self.version()[1] >= 8:
self._solver_model.HandleKeyboardInterrupt = True
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FWIW, there is a bug in this logic, as version 2.0 will not HandleKeyboardInterrupt. An improved implementation would be:

if self.version()[:2] >= (1, 8):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch @jsiirola.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

creating a new PR now

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.

highspy >=1.8.0 required but this is not checked

3 participants