dimod.generators.uniform#

uniform(graph: int | tuple[Collection[Hashable], Collection[tuple[Hashable, Hashable]]] | Collection[tuple[Hashable, Hashable]] | Graph, vartype: Literal[Vartype.SPIN, 'SPIN', Vartype.BINARY, 'BINARY', Vartype.INTEGER, 'INTEGER', Vartype.REAL, 'REAL'], low: float = 0, high: float = 1, cls: None = None, seed: int | None = None) BinaryQuadraticModel[source]#

Generate a binary quadratic model with random biases and offset.

Biases and offset are drawn uniformly from a specified distribution range.

Parameters:
  • graph – Graph to build the binary quadratic model (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.

  • vartype

    Variable type for the BQM. Accepted input values:

  • low – Low end of the range for the random biases.

  • high – High end of the range for the random biases.

  • cls – Deprecated. Does nothing.

  • seed – Random seed.

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.