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

Fix wrong numbers for Event Types #759

Merged
merged 14 commits into from
Dec 4, 2023
Merged

Conversation

Joao-Dionisio
Copy link
Collaborator

@Joao-Dionisio Joao-Dionisio commented Nov 28, 2023

An important issue came to our attention. PySCIPOPt has been using very outdated identifiers for event types. This draft PR is an attempt to correct this.

I think we should do the same for all other types, not relying on the use of magic numbers.

The way I'm doing this is probably not the best, as defining a new SCIP_EVENTTYPE inside PySCIPOPt is quite convenient.

Also, almost none of these events are tested. This code passes the tests we have, but I can't guarantee that it's correct.

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (19763ba) 62.12% compared to head (2a694a9) 61.52%.

❗ Current head 2a694a9 differs from pull request most recent head c0ec88d. Consider uploading reports for the commit c0ec88d to get more accurate results

Files Patch % Lines
src/pyscipopt/scip.pxi 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #759      +/-   ##
==========================================
- Coverage   62.12%   61.52%   -0.60%     
==========================================
  Files          16       16              
  Lines        3168     3236      +68     
==========================================
+ Hits         1968     1991      +23     
- Misses       1200     1245      +45     

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

@mattmilten
Copy link
Collaborator

mattmilten commented Nov 28, 2023

Oh nice! Yes, this is much better and way less error-prone.
I don't recall why we didn't do it like that in the beginning. Having to keep the numbers in sync is not good.

@Joao-Dionisio
Copy link
Collaborator Author

Thank you, Mathias!

I think this should be working, @mmghannam, but I'm a bit wary of pushing this without doing proper tests on all these things. On the other hand, I suppose that it's difficult that this breaks even more stuff...

There's also the matter of having a double declaration of SCIP_BOUNDTYPE in line 44 and 441, but that was there in the previous versions as well, but hidden.

@Joao-Dionisio Joao-Dionisio marked this pull request as ready for review November 28, 2023 23:40
@mmghannam
Copy link
Member

Thanks a lot João! Let's add some tests and merge this straight away.

@Joao-Dionisio
Copy link
Collaborator Author

Okay @mmghannam, I think I added every event type now, a bunch were missing.

As for the tests, I'm only testing whether the events that PySCIPOPt is catching and executing are the same. I could add a lot more sophisticated tests, but it will take a reaaaally long time to create a proper test for every event.

PS: I really need Github Copilot...

@mmghannam mmghannam merged commit 59564c6 into master Dec 4, 2023
@Joao-Dionisio Joao-Dionisio deleted the add-eventtype-Nodedelete branch December 4, 2023 18:05
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.

3 participants