- ran_r(r: int, graph: Union[int, Tuple[Collection[Hashable], Collection[Tuple[Hashable, Hashable]]], Collection[Tuple[Hashable, Hashable]], networkx.classes.graph.Graph], cls: None = None, seed: Optional[int] = None) dimod.binary.binary_quadratic_model.BinaryQuadraticModel ¶
Generate an Ising model for a RANr problem.
In RANr problems all linear biases are zero and quadratic values are uniformly selected integers between
r, excluding zero. This class of problems is relevant for binary quadratic models (BQM) with spin variables (Ising models).
This generator of RANr problems follows the definition in [Kin2015].
r – Order of the RANr problem.
graph – Graph to build the BQM on. Either an integer, n, interpreted as a complete graph of size n, a nodes/edges pair, a list of edges or a NetworkX graph.
cls – Deprecated. Does nothing.
seed – Random seed.
A binary quadratic model.
>>> import networkx as nx >>> K_7 = nx.complete_graph(7) >>> bqm = dimod.generators.random.ran_r(1, K_7) >>> max(bqm.quadratic.values()) == -min(bqm.quadratic.values()) True
James King, Sheir Yarkoni, Mayssam M. Nevisi, Jeremy P. Hilton, Catherine C. McGeoch. Benchmarking a quantum annealing processor with the time-to-target metric. https://arxiv.org/abs/1508.05087
Deprecated since version 0.10.13: The
clskeyword argument will be removed in 0.12.0. It currently does nothing.