Having some trouble with embedding when trying implement reverse annealing

I've been trying to implement a reverse pause and quench annealing schedule: [[0.0, 1.0], [2.0, 0.278], [99.63, 0.278], [100, 1.0]]. Every time I've tried defining an initial state however, I get an error saying "chain for __ is empty or not contained in this embedding", with some different index each time. I'm assuming this is because I'm trying to do the embeddings the wrong way and I just can figure out what piece I'm missing.

I've tried by starting with one forward annealing run and then using that state as the initial state for the reverse annealing; using the find_embedding method passing in my couplings and the sampler's edge list which returned an embedding that seemed to work, it passed a few tests that I thought would confirm that it was a proper embedding but it passed them all and I still got the same error; then I tried using the Tiling Composite sampler with the Fixed Embedding Composite method as shown in the reverse annealing notebook and I get the same issue again.

So now that the example code doesn't work when I just copy it over, (couplings, biases and all), I come to the forums as I assume I've monumentally gone off course and would appreciate some guidance. Thanks!

0

Comments

4 comments
  • Additionally, if I try to check with the dwave.embedding.verify_embedding() method, it returns true however, when I submit a job it still returns a chain error.

    0
    Comment actions Permalink
  • Hi Dorian,
    Could you please provide a minimal code example that can be copy-pasted to verify the behaviour, as well as any stack trace or error message that you are seeing? 
    This will help us determine what is not quite working. 
    Try to make the problem as small as possible to keep it manageable. 

    0
    Comment actions Permalink
  • As I was trying to get a fresh run of the code, it seems that managed to fix whatever the issue was. This is what my code looks like right now and it seems to work. At least it submits jobs, the whole point is to try and implement a pause and quench annealing schedule so I can look some more complex states of the system when it's under the effects of a transverse field but that could probably be figured out later. Thanks for reaching out, if I have a problem again, would it best to return to this post or should I create a new post? I'll attach my code here regardless:

    """-----------------------------

    J_coupls = {(0, 1): -0.5123, (1, 2): -0.1975, (2, 3): 0.1843}

    h = {0: 0, 1: 0, 2: 0, 3: 0}

    reverse_schedule = [[0.0, 1.0], [5, 0.45], [99, 0.45], [100, 1.0]]

    sampler_edgelist = sampler.edgelist

    embedding = find_embedding(J_coupls.keys(), sampler_edgelist)

    source = nx.Graph()

    source.add_edges_from(J_coupls.keys())

    target = sampler.to_networkx_graph()

    verify_embedding(emb=embedding, source=source, target=target)

    print(verify_embedding)

    embeddedSampler = FixedEmbeddingComposite(sampler, embedding)

    initStateSampled = embeddedSampler.sample_ising(h, J_coupls, num_reads=100)

    initState = initStateSampled.first.sample

    revAnneal = embeddedSampler.sample_ising(h, J_coupls, 
                                             num_reads = 100,
                                             anneal_schedule = [[0.0, 1.0], [5, 0.275], [99, 0.275], [100, 1.0]],
                                             initial_state = initState,
                                             reinitialize_state = False)

    """------------------------------

    0
    Comment actions Permalink
  • Hello,

    If you the above code snippet recreates the issue you were seeing, please do respond here. 

    If it is a new topic or question, please feel free to start another thread.

    It could be that an embedding was not found on one of the calls in the code example above. 
    Saving a successful embedding for use later is a good method to avoid running into this issue in the future. 
    It would require storing the embedding to disk and reading it back on subsequent calls.

    Please let us know if you have any questions.
    Thank you again for reaching out to us.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post