dimod.lp.load

load(file_like: Union[str, bytes, io.IOBase]) dimod.constrained.ConstrainedQuadraticModel[source]

Construct a constrained quadratic model from a LP file.

LP files are a common format for encoding optimization models. See documentation from Gurobi and CPLEX.

Parameters

file_like – Either a str or bytes object representing a path, or a file-like object.

Returns

An example of reading from a LP file.

with open('example.lp', 'rb') as f:
    cqm = dimod.lp.load(f)

An example of loading from a path

cqm = dimod.lp.load('example.lp')

See also

loads()

New in version 0.11.0.