dwavesystems / dwavesystems/dwave-system
LeapHybridNLSampler not rejecting for `state_size() > maximum_number_of_states`
- Dominant language
- Python
- Stars
- 98
- Forks
- 67
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
**Description**
`LeapHybridNLSampler` accepts models with more than `maximum_number_of_states` states initialized but quietly ignore the rest. Users might think the rest are being used.
**To Reproduce**
```
model = traveling_salesperson(distance_matrix=DISTANCE_MATRIX)
route, = model.iter_decisions()
with model.lock():
model.states.resize(2)
route.set_state(0, [0, 1, 2, 3, 4])
route.set_state(1, [0, 1, 2, 3, 4])
results = sampler.sample(
model,
label='SDK Examples - TSP')
```
Expected it to reject: "Alex C 6 days ago Something that came up... we need to add it. And reject problems based on that num_states field in the header"
**Expected behavior**
Reject such problems
**Environment:**
- OS: WIN
- Python version: 3.11
**Additional context**
@alexzucca90 suggested to move to here.
I notice we actually check `maximum_number_of_states` property [here](https://github.com/dwavesystems/dwave-system/blob/b233941673cda08c194d769b067ab06ce43ea077/dwave/system/samplers/leap_hybrid_sampler.py#L941) so can easily do this in the client.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.