dwavesystems / dwavesystems/dimod

bqm.to_coo() not storing the offset

Open
#767 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
143
Forks
91
Avg merge
1h 24m
Merged PRs (30d)
3

Description

**Description**
bqm offsets are not appearing in .coo files

**Steps To Reproduce**
```
import itertools
import dimod

bqm = dimod.BQM.from_ising({}, {c: 1 for c in itertools.combinations(range(4), 2)}, offset=42)

with open("inputs/{}.coo".format("test_1"), "w") as f:
bqm.to_coo(f, vartype_header=True)
```

**Expected Behavior**
the file should look like:
```
# vartype=SPIN
42
0 1 1.000000
0 2 1.000000
0 3 1.000000
1 2 1.000000
1 3 1.000000
2 3 1.000000
```

but it looks like:
```
# vartype=SPIN
0 1 1.000000
0 2 1.000000
0 3 1.000000
1 2 1.000000
1 3 1.000000
2 3 1.000000
```

**Environment**
- OS: MacOS 10.15.7
- Python version: Python 3.7.6
- dimod version: 0.9.9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.