Fixed bug when accessing matrix variable attributes#970
Conversation
|
Ideally, if there is no column to the variable for example if the variable is deleted already or no LP created yet. |
|
@DominikKamp would it make sense to add a precondition to the method, even though it takes in |
|
Maybe you meant to check the upper bounds of the columns after optimizing but you might need to disable presolving before. |
|
Returning |
|
The precondition can be that the variable is in the LP. |
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a bug related to accessing matrix variable attributes. The changes include:
- Adding a new test function (test_MatrixVariable_attributes) to verify multiple matrix variable attributes.
- Adjusting the changelog to reflect the bug fix.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_matrix_variable.py | Introduces tests to verify methods for matrix variable attributes. |
| CHANGELOG.md | Updates the changelog with the bug fix description. |
Files not reviewed (1)
- src/pyscipopt/scip.pxi: Language not supported
Comments suppressed due to low confidence (1)
tests/test_matrix_variable.py:303
- The test for getCol is commented out, leaving its behavior untested; consider adding a TODO or reference to the bug tracking issue (#969) to clarify why this test is disabled and outline plans for future validation.
#assert x.getCol().tolist()# == [[5, 6], [2, 8]]
|
Ah no, I didn't mean to check the upper bounds of the columns, the rhs of the check was there from copy-pasting. I just wanted to access the method. I think the error is explicit enough. |
mmghannam
left a comment
There was a problem hiding this comment.
Looks good, thanks @Joao-Dionisio!
Fix #969
There's still a bug with
getCol, but that one is also a bug in the normal variables. I'm thinking it may just be about adding an assertion.@DominikKamp do you know when
SCIPvarGetColreturns NULL?