dimod.serialization.coo.dump¶
- dump(bqm: dimod.binary.binary_quadratic_model.BinaryQuadraticModel, fp: TextIO, vartype_header: bool = False)[source]¶
Dump a binary quadratic model to a file in COOrdinate format.
- Parameters
bqm – Binary quadratic model to save to a file in COO format.
fp – File pointer to a file opened in write mode.
vartype_header – Prefix the
Vartype
to the output.
Examples
>>> from dimod.serialization import coo >>> bqm = dimod.BinaryQuadraticModel.from_ising({0: 1, 1: 2}, {(0, 1): -1}) >>> with open('my_saved_bqm.txt', 'w') as f: ... coo.dump(bqm, f, vartype_header=True)