Open jberwald opened 5 years ago
How about
sampler = DWaveSampler()
tiles = find_tiles(sampler.structure, 2, 2, 4)
bqm = dimod.BQM.empty('SPIN')
for tile in tiles:
bqm.update(dimod.ran_r(1, tile))
sampleset = sampler.sample(bqm)
if we exposed the find_tiles
function used by the TilingComposite
?
It is worth noting that the original feature request for the TilingComposite
was for something like
bqms = [dimod.ran_r(1, dnx.chimera_graph(2, 2, 4)) for _ in range(5)] # get 5 different C2 BQMs
sampleset = TilingComposite(DWaveSampler()).sample(bqms)
the problem is that the Sampler API does not support accepting multiple BQMs.
Your first code block basically lays out what I'm doing already (with more code, of course). So yes, that seems like a nice solution.
As a side note, it seems like the TilingComposite excludes a fair amount of real estate in the example above. Am I understanding it's tiling procedure correctly in relation to inactive qubits and why some regions are not tiled?
Yes, though it finds the regions in a pretty naive/greedy way so it can miss a lot of realestate.
Current Problem
TilingComposite
currently treats a tiling of the QPU as a single entity. Based on a too-literally reading of the definition of a tiling (fixed geometric shapes or tiles filling space) I thought one could take a single, small tile, represented by a BQM, tile the QPU with that shape, and run many copies of that BQM. While this is possible using the child sampler, it is not intuitive.Here's a sample problem: The tiling produced by
TilingComposite(DWaveSampler(), 2,2,4)
is composed of a bunch 32-qubit tiles. The figure below is a representation where each tile is an 32-qubit RAN-1 problem. The blank spots are where bum qubits won't allow a perfect tile.Proposed Solution Make
TilingComposite
tile-aware. Lettiles = [bqm for a single tile]
and definefullBQM = dimod.BQM(linear={all linear terms from tiles}, quadratic={all coupling in tiles}
. Something likeTilingComposte.sample_tiling(fullBQM)
should return a SampleSet. CurrentlyTilingComposte.sample(fullBQM)
throws an error:BinaryQuadraticModelStructureError: given bqm does not match the sampler's structure
.