dwave.system.composites.EmbeddingComposite.sample

EmbeddingComposite.sample(bqm, chain_strength=None, chain_break_method=None, chain_break_fraction=True, embedding_parameters=None, return_embedding=None, warnings=None, **parameters)[source]

Sample from the provided binary quadratic model.

Parameters:
  • bqm (dimod.BinaryQuadraticModel) – Binary quadratic model to be sampled from.
  • chain_strength (float/mapping/callable, optional, default=1.0) – Magnitude of the quadratic bias (in SPIN-space) applied between variables to create chains. The energy penalty of chain breaks is 2 * chain_strength. If a mapping is passed, a chain-specific strength is applied. If a callable is passed, it will be called on chain_strength(bqm, embedding) and should return a float or mapping, to be interpreted as above. By default, chain_strength is scaled to the problem.
  • chain_break_method (function/list, optional) – Method or methods used to resolve chain breaks. If multiple methods are given, the results are concatenated and a new field called “chain_break_method” specifying the index of the method is appended to the sample set. See unembed_sampleset() and dwave.embedding.chain_breaks.
  • chain_break_fraction (bool, optional, default=True) – Add a chain_break_fraction field to the unembedded response with the fraction of chains broken before unembedding.
  • embedding_parameters (dict, optional) – If provided, parameters are passed to the embedding method as keyword arguments. Overrides any embedding_parameters passed to the constructor.
  • return_embedding (bool, optional) – If True, the embedding, chain strength, chain break method and embedding parameters are added to dimod.SampleSet.info of the returned sample set. The default behaviour is defined by return_embedding_default, which itself defaults to False.
  • warnings (WarningAction, optional) – Defines what warning action to take, if any. See warnings. The default behaviour is defined by warnings_default, which itself defaults to IGNORE
  • **parameters – Parameters for the sampling method, specified by the child sampler.
Returns:

dimod.SampleSet

Examples

See the example in EmbeddingComposite.