dwavesystems / dwavesystems/dwave-system

`LeapHybridCQMSampler` sometimes generates the wrong `time_limit` for problems with sparse objectives

Open
#482 0 comments 0 reactions 0 assignees View on GitHub
bug/fix
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.