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

Default dtype and device to SB environment #38

Closed bqth29 closed 9 months ago

bqth29 commented 10 months ago

💬 Pull Request Description

The get/set/reset_env functions have been moved to their own file named environment.py and all the dtype and device occurences in methods signatures have been made optional with a default value to None.

✔️ Check list

🚀 New features

None

🐞 Bug fixes

None

📣 Supplementary information

The configure default values for the tensors' dtype and device, it is recommanded to ather use PyTorch's torch.set_default_dtype and torch.set_default_device functions.

We considered the possibility of configuring these values via the SB environment directly, but this would risk creating a mismatch between the information stored in the environment and the actual default value, should a call be made to one of PyTorch's functions in the meantime.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (775cc10) 100.00% compared to head (9885b97) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #38 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 38 40 +2 Lines 1460 1484 +24 ========================================= + Hits 1460 1484 +24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.