dwavesystems / dwavesystems/dwave-system
`LeapHybridCQMSampler` sometimes generates the wrong `time_limit` for problems with sparse objectives
- Dominant language
- Python
- Stars
- 98
- Forks
- 67
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
In dimod 0.12.0, the CQM models started storing the variable info globally rather than in the objective. However, the serialization was not changed to match, see https://github.com/dwavesystems/dimod/issues/1303.
This creates a situation where the serialized model does not have the same number of biases as the given model.
Failing example:
```python
import dimod
from dwave.system import LeapHybridCQMSampler
sampler = LeapHybridCQMSampler()
cqm = dimod.ConstrainedQuadraticModel()
cqm.add_variables('INTEGER', 50_000)
cqm.add_constraint([(0, 1, 1)], '==', 0)
print(sampler.min_time_limit(cqm))
new = dimod.ConstrainedQuadraticModel().from_file(cqm.to_file())
print(sampler.min_time_limit(new))
```
gives
```bash
7.87090906404288
8.10376188704288
```
### Proposed Solution
The correct fix is to implement https://github.com/dwavesystems/dimod/issues/1303, though we could as an interim solution read the relevant timing variables off of the header of the serialized model.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.