Warnings

Settings for raising warnings may be configured by tools such as composites or dwave-inspector.

This example configures warnings for an instance of the EmbeddingComposite() class used on a sampler structured to represent variable a with a long chain.

>>> import networkx as nx
>>> import dimod
>>> import tabu
...
>>> G = nx.Graph()
>>> G.add_edges_from([(n, n + 1) for n in range(10)])
>>> sampler = dimod.StructureComposite(tabu.TabuSampler(), G.nodes, G.edges)
>>> sampleset = EmbeddingComposite(sampler).sample_ising({}, {("a", "b"): -1},
...     return_embedding=True,
...     embedding_parameters={"fixed_chains": {"a": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}},
...     warnings=dwave.system.warnings.SAVE)
>>> "warnings" in sampleset.info
True
class ChainBreakWarning[source]

Raised if a chain’s qubits are in different states for lowest-energy samples.

class ChainLengthWarning[source]

Raised if the number of qubits forming a chain is high.

class ChainStrengthWarning[source]

Base category for warnings about the embedding chain strength.

class EnergyScaleWarning[source]

Base category for warnings about the relative bias strengths.

class TooFewSamplesWarning[source]

Raised if lowest-energy samples are a small fraction of the total samples.

class WarningAction(value)[source]

Settings for raising warnings.

An enum with values IGNORE and SAVE.

class WarningHandler(action=None)[source]