What might be causing 'embedding_context' to not appear in the output of EmbeddingComposite?
Hi, I have some code that samples using EmbeddingComposite:
# Q is a sparse matrix
Q = {(0, 1): 1,
(1, 2): 2,
(0, 2): -1}
# Create the Binary Quadratic Model (BQM) from the QUBO
bqm = dimod.BinaryQuadraticModel.from_qubo(Q)
sampler = DWaveSampler(<token>)
# Wrap the sampler with EmbeddingComposite to handle the embedding process automatically
composite_sampler = EmbeddingComposite(sampler)
# Submit the problem and get the response
response = composite_sampler.sample(bqm)
embedding_response = response.info['embedding_context'] ['embedding']
I would have expected this to work, since this is the command I've used for previous versions of all of the DWave packages. However, it returns the following:
KeyError: 'embedding_context'
I'm using the following versions:
print(dimod.__version__)
print(dwave.system.__version__)
print(dwave.samplers.__version__)
0.12.17
1.26.0
1.3.0
Is there anything that might be causing 'embedding_context' to no longer appear as a field in `response.info`? Thank you.
Comments
Hello,
Are you able to run the code example shown in our documentation here?:
https://docs.ocean.dwavesys.com/en/stable/docs_system/reference/embedding.html#module-dwave.embedding.chain_strength
It looks like you might need to add return_embedding=True to your sample call like this:
Please let us know if this helps resolves your issue.
Yes, it resolved it beautifully. Thanks!
Please sign in to leave a comment.