How can I run kerberos sampler on 2000Q?
Hello,
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.
Comments
Hello,
You can provide the KerberosSampler with a DWaveSampler that uses Feature-Based Solver Selection in the sample() function call like this:
Check out the docs to see the variables that can be provided to the functions and the constructors here:
https://docs.ocean.dwavesys.com/projects/hybrid/en/stable/reference/reference.html
Hopefully this helps with what you need.
Please feel free to reach out if you have more questions.
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
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/sampleset.py", line 832, in first
return next(self.data(sorted_by='energy', name='Sample'))
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/sampleset.py", line 1039, in data
record = self.record
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/sampleset.py", line 873, in record
self.resolve()
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dimod/sampleset.py", line 1208, in resolve
samples = self._result_hook(self._future)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/computation.py", line 836, in <lambda>
self, lambda f: f.wait_sampleset())
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/computation.py", line 776, in wait_sampleset
result = self._load_result()
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/computation.py", line 901, in _load_result
raise self._exception
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/site-packages/dwave/cloud/solver.py", line 402, in _encode_problem_for_submission
body_data = json.dumps(body)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/ljulie/anaconda3/envs/dwave/lib/python3.7/json/encoder.py", 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.
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:
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.
Please sign in to leave a comment.