TilingComposite¶
Class¶
A dimod composite that tiles small problems multiple times to a Chimera-structured sampler.
The TilingComposite
takes a problem that can fit on a small Chimera graph
and replicates it across a larger Chimera graph to obtain samples from multiple areas
of the solver in one call. For example, a 2x2 Chimera lattice could be tiled 64 times
(8x8) on a fully-yielded D-Wave 2000Q system (16x16).
-
class
TilingComposite
(sampler, sub_m, sub_n, t=4)[source]¶ Composite to tile a small problem across a Chimera-structured sampler.
Inherits from
dimod.Sampler
,dimod.Composite
, anddimod.Structured
.Enables parallel sampling for small problems (problems that are minor-embeddable in a small part of a D-Wave solver’s Chimera graph).
The notation CN refers to a Chimera graph consisting of an NxN grid of unit cells. Each Chimera unit cell is itself a bipartite graph with shores of size t. The D-Wave 2000Q QPU supports a C16 Chimera graph: its 2048 qubits are logically mapped into a 16x16 matrix of unit cell of 8 qubits (t=4).
A problem that can be minor-embedded in a single unit cell, for example, can therefore be tiled across the unit cells of a D-Wave 2000Q as 16x16 duplicates. This enables sampling 256 solutions in a single call.
Parameters: - sampler (
dimod.Sampler
) – Structured dimod sampler to be wrapped. - sub_m (int) – Number of rows of Chimera unit cells for minor-embedding the problem once.
- sub_n (int) – Number of columns of Chimera unit cells for minor-embedding the problem once.
- t (int, optional, default=4) – Size of the shore within each Chimera unit cell.
Examples
This example instantiates a composed sampler using composite
TilingComposite
to tile a QUBO problem on a D-Wave solver, embedding it with compositeEmbeddingComposite
and selecting the D-Wave solver with the user’s default D-Wave Cloud Client configuration file. The two-variable QUBO represents a logical NOT gate (two nodes with biases of -1 that are coupled with strength 2) and is easily minor-embedded in a single Chimera cell (it needs only any two coupled qubits) and so can be tiled multiple times across a D-Wave solver for parallel solution (the two nodes should typically have opposite values).>>> from dwave.system.samplers import DWaveSampler >>> from dwave.system.composites import EmbeddingComposite >>> from dwave.system.composites import TilingComposite >>> sampler = EmbeddingComposite(TilingComposite(DWaveSampler(), 1, 1, 4)) >>> Q = {(1, 1): -1, (1, 2): 2, (2, 1): 0, (2, 2): -1} >>> response = sampler.sample_qubo(Q) >>> for sample in response.samples(): ... print(sample) ... {1: 0, 2: 1} {1: 1, 2: 0} {1: 1, 2: 0} {1: 1, 2: 0} {1: 0, 2: 1} {1: 0, 2: 1} {1: 1, 2: 0} {1: 0, 2: 1} {1: 1, 2: 0} >>> # Snipped above response for brevity
- sampler (
Sampler Properties¶
TilingComposite.properties |
dict – Properties in the form of a dict. |
TilingComposite.parameters |
dict[str, list] – Parameters in the form of a dict. |
Composite Properties¶
TilingComposite.children |
list – The single wrapped structured sampler. |
TilingComposite.child |
First child in children . |
Structured Sampler Properties¶
TilingComposite.nodelist |
list – List of active qubits for the structured solver. |
TilingComposite.edgelist |
list – List of active couplers for the D-Wave solver. |
TilingComposite.adjacency |
dict[variable, set] – Adjacency structure formatted as a dict, where keys are the nodes of the structured sampler and values are sets of all adjacent nodes for each key node. |
TilingComposite.structure |
Structure of the structured sampler formatted as a namedtuple Structure(nodelist, edgelist, adjacency) , where the 3-tuple values are the nodelist and edgelist properties and adjacency() method. |
Methods¶
TilingComposite.sample (bqm, **kwargs) |
Sample from the provided binary quadratic model |
TilingComposite.sample_ising (h, J, **parameters) |
Samples from an Ising model using an implemented sample method. |
TilingComposite.sample_qubo (Q, **parameters) |
Samples from a QUBO using an implemented sample method. |