dwavesystems / dwave-system

An API for easily incorporating the D-Wave system as a sampler, either directly or through Leap's cloud-based hybrid samplers
https://docs.ocean.dwavesys.com/
Apache License 2.0
87 stars 63 forks source link

Optimize LeapHybridSampler.{from_ising,from_qubo} #386

Open randomir opened 3 years ago

randomir commented 3 years ago

Current implementation of dimod.Sampler.from_qubo and dimod.Sampler.from_ising uses dimod.BinaryQuadraticModel as an intermediate BQM sent to .sample. LeapHybridSampler subclasses dimod.Sampler and inherits these methods.

Consequently, submitting (say) a large dict QUBO to HSS via LeapHybridSampler.sample_qubo creates a throwaway BinaryQuadraticModel before it's converted to a fileview-compatible BQM (e.g. AdjArrayBQM) and uploaded to SAPI.

Ultimately, we plan to update dimod to default to AdjVectorBQM, but before doing that (major change), we can implement LeapHybridSampler.from_ising and LeapHybridSampler.from_qubo to use AdjVectorBQM.