forked from scipopt/PySCIPOpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Put real parameter names in the stubs #1
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
Draft
jonathanberthias
wants to merge
16
commits into
enable-stubtest
Choose a base branch
from
simple-attributes
base: enable-stubtest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Fix mypy errors * Generate stubtest allowlist * Split expected errors out of todo * Move all stub-related files to stubs folder * Add workflow to check stubs * Simplify file names * Don't run ruff on everything * Revert error added for testing * Clarify requirements for stubtest * Run mypy in CI
* Add test for matrix sum return type Adds a test to ensure that summing a matrix variable along an axis returns a MatrixExpr type instead of MatrixVariable, addressing issue scipopt#1117. * return `MatrixExpr` type * Update CHANGELOG.md * Speed up `MatrixExpr.sum(axis=...)` Enhanced the MatrixExpr.sum method to accept axis as int or tuple, handle keepdims, and provide better error checking for axis bounds. This improves compatibility with numpy's sum behavior and allows more flexible summation over matrix expressions. * Test `MatrixExpr.sum(axis=...)` Removed n=200 from the sum performance test to limit test size. Added additional performance assertions comparing np.ndarray.sum and the optimized sum method for matrix variables. * Test `MatrixExpr.sum(axis=tuple(range(ndim))` Renamed test_matrix_sum_argument to test_matrix_sum_axis and updated tests to use explicit axis arguments in sum operations. This clarifies the behavior when summing over all axes and improves test coverage for axis handling. * Refactor MatrixExpr.sum axis handling with numpy utility Replaces manual axis validation and normalization in MatrixExpr.sum with numpy's normalize_axis_tuple for improved reliability and code clarity. Updates type hints and simplifies logic for summing across all axes. * Add tests for matrix sum error Added tests to verify error handling in matrix variable sum operations for invalid axis types, out-of-range values, and duplicate axes. * Add tests for matrix sum with keepdims parameter Introduces test cases to verify the shape of matrix variable sums when using the keepdims argument, ensuring correct behavior for both full and axis-specific summation. * call `.sum` via positional argument Replaces the use of the 'axis' keyword argument with a positional argument in the z.sum() method call to align with the expected function signature. * Refactor sum method to use np.apply_along_axis Replaces np.fromiter with np.apply_along_axis for summing along specified axes in MatrixExpr. This simplifies the code and improves readability. * Directly test the `.sum` result Added a comment to clarify the purpose of the test_matrix_sum_axis function, indicating it compares the result of summing a matrix variable after optimization. * Update CHANGELOG.md * Expand docstring for MatrixExpr.sum method The docstring for the MatrixExpr.sum method was updated to provide detailed information about parameters, return values, and behavior, improving clarity and alignment with numpy conventions. * Clarify MatrixExpr.sum docstring and note quicksum usage Updated the docstring for MatrixExpr.sum to specify that it uses quicksum for speed optimization instead of numpy.ndarray.sum. Added a detailed note explaining the difference between quicksum (using __iadd__) and numpy's sum (using __add__). * Split up two costing time test cases Renamed the existing performance test to clarify it tests the case where axis is None. Added a new test to measure performance when summing along a specific axis. * Supports numpy 1.x Co-authored-by: Copilot <[email protected]> * Supports Python 3.8 * Simplify a bit Refactored the sum method in MatrixExpr to clarify axis typing and simplify the application of np.apply_along_axis. The new implementation improves readability and maintains the intended behavior. * suggestion --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Joao-Dionisio <[email protected]> Co-authored-by: João Dionísio <[email protected]>
aa28664 to
0d9e6e3
Compare
* first attempt at script * wrapped SCIPaddClique * remove clique
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(stacked on top of scipopt#1141)
(A)I wrote a script to process the output of
stubtestto input the correct parameter names to all methods. This reduces the number of remaining "TODO" items to just 3 🎉Changes:
...default if the parameters have default valuesIncomplete