Open speller26 opened 3 years ago
I think there are two specific features we'd like to support: 1) Graph validation. This can be done now with
all(v in sampler.adjacency for v in bqm.variables) and (u in sampler.adjacency[v] for u, v in bqm.quadratic)
if you have a StructuredSampler.
One solution might be to add a sampler.check_structure(bqm)
method to the structured sampler ABC.
2) Variable format massaging. See https://github.com/dwavesystems/dwave-cloud-client/issues/465
When you say StructuredSampler, do you just mean that the Sampler implementation should subclass both Sampler
and Structured
(I don't see a StructuredSampler
class; will that be added)?
Yes, it should subclass both, like the DWaveSampler.
To @speller26's point, adding StructuredSampler
with relevant utilities, and then subclassing it in DWaveSampler
makes the most sense to me (see https://github.com/dwavesystems/dimod/pull/832#discussion_r644310027).
Something like:
# in dimod
class StructuredSampler(dimod.Structured, dimod.Sampler):
def samples_from(self, bqm):
...
# in dwave-system
class DWaveSampler(dimod.StructuredSampler):
...
Current Problem I want to use some of the the low-level utilities provided in
dwave-cloud-client
directly from a third-party sampler.For example, I'd like to validate that my problem is compatible with a device's graph. This functionality is available in the
DWaveSampler
's underlyingClient
, but not directly from the sampler; I have to access the low-levelClient
. However, a third-party sampler does not have an underlyingClient
, so it becomes impossible to use this feature.Proposed Solution Expose useful lower-level utilities through the
Sampler
interface.