Open bqth29 opened 2 months ago
Attention: Patch coverage is 99.74425%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 97.03%. Comparing base (
a9ab8bb
) to head (c31a2cb
).
Files with missing lines | Patch % | Lines |
---|---|---|
tests/models/test_knapsack.py | 66.66% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
💬 Pull Request Description
The
polynomial
was becoming redundant and less relevant as other libraries like SymPy allow polynomial manipulation. As it is a bit out of the scope of this package, it makes sense removing it.QuadraticPolynomial
s can still be instanciated from SymPy's Polys or tensors/arrays, but they no longer inherit fromPolynomial
which means that all the data coherence checks are now carried in the__init__
method of theQuadraticPolynomial
class.This cleaning was carried out alongside a refactoring of the
core
module that received new responsabilities. For a better alignment of theIsing
andQuadraticPolynomial
classes, two main changes were introduced:Ising
,QuadraticPolynomial
and the mainsimulated_bifurcation
module are now keyword-only, which replaces PR #53QuadraticPolynomial
as well as theto_ising
method now require a dtype and a device to separate the model's dtype (which can be any int or float dtype) and the computation dtype which must either betorch.float32
ortorch.float64
; this replaces PR #64 and fixes #41Finally, the
domain
argument of the optimization functions no longer has a default value.✔️ Check list
Before you open the pull request, make sure the following requirements are met.
🚀 New features
None.
🐞 Bug fixes
When an Ising model was turned into a single tensor using the
as_simulated_bifurcation_tensor
method while it had linear terms,Ising.J
was passed into the block matrix instead of its null-diagonal and symmetrized version. This was fixed.📣 Supplementary information
The instances of
QuadraticPolynomial
now have 4 key properties:quadratic
: square 2-dimensional tensor that gathers all the quadratic coefficientslinear
: 1-dimensional tensor that gathers all the linear coefficientsbias
: 0-dimensional tensor that contains the bias of the polynomialpoly
: SymPy polynomial representation of the QuadraticPolynomial (stored for an easier visualization, manipulation)Note that either the
QuadraticPolynomial
is initialized with tensors and then the Poly is created, or inversely, it is initialized from a Poly and the coefficient tensors are generated afterwards.Parametrized tests were introduced to cover the
core
module. They allow the tests to be run using different dtypes and devices (if the computer has a CUDA GPU). Draft PR #61 was closed because this PR replaces it.⚠️ Breaking changes