dwavesystems / dwavesystems/dwave-optimization

Using `axes_sums_subject_to` on a `BinaryVariable` with size 0 results in a crash when initializing a state

Open
#635 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
31
Forks
36
Avg merge
16h 55m
Merged PRs (30d)
8

Description

```python
In [1]: from dwave.optimization import Model

In [2]: model = Model()

In [3]: b = model.binary(shape=0, axes_sums_subject_to=[(0, ">=", 1)])

In [4]: model.lock()
Out[4]:

In [5]: model.states.resize(1)

In [6]: b.state(0)
zsh: floating point exception (core dumped) ipython
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the Python snippet using a zero-sized BinaryVariable and axes_sums_subject_to. Trace BinaryVariable state initialization and constraint handling for the size-0 case, then check the relevant test area for a regression test; done means resizing to one state and accessing b.state(0) no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
67/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.