``set_state()`` method quietly accepts transposed array
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- backend-api-design
Research direction
Start by reproducing the two set_state() calls from the issue and locate the set_state() implementation and its existing tests. Trace how array shapes are checked and determine the intended handling of the transposed input; done means the behavior is explicitly validated by tests and no longer accepts an unintended shape silently.
Written by the indexing model from the issue text.
Description
>>> model = Model()
>>> x = model.integer((2, 5))
>>> with model.lock():
... model.states.resize(2)
... x.set_state(0, [[1, 2], [1, 3], [4, 1], [3, 2], [5, 5]])
... x.set_state(1, [[1, 2, 3, 4, 5], [5, 4, 3, 2, 1]])
... print(x.state(1))
... print(x.state(0))
[[1. 2. 3. 4. 5.]
[5. 4. 3. 2. 1.]]
[[1. 2. 1. 3. 4.]
[1. 3. 2. 5. 5.]]
It's a nice "feature" to use but it will probably trip someone up.
- Dominant language
- C++
- Stars
- 31
- Forks
- 36
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dwavesystems/dwave-optimization
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dwavesystems/dwave-optimization#505 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in dwavesystems/dwave-optimization
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·