Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle exception when BQM is passed to DQM sampler #444

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Abdullahjavednesar
Copy link

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'>

@Abdullahjavednesar
Copy link
Author

Hi @arcondello, can you please take a look!

@arcondello arcondello self-requested a review March 1, 2022 18:45
@Abdullahjavednesar
Copy link
Author

Addressed both the comments. Thanks for the review!

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2022

Codecov Report

Merging #444 (ff432b4) into master (4fa4b27) will decrease coverage by 2.93%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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%) ⬇️
dwave/system/samplers/clique.py 77.35% <0.00%> (-5.04%) ⬇️
dwave/system/samplers/dwave_sampler.py 84.14% <0.00%> (-3.05%) ⬇️
dwave/system/composites/embedding.py 96.00% <0.00%> (-1.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fa4b27...ff432b4. Read the comment docs.

@arcondello
Copy link
Member

arcondello commented Jan 26, 2023

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

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.

Raise a more informative error message when passing BQM to DQM sampler
3 participants