load(fp: TextIO, cls: None = None, vartype: Vartype | None = None) BinaryQuadraticModel[source]#

Load a binary quadratic model from a COOrdinate-formatted file.

  • fp – File pointer to a file opened in read mode.

  • cls – Deprecated. Does nothing.

  • vartype

    The valid variable types for binary quadratic models, is one of:


>>> from dimod.serialization import coo
>>> with open('my_bqm.txt', 'r') as f:          
...     my_bqm = coo.load(f, vartype=dimod.Vartype.SPIN)

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