Skip to content

Various improvements for highspy - #3257

Draft
mathgeekcoder wants to merge 2 commits into
latestfrom
highspy-updates
Draft

Various improvements for highspy#3257
mathgeekcoder wants to merge 2 commits into
latestfrom
highspy-updates

Conversation

@mathgeekcoder

Copy link
Copy Markdown
Collaborator

Description

Various improvements for highspy:

  • fixed HandleUserInterrupt setter and changed callback handler from list to set to avoid repeated calls to same code
  • fixed flaky highspy threading unit tests
  • cleaned up code per updated linter (Ruff) rules
  • added HighsError and HighsStatusError exceptions
  • added support for min/max with constant objective (e.g., h.minimize(4)). Very low priority; but shouldn't give an error

Checklist

  • I have read the contributing guidelines
  • This PR targets the latest branch
  • Tests are passing
  • Documentation was updated where relevant
  • This PR is not primarily AI-generated (per the AI contributions policy in CONTRIBUTING.md)

Related issue

Closes #3251 and #3228 (flaky tests discussion)

* fixed #3251 HandleUserInterrupt setter
* changed callback handler from `list` to `set` to avoid repeated calls to same code
* improved unit tests as per discussion in  #3228
* cleaned up code per updated linter (Ruff) rules
* added HighsError and HighsStatusError exceptions
* added support for min/max with constant objective (e.g., h.minimize(4)). Low priority, but shouldn't have been an error before.
@mathgeekcoder

Copy link
Copy Markdown
Collaborator Author

Note to self: when changing callbacks from list to set, the order of callbacks is no longer guaranteed to be in the subscribed order.

This assumption was exploited in the test_usercallbacks call, which is failing depending how the system / python version sorts the callback functions.

I don't think we should ever assume a guaranteed order, but I can also replace set with a unique list.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.26%. Comparing base (57016c1) to head (ec62b5b).
⚠️ Report is 3 commits behind head on latest.

Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #3257      +/-   ##
==========================================
- Coverage   73.27%   73.26%   -0.01%     
==========================================
  Files         445      445              
  Lines      108191   108185       -6     
  Branches    17344    17341       -3     
==========================================
- Hits        79274    79259      -15     
- Misses      28641    28650       +9     
  Partials      276      276              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant