Flux biases

We are trying out embedding a problem but we seem to get flux biases which we want to offset. Is there a way to do this with EmbeddingComposite(sampler). We have to pass h and J to the annealer before we get a chance to work out the flux bias offsets. So far we have

sampler = DWaveSampler(solver={'qpu': True})
sampler_embedded = EmbeddingComposite(sampler)
bqm = dimod.BinaryQuadraticModel.from_ising(h, J)
h0 = bqm.to_ising()[0]
J0 = bqm.to_ising()[1]

anneal_params = dict(anneal_schedule = forward_schedule, h_gain_schedule = h_schedule)

answer = sampler_embedded.sample_ising(h0, J0, num_reads=nrshots, answer_mode='histogram',**anneal_params)


At this point we see a large bias in the results, so how can we add flux bias offset to this?

1

Comments

2 comments
  • One way to do this is to return the embedding from the EmbeddingComposite and then use a FixedEmbeddingComposite when you want to set the anneal offsets. Here's a code sample

    from dwave.system import DWaveSampler, FixedEmbeddingComposite, EmbeddingComposite

    # Sample your problem and return the embedding
    sampler = EmbeddingComposite(DWaveSampler(solver=dict(qpu=True)))
    sampleset = sampler.sample_ising(h, J, num_reads=10, return_embedding=True)

    embedding = sampleset.info['embedding_context']['embedding']

    # Now you can sample the problem again with anneal_offsets (either directly in the sample function, or in your anneal_params)
    anneal_offsets = [0] * 2041

    sampler = FixedEmbeddingComposite(DWaveSampler(solver=dict(qpu=True)), embedding)
    response = sampler.sample_ising(h, J, num_reads=10, anneal_offsets=anneal_offsets)

    In the example above, the anneal_offsets won't have any impact on the results, as they are set to 0.

    1
    Comment actions Permalink
  • Hi Alex - thanks for the help -- !! I'll try with the fixed embedding. ... 

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post