Skip to content

Add preliminary QCDL support#745

Open
randomir wants to merge 3 commits into
dwavesystems:masterfrom
randomir:feature/add-qcdl-support
Open

Add preliminary QCDL support#745
randomir wants to merge 3 commits into
dwavesystems:masterfrom
randomir:feature/add-qcdl-support

Conversation

@randomir
Copy link
Copy Markdown
Member

@randomir randomir commented May 13, 2026

Example:

import orjson
from dwave.cloud import Client

client = Client.from_config()
solver = client.get_solver(supported_problem_types__contains='qcdl')

qcdl = {...}
params = dict(shots=3, time_limit=600, noisy=False)

response = solver.sample_qcdl(qcdl, **params)
answer = orjson.loads(response.answer_data.read())

Alternatively, to upload the circuit first, replace the sample_qcdl line with:

circuit_id = solver.upload_qcdl(qcdl).result()
response = solver.sample_qcdl(circuit_id, **params)

AI Generation Disclosure

No AI used.

@randomir randomir force-pushed the feature/add-qcdl-support branch from 2e85457 to 8b61a8b Compare May 13, 2026 19:11
@randomir randomir force-pushed the feature/add-qcdl-support branch from 8b61a8b to d831938 Compare May 13, 2026 19:13
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.93%. Comparing base (2261ca5) to head (d831938).

Files with missing lines Patch % Lines
dwave/cloud/solver.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #745   +/-   ##
=======================================
  Coverage   89.92%   89.93%           
=======================================
  Files          44       44           
  Lines        5300     5313   +13     
=======================================
+ Hits         4766     4778   +12     
- Misses        534      535    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@randomir randomir requested a review from arcondello May 13, 2026 19:19
Copy link
Copy Markdown
Member

@arcondello arcondello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have always loved this design. No more and no less than the amount of information needed to support the new problem type.

Comment thread dwave/cloud/solver.py
_handled_encoding_formats = {"binary-ref"}

def _encode_problem_for_upload(self, qcdl, **kwargs):
return orjson.dumps(qcdl)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if a try/except here might help some users debug in the future.

OTOH we don't have evidence that this is a common failure path, so until we do probably better to leave it alone. Ok, I talked myself out of it, but leaving the comment for posterity 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we integrate QCDL generation into Ocean, we'll be able to do better checks here. Or even defer serialization completely. Just like we do with NL (and require dwave-optimization) or BQM/CQM/DQM (and require dimod).

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.

2 participants