Handle exception when BQM is passed to DQM sampler
Closes #375
Before BinaryQuadraticModel objects when passed to DQM sampler, raised an exception which wasn't informative.
>>> import dimod
>>> from dwave.system import LeapHybridDQMSampler
>>> bqm = dimod.BinaryQuadraticModel('SPIN')
>>> LeapHybridDQMSampler().sample_dqm(bqm)
...
AttributeError: 'BinaryQuadraticModel' object has no attribute 'num_variable_interactions'
Now (after fix)
>>> LeapHybridDQMSampler().sample_dqm(bqm)
TypeError: Expecting DiscreteQuadraticModel object, got <class 'dimod.binary.binary_quadratic_model.BinaryQuadraticModel'>
Hi @arcondello, can you please take a look!
Addressed both the comments. Thanks for the review!
Codecov Report
Merging #444 (ff432b4) into master (4fa4b27) will decrease coverage by
2.93%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #444 +/- ##
==========================================
- Coverage 90.52% 87.59% -2.94%
==========================================
Files 22 22
Lines 1520 1523 +3
==========================================
- Hits 1376 1334 -42
- Misses 144 189 +45
| Impacted Files | Coverage Δ | |
|---|---|---|
| dwave/system/samplers/leap_hybrid_sampler.py | 61.97% <100.00%> (-13.75%) |
:arrow_down: |
| dwave/system/samplers/clique.py | 77.35% <0.00%> (-5.04%) |
:arrow_down: |
| dwave/system/samplers/dwave_sampler.py | 84.14% <0.00%> (-3.05%) |
:arrow_down: |
| dwave/system/composites/embedding.py | 96.00% <0.00%> (-1.15%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 4fa4b27...ff432b4. Read the comment docs.
Hi @Abdullahjavednesar , sorry for the very long delay. Any chance you can rebase this against the current master branch? We can also do it on our side