reverse annealing for solutions obtained with LeapHybridSampler()
Hi all,
I am trying to get local improvements to a solution of a bqm I obtained via LeapHybridSampler(). I have the reverse annealing example you kindly provided as a guide and I am following the steps of the tutorial. I would like to do something like
sampler_reverse = ReverseAdvanceComposite(sampler)
solution= sampler_reverse.sample(bqm,
initial_state=initial_dict,
anneal_schedules=schedule,
num_reads=50,
reinitialize_state=False)
Is this correct? I would like to provide the binary values of the solution as initial_state. In order to do so I define a dictionary containing the value of the binary variables (casted as 'int8') resulting as a solution.
If I try to define as forwardSampler the LeapHybridSampler() I used before, I get the error
----
Connected to sampler hybrid_binary_quadratic_model_version2
Traceback (most recent call last):
print("Maximum anneal-schedule points: {}".format(sampler.properties["max_anneal_schedule_points"]))
KeyError: 'max_anneal_schedule_points'
----
Does this mean that the LeapHybridSampler() cannot be used to define reverse_anneal samplers?
Otherwise if I define DwaveSampler() as forward sampler I obtain
-----
Connected to sampler Advantage_system4.1
Maximum anneal-schedule points: 12
Annealing time range: [0.5, 2000.0]
Maximum slope allowed on this solver is 2.00.
Traceback (most recent call last):
/...
raise BinaryQuadraticModelStructureError(msg)
dimod.exceptions.BinaryQuadraticModelStructureError: Problem graph incompatible with solver.
---
Thank you in advance for all the help.
Kind regards.
Comments
Dear all,
ok, I have read the documentation and for the first error, I have understood that I cannot use the LeapHybridSampler(). Is this correct?
As far as the second question is concerned, I have found a workaround using an appropriate composite that embeds the dwave sample, and now it partially works.
But still, I have a question. In the reverse annealing example you provided there are functions like make_reverse_anneal_schedule that are made available via the helpers.schedule module. In the offline dwave python package I downloaded via pip I cannot find it. what package am I supposed to download?
Thank you very much in advance.
Giuliana,
To see the supporting code called in the Jupyter Notebook Reverse Annealing example, click on the "File" tab of the Jupyter notebook (not the browser) and then click "open".
The make_reverse_anneal_schedule function is under the helpers folder in schedule.py.
Ed
Hello,
Thank you for pointing this out.
We are looking at improving the documentation here to make it a bit clearer.
Sounds like you were able to resolve the second issue by using EmbeddingComposite or something similar.
Please sign in to leave a comment.