make_origin_embeddings(qpu_sampler=None, lattice_type=None, problem_dims=None, reject_small_problems=True, allow_unyielded_edges=False)[source]

Creates optimal embeddings for a lattice.

An embedding is a dictionary specifying the mapping from each lattice variable to a set of qubits (chain). The embeddings created are compatible with the topology and shape of a specified qpu_sampler.

  • qpu_sampler (dimod.Sampler, optional) – Quantum sampler such as a D-Wave system. If not specified, the DWaveSampler sampler class is used to select a QPU solver with a topology compatible with the specified lattice_type (e.g. an Advantage system for a ‘pegasus’ lattice type).

  • lattice_type (str, optional, default=qpu_sampler.properties['topology']['type']) –

    Options are:
    • ”cubic”

      Embeddings compatible with the schemes arXiv:2009.12479 and arXiv:2003.00133 are created for a qpu_sampler of topology type either ‘pegasus’ or ‘chimera’.

    • ”pegasus”

      Embeddings are chain length one (minimal and native). If qpu_sampler topology type is ‘pegasus’, maximum scale subgraphs are embedded using the nice_coordinates vector labeling scheme for variables.

    • ”chimera”

      Embeddings are chain length one (minimal and native). If qpu_sampler topology type is ‘chimera’, maximum scale chimera subgraphs are embedded using the chimera vector labeling scheme for variables.

  • problem_dims (tuple of ints, optional) –

    origin_embeddings over the solver are constrained to not exceed these dimensions.

    For cubic lattices, dimension bounds are specified as (x, y, z).

    For pegasus lattices, bounds are specified in nice coordinate (t, y, x, u, k): a P16 solver has bounds (3,15,15,2,4)

    For chimera lattices, bounds are specified in chimera coordinates (i,j,u,k): a C16 solver has bounds (16,16,2,4).

    Where embedded variables exceed these bounds the embedding is either truncated, or raises an error, according to the flag reject_small_problems.

    Note that when the embedding scale exactly matches the problem scale, problems can also occur for the case of periodic boundary conditions that are not supported by these embeddings, which assume open boundary induced problems in general.

  • reject_small_problems (bool, optional, True) – If the target problem dimensions are smaller than the dimensions allowed by the origin embeddings, raise an error. Since these routines are intended to support workflows beyond solvable scale, a user override is required for the inappopriate use case. This flag is only invoked if problem_dims is specified.

  • allow_unyielded_edges (bool, optional, False) – A requirement for certain sublattice based methods is that any two variables connected in the lattice must also be connected in the embedding. If two variables allow yielded chains, but are not connected, then by default at least one of the two variables is treated as unyielded. If the argument is set to False then yielded chains of incomplete connectivity are returned as part of the embedding.


A list of embeddings. Each embedding is a dictionary, mapping geometric problem keys to sets of qubits (chains) compatible with the qpu_sampler.


This example creates a list of three cubic lattice embeddings compatible with the default online system. These three embeddings are related by rotation of the lattice: for a Pegasus P16 system the embeddings are for lattices of size (15,15,12), (12,15,15) and (15,12,15) respectively.

>>> from dwave.system.samplers import DWaveSampler   
>>> sampler = DWaveSampler()  
>>> embeddings = make_origin_embeddings(qpu_sampler=sampler,
...                                     lattice_type='cubic')  

See also




Jack Raymond et al, Hybrid quantum annealing for larger-than-QPU lattice-structured problems