dwave-hybrid
dwave-hybrid copied to clipboard
Solution refinement using ReverseAnnealingAutoEmbeddingSampler
I have a problem with an unembeddable number of variables. I can obtain a solution with SimulatedAnnealingSampler and I would like to start from that final state and execute reverse annealing on smaller sub-QUBO rolling. It seems that I am wrongly feeding the initial_state, because I am getting the error described in issue #177 and #178 I provide the simplest example I can think of, if anyone can point out the error I will be very thankful:
from dimod.generators import gnm_random_bqm
from neal import SimulatedAnnealingSampler
from hybrid import EnergyImpactDecomposer, SplatComposer
from hybrid import State, ReverseAnnealingAutoEmbeddingSampler
bqm = gnm_random_bqm(variables=200,num_interactions=40000,vartype='BINARY')
sampler = SimulatedAnnealingSampler()
sa_sample = sampler.sample(bqm).first.sample
decomposer = EnergyImpactDecomposer(size=50)
sampler = ReverseAnnealingAutoEmbeddingSampler(sampling_params={'initial_state':sa_sample})
subsampler = decomposer | sampler | SplatComposer()
state = State.from_sample(sa_sample,bqm)
solution = subsampler.run(state).result()
The output that I get is:
StateTraitMissingError: input state is missing 'subsamples' on ReverseAnnealingAutoEmbeddingSampler