How can I run kerberos sampler on 2000Q?


I would like to make kerberos sampler run on 2000Q in order to compare results with the ones I get in Advantage.

How can I do it? I see that Kerberos does not support the argument solver={'topology__type': 'chimera'}


Thank you in advance.



  • Hello,

    You can provide the KerberosSampler with a DWaveSampler that uses Feature-Based Solver Selection in the sample() function call like this:

    from dwave.system import DWaveSampler
    from hybrid import KerberosSampler
    sampler = KerberosSampler()
    sampleset = sampler.sample(bqm, qpu_sampler=DWaveSampler(solver=dict(topology__type='pegasus')))
    sampleset = sampler.sample(bqm, qpu_sampler=DWaveSampler(solver=dict(topology__type='chimera')))

    Check out the docs to see the variables that can be provided to the functions and the constructors here:

    Hopefully this helps with what you need.
    Please feel free to reach out if you have more questions.

    Comment actions Permalink
  • Thank you very much, David.

    I applied the solution you suggested for Kerberos and it worked.

    I tried to do the same with the LeapHybridSampler and I am stuck in a new problem. If I do

    sampler = LeapHybridSampler()
    solution = sampler.sample(bqm, qpu_sampler=DWaveSampler(solver=dict(topology__type='chimera'), ), label='Example - Hybrid on chimera', )

    when I try to get the solution
    best_solution = solution.first.sample

    I get this error.

    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/", line 832, in first
    return next('energy', name='Sample'))
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/", line 1039, in data
    record = self.record
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/", line 873, in record
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/", line 1208, in resolve
    samples = self._result_hook(self._future)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/", line 836, in <lambda>
    self, lambda f: f.wait_sampleset())
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/", line 776, in wait_sampleset
    result = self._load_result()
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/", line 901, in _load_result
    raise self._exception
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/concurrent/futures/", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/", line 402, in _encode_problem_for_submission
    body_data = json.dumps(body)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/", line 231, in dumps
    return _default_encoder.encode(obj)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/", line 257, in iterencode
    return _iterencode(o, 0)
    File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
    TypeError: Object of type DWaveSampler is not JSON serializable

    what am I doing wrong? Thank you in advance.

    Comment actions Permalink
  • Hello,

    I had to make a correction about the Kerberos object. It is possible to use, but it's a bit more complicated than I had originally stated, so I have removed the example for now. You can take a look at the implication of KerberosSampler for a better idea of how to use it this way if desired.

    For the above error that you are seeing, you will need to move your DWaveSampler construction to the LeapHybridSampler constructor, like this:

    sampler = LeapHybridSampler(sampler=DWaveSampler(solver=dict(topology__type='chimera')))
    solution = sampler.sample(bqm, label='Example - Hybrid on chimera')

    Hopefully this helps you get back to development.
    Please feel free to let us know if you have any other questions.
    If the nature of the question changes like this one in that it no longer matches the title of the original request, we kindly ask that you start a new thread so that it is easier to search for and reference in the future.

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post