dimod.generators.doped#

doped(p: float, graph: int | tuple[Collection[Hashable], Collection[tuple[Hashable, Hashable]]] | Collection[tuple[Hashable, Hashable]] | Graph, cls: None = None, seed: int | None = None, fm: bool = True)[source]#

Generate a BQM for a doped ferromagnetic (FM) or antiferromagnetic (AFM) problem.

In a doped FM problem, p, the doping parameter, determines the probability of couplers set to AFM (flipped to 1). The remaining couplers remain FM (-1). In a doped AFM problem, the opposite is true.

Parameters:
  • p – Doping parameter [0, 1] determines the probability of couplers being flipped.

  • 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.

  • fm – If True, the default undoped graph is FM. If False, it is AFM.

Returns:

A binary quadratic model.

Deprecated since version 0.10.13: The cls keyword argument will be removed in 0.12.0. It currently does nothing.