dwavebinarycsp icon indicating copy to clipboard operation
dwavebinarycsp copied to clipboard

`load_cnf` returns no constraints from CNF file

Open pau557 opened this issue 5 years ago • 1 comments

Description I'm reading a CNF file with load_cnf, but the function returns a csp object without constraints

Steps To Reproduce

In [1]: import dwavebinarycsp as dbcsp

In [2]: cnf_file = "nae3sat_ratio210_size10_inst1.cnf"

In [3]: with open(cnf_file, 'r') as fp:
   ...:     csp = dbcsp.cnf.load_cnf(fp)
   ...:     

In [4]: csp.constraints
Out[4]: []

nae3sat_ratio210_size10_inst1.cnf.zip

Expected Behavior I would expect the csp object to have the constraints in the file

Environment

  • OS: Mac OS 10.14.6
  • Python version: 3.7.0
  • dwavebinarycsp version: 0.1.1

pau557 avatar Jun 02 '20 00:06 pau557

I believe changing line 4 to p cnf _ _ will fix it. But the function should raise a better exception.

arcondello avatar Jun 02 '20 00:06 arcondello