Skip to content

Conversation

@Joao-Dionisio
Copy link
Member

This version is more than 5 years old. This is to fix the pipelines (see here), following #1159

@Joao-Dionisio Joao-Dionisio merged commit 149b057 into master Jan 20, 2026
3 checks passed
@Zeroto521
Copy link
Contributor

Zeroto521 commented Jan 20, 2026

numpy 1.19.0 is still not enough. https://github.com/scipopt/PySCIPOpt/actions/runs/21167913773/job/60877139006

tests/test_statistics.py:2: in <module>
    from helpers.utils import random_mip_1
tests/helpers/utils.py:1: in <module>
    from pyscipopt import Model, quicksum, SCIP_PARAMSETTING, exp, log, sqrt, sin
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pyscipopt/__init__.py:11: in <module>
    from pyscipopt.scip      import Model as Model
src/pyscipopt/matrix.pxi:255: in init pyscipopt.scip
    @np.vectorize(otypes=[object], signature="(m,n),(n,p)->(m,p)")
E   TypeError: __init__() missing 1 required positional argument: 'pyfunc'
__________________ ERROR collecting tests/test_statistics.py ___________________

@Zeroto521
Copy link
Contributor

Here is another way to fix this.
Use np.vectorize directly.

def _core_dot(...):
    ...
    _core_dot_nd
    ...

_core_dot_nd = np.vectorize(_core_dot_2d, otypes=[object], signature="(m,n),(n,p)->(m,p)")

def _core_dot_2d(...):
    ...

@Joao-Dionisio
Copy link
Member Author

Can you please do it @Zeroto521 ?

@Zeroto521
Copy link
Contributor

Does Numpy need to degrade to 1.16.0? @Joao-Dionisio

@Joao-Dionisio
Copy link
Member Author

@Zeroto521 sure, why not.

Zeroto521 added a commit to Zeroto521/PySCIPOpt that referenced this pull request Jan 21, 2026
Joao-Dionisio added a commit that referenced this pull request Jan 22, 2026
* Revert "Increase minimum numpy version to 1.19.0 (#1162)"

This reverts commit 149b057.

* Refactor matrix multiplication to use vectorized core_dot_2d

Replaces usage of _core_dot_2d with a new vectorized _core_dot_nd for mixed-type matrix multiplication in _core_dot. Defines _core_dot_nd as a vectorized wrapper around _core_dot_2d, improving code clarity and consistency.

* Change _core_dot_2d from cdef to def and add return type

Refactored _core_dot_2d to be a Python-accessible function with an explicit return type annotation. This improves clarity and allows the function to be used from Python code.

* Remove unused NDArray import and update type hints

NumPy 1.x doesn't support this

* Move _vec_evaluate definition above _ensure_array

Relocated the _vec_evaluate assignment to precede the _ensure_array function for improved code organization and clarity.

* Use bint for boolean variables in matrix.pxi

NumPy 1.x doesn't support bool

---------

Co-authored-by: João Dionísio <57299939+Joao-Dionisio@users.noreply.github.com>
@Joao-Dionisio Joao-Dionisio deleted the fix-numpy-min-version branch January 22, 2026 16:21
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