bqth29 / simulated-bifurcation-algorithm

Python CPU/GPU implementation of the Simulated Bifurcation (SB) algorithm to solve quadratic optimization problems (QUBO, Ising, TSP, optimal asset allocations for a portfolio, etc.).
MIT License
103 stars 25 forks source link

TypeError: 'type' object is not subscriptable when importing simulated_bifurcation #32

Closed Steven-meta closed 11 months ago

Steven-meta commented 11 months ago

Hi,

When importing simulated_bifurcation, I got en error "TypeError: 'type' object is not subscriptable "

Error message: class IsingPolynomialInterface(ABC): 11 12 """

simulated_bifurcation/polynomial/ising_polynomial_interface.py in IsingPolynomialInterface() 28 vector: Union[torch.Tensor, np.ndarray, None] = None, 29 constant: Union[int, float, None] = None, ---> 30 accepted_values: Union[torch.Tensor, np.ndarray, list[int], None] = None, 31 dtype: torch.dtype = torch.float32, 32 device: str = "cpu",

Could you help solve this problem? Thanks

BusyBeaver-42 commented 11 months ago
from __future__ import annotations

The problem is that a typo in the source code (an "l" insteand of an "L") made the code use a functionnality which is not available in Python 3.8. This was fixed in a commit a few weeks back.

Steven-meta commented 11 months ago

Thanks for your quick reply. It works well with Python 3.9, but the second solution is not compatible with 3.8.